Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Plugin.php 942B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\composer;
  8. use Composer\Composer;
  9. use Composer\IO\IOInterface;
  10. use Composer\Plugin\PluginInterface;
  11. /**
  12. * Plugin is the composer plugin that registers the Yii composer installer.
  13. *
  14. * @author Qiang Xue <qiang.xue@gmail.com>
  15. * @since 2.0
  16. */
  17. class Plugin implements PluginInterface
  18. {
  19. /**
  20. * @inheritdoc
  21. */
  22. public function activate(Composer $composer, IOInterface $io)
  23. {
  24. $installer = new Installer($io, $composer);
  25. $composer->getInstallationManager()->addInstaller($installer);
  26. $file = rtrim($composer->getConfig()->get('vendor-dir'), '/') . '/yiisoft/extensions.php';
  27. if (!is_file($file)) {
  28. @mkdir(dirname($file), 0777, true);
  29. file_put_contents($file, "<?php\n\nreturn [];\n");
  30. }
  31. }
  32. }