console.php 4.4 KB

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