chash.php 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 Yannick Warnier <yannick.warnier@beeznest.com>
  10. * @author Julio Montoya <gugli100@gmail.com>
  11. * @version 2.0
  12. * @license This script is provided under the terms of the GNU/GPLv3+ license
  13. */
  14. /**
  15. * Security check: do not allow any other calling method than command-line
  16. */
  17. if (PHP_SAPI != 'cli') {
  18. die("Chash cannot be called by any other method than the command line.");
  19. }
  20. require __DIR__.'/vendor/autoload.php';
  21. use Symfony\Component\Console\Application;
  22. $helpers = array(
  23. 'configuration' => new Chash\Helpers\ConfigurationHelper()
  24. );
  25. $application = new Application('Chamilo Command Line Interface', '1.0');
  26. $helperSet = $application->getHelperSet();
  27. foreach ($helpers as $name => $helper) {
  28. $helperSet->set($helper, $name);
  29. }
  30. $application->addCommands(
  31. array(
  32. // DBAL Commands.
  33. new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(),
  34. new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(),
  35. // Migrations Commands.
  36. new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand(),
  37. new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand(),
  38. new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand(),
  39. new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(),
  40. new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(),
  41. new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand(),
  42. // Chash commands
  43. new Chash\Command\Chash\SetupCommand(),
  44. new Chash\Command\Chash\SelfUpdateCommand(),
  45. new Chash\Command\Database\RunSQLCommand(),
  46. new Chash\Command\Database\DumpCommand(),
  47. new Chash\Command\Database\RestoreCommand(),
  48. new Chash\Command\Database\SQLCountCommand(),
  49. new Chash\Command\Database\FullBackupCommand(),
  50. new Chash\Command\Database\DropDatabaseCommand(),
  51. new Chash\Command\Database\ShowConnInfoCommand(),
  52. new Chash\Command\Files\CleanDataFilesCommand(),
  53. new Chash\Command\Files\CleanTempFolderCommand(),
  54. new Chash\Command\Files\CleanConfigFilesCommand(),
  55. new Chash\Command\Files\MailConfCommand(),
  56. new Chash\Command\Files\SetPermissionsAfterInstallCommand(),
  57. new Chash\Command\Files\GenerateTempFileStructureCommand(),
  58. new Chash\Command\Installation\InstallCommand(),
  59. new Chash\Command\Installation\WipeCommand(),
  60. new Chash\Command\Installation\StatusCommand(),
  61. new Chash\Command\Installation\UpgradeCommand(),
  62. new Chash\Command\Translation\AddSubLanguageCommand(),
  63. new Chash\Command\Translation\DisableLanguageCommand(),
  64. new Chash\Command\Translation\EnableLanguageCommand(),
  65. new Chash\Command\Translation\ExportLanguageCommand(),
  66. new Chash\Command\Translation\ImportLanguageCommand(),
  67. new Chash\Command\Translation\ListLanguagesCommand(),
  68. new Chash\Command\Translation\PlatformLanguageCommand(),
  69. new Chash\Command\User\ChangePassCommand(),
  70. new Chash\Command\User\DisableAdminsCommand(),
  71. new Chash\Command\User\MakeAdminCommand(),
  72. new Chash\Command\User\ResetLoginCommand(),
  73. new Chash\Command\User\SetLanguageCommand(),
  74. )
  75. );
  76. $application->run();
  77. //Interactive shell
  78. //$shell = new Console\Shell($application);
  79. //$shell->run();