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