chash.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * Command-line tool to do things more swiftly in Chamilo.
  4. * To add support for a new command see the Console Component read:
  5. *
  6. * https://speakerdeck.com/hhamon/symfony-extending-the-console-component
  7. * http://symfony.com/doc/2.0/components/console/introduction.html
  8. *
  9. * @author Julio Montoya <gugli100@gmail.com>
  10. * @author Yannick Warnier <yannick.warnier@beeznest.com>
  11. * @license This script is provided under the terms of the GNU/GPLv3+ license
  12. */
  13. /* Security check: do not allow any other calling method than command-line */
  14. if (PHP_SAPI != 'cli') {
  15. die("Chash cannot be called by any other method than the command line.");
  16. }
  17. require __DIR__.'/vendor/autoload.php';
  18. use Symfony\Component\Console\Application;
  19. $helpers = array(
  20. 'configuration' => new Chash\Helpers\ConfigurationHelper()
  21. );
  22. $application = new Application('Chamilo Command Line Interface', '1.0');
  23. $helperSet = $application->getHelperSet();
  24. foreach ($helpers as $name => $helper) {
  25. $helperSet->set($helper, $name);
  26. }
  27. $application->addCommands(
  28. array(
  29. // DBAL Commands.
  30. new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(),
  31. //new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(),
  32. // Migrations Commands.
  33. new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand(),
  34. new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand(),
  35. new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand(),
  36. new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(),
  37. new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(),
  38. new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand(),
  39. // Chash commands
  40. new Chash\Command\Chash\SetupCommand(),
  41. new Chash\Command\Chash\SelfUpdateCommand(),
  42. new Chash\Command\Database\RunSQLCommand(),
  43. new Chash\Command\Database\ImportCommand(),
  44. new Chash\Command\Database\DumpCommand(),
  45. new Chash\Command\Database\RestoreCommand(),
  46. new Chash\Command\Database\SQLCountCommand(),
  47. new Chash\Command\Database\FullBackupCommand(),
  48. new Chash\Command\Database\DropDatabaseCommand(),
  49. new Chash\Command\Database\ShowConnInfoCommand(),
  50. new Chash\Command\Files\CleanConfigFilesCommand(),
  51. new Chash\Command\Files\CleanCoursesFilesCommand(),
  52. new Chash\Command\Files\CleanDeletedDocumentsCommand(),
  53. new Chash\Command\Files\CleanTempFolderCommand(),
  54. new Chash\Command\Files\ConvertVideosCommand(),
  55. new Chash\Command\Files\DeleteCoursesCommand(),
  56. new Chash\Command\Files\DeleteMultiUrlCommand(),
  57. new Chash\Command\Files\GenerateTempFileStructureCommand(),
  58. new Chash\Command\Files\MailConfCommand(),
  59. new Chash\Command\Files\SetPermissionsAfterInstallCommand(),
  60. new Chash\Command\Files\ShowDiskUsageCommand(),
  61. new Chash\Command\Files\UpdateDirectoryMaxSizeCommand(),
  62. new Chash\Command\Files\ReplaceURLCommand(),
  63. new Chash\Command\Info\WhichCommand(),
  64. new Chash\Command\Info\GetInstancesCommand(),
  65. new Chash\Command\Installation\InstallCommand(),
  66. new Chash\Command\Installation\WipeCommand(),
  67. new Chash\Command\Installation\StatusCommand(),
  68. new Chash\Command\Installation\UpgradeCommand(),
  69. new Chash\Command\Translation\AddSubLanguageCommand(),
  70. new Chash\Command\Translation\DisableLanguageCommand(),
  71. new Chash\Command\Translation\EnableLanguageCommand(),
  72. new Chash\Command\Translation\ExportLanguageCommand(),
  73. new Chash\Command\Translation\ImportLanguageCommand(),
  74. new Chash\Command\Translation\ListLanguagesCommand(),
  75. new Chash\Command\Translation\PlatformLanguageCommand(),
  76. new Chash\Command\Translation\TermsPackageCommand(),
  77. new Chash\Command\User\ChangePassCommand(),
  78. new Chash\Command\User\DisableAdminsCommand(),
  79. new Chash\Command\User\MakeAdminCommand(),
  80. new Chash\Command\User\ResetLoginCommand(),
  81. new Chash\Command\User\SetLanguageCommand(),
  82. new Chash\Command\User\UsersPerUrlAccessCommand(),
  83. )
  84. );
  85. $application->run();