console.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/usr/bin/env php
  2. <?php
  3. /* For licensing terms, see /license.txt */
  4. set_time_limit(0);
  5. if (PHP_SAPI != 'cli') {
  6. die("Cannot be called by any other method than the command line.");
  7. }
  8. $app = require_once dirname(__FILE__).'/main/inc/global.inc.php';
  9. use Knp\Provider\ConsoleServiceProvider;
  10. $app->register(
  11. new ConsoleServiceProvider(),
  12. array(
  13. 'console.name' => 'Chamilo CLI',
  14. 'console.version' => '1.0.0',
  15. 'console.project_directory' => __DIR__.'/..'
  16. )
  17. );
  18. // Variable $helperSet is defined inside cli-config.php
  19. //require __DIR__.'/console-config.php';
  20. //$cli = new \Symfony\Component\Console\Application('Chamilo CLI');
  21. // Adding commands.
  22. /** @var Knp\Console\Application $cli */
  23. $cli = $app['console'];
  24. $cli->setCatchExceptions(true);
  25. $helpers = array(
  26. 'configuration' => new Chash\Helpers\ConfigurationHelper()
  27. );
  28. $helperSet = $cli->getHelperSet();
  29. foreach ($helpers as $name => $helper) {
  30. $helperSet->set($helper, $name);
  31. }
  32. $cli->addCommands(
  33. array(
  34. // DBAL Commands.
  35. new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(),
  36. new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(),
  37. // ORM Commands.
  38. new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(),
  39. new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(),
  40. new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(),
  41. new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(),
  42. new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(),
  43. new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(),
  44. new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(),
  45. new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(),
  46. new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(),
  47. new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(),
  48. new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(),
  49. new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(),
  50. new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(),
  51. new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand(),
  52. // Migrations Commands.
  53. new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand(),
  54. new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand(),
  55. new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand(),
  56. new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(),
  57. new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(),
  58. new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand(),
  59. // Chamilo commands.
  60. new ChamiloLMS\Command\Template\AsseticDumpCommand(),
  61. new ChamiloLMS\Command\Translation\ExportLanguagesCommand(),
  62. // Chash commands.
  63. new Chash\Command\Database\RunSQLCommand(),
  64. new Chash\Command\Database\DumpCommand(),
  65. new Chash\Command\Database\RestoreCommand(),
  66. new Chash\Command\Database\SQLCountCommand(),
  67. new Chash\Command\Database\FullBackupCommand(),
  68. new Chash\Command\Database\DropDatabaseCommand(),
  69. new Chash\Command\Files\CleanTempFolderCommand(),
  70. new Chash\Command\Files\CleanConfigFilesCommand(),
  71. new Chash\Command\Translation\ExportLanguageCommand(),
  72. new Chash\Command\Translation\ImportLanguageCommand()
  73. )
  74. );
  75. $cli->run();