register_command.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bart Visscher <bartv@thisnet.nl>
  6. * @author Björn Schießle <bjoern@schiessle.org>
  7. * @author Christian Kampka <christian@kampka.net>
  8. * @author Christoph Wurst <christoph@owncloud.com>
  9. * @author Joas Schilling <coding@schilljs.com>
  10. * @author Julius Härtl <jus@bitgrid.net>
  11. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  12. * @author Lukas Reschke <lukas@statuscode.ch>
  13. * @author Morris Jobke <hey@morrisjobke.de>
  14. * @author Robin Appelman <robin@icewind.nl>
  15. * @author Robin McCorkell <robin@mccorkell.me.uk>
  16. * @author Roeland Jago Douma <roeland@famdouma.nl>
  17. * @author sualko <klaus@jsxc.org>
  18. * @author Thomas Müller <thomas.mueller@tmit.eu>
  19. * @author Thomas Pulzer <t.pulzer@kniel.de>
  20. * @author Victor Dubiniuk <dubiniuk@owncloud.com>
  21. * @author Vincent Petry <pvince81@owncloud.com>
  22. *
  23. * @license AGPL-3.0
  24. *
  25. * This code is free software: you can redistribute it and/or modify
  26. * it under the terms of the GNU Affero General Public License, version 3,
  27. * as published by the Free Software Foundation.
  28. *
  29. * This program is distributed in the hope that it will be useful,
  30. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  31. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  32. * GNU Affero General Public License for more details.
  33. *
  34. * You should have received a copy of the GNU Affero General Public License, version 3,
  35. * along with this program. If not, see <http://www.gnu.org/licenses/>
  36. *
  37. */
  38. /** @var $application Symfony\Component\Console\Application */
  39. $application->add(new \Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand());
  40. $application->add(new OC\Core\Command\Status);
  41. $application->add(new OC\Core\Command\Check(\OC::$server->getSystemConfig()));
  42. $application->add(new OC\Core\Command\App\CheckCode());
  43. $application->add(new OC\Core\Command\L10n\CreateJs());
  44. $application->add(new \OC\Core\Command\Integrity\SignApp(
  45. \OC::$server->getIntegrityCodeChecker(),
  46. new \OC\IntegrityCheck\Helpers\FileAccessHelper(),
  47. \OC::$server->getURLGenerator()
  48. ));
  49. $application->add(new \OC\Core\Command\Integrity\SignCore(
  50. \OC::$server->getIntegrityCodeChecker(),
  51. new \OC\IntegrityCheck\Helpers\FileAccessHelper()
  52. ));
  53. $application->add(new \OC\Core\Command\Integrity\CheckApp(
  54. \OC::$server->getIntegrityCodeChecker()
  55. ));
  56. $application->add(new \OC\Core\Command\Integrity\CheckCore(
  57. \OC::$server->getIntegrityCodeChecker()
  58. ));
  59. if (\OC::$server->getConfig()->getSystemValue('installed', false)) {
  60. $application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager()));
  61. $application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager()));
  62. $application->add(new OC\Core\Command\App\Install());
  63. $application->add(new OC\Core\Command\App\GetPath());
  64. $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager()));
  65. $application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->getLogger()));
  66. $application->add(\OC::$server->query(\OC\Core\Command\App\Update::class));
  67. $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Cleanup::class));
  68. $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enforce::class));
  69. $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enable::class));
  70. $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Disable::class));
  71. $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\State::class));
  72. $application->add(new OC\Core\Command\Background\Cron(\OC::$server->getConfig()));
  73. $application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig()));
  74. $application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig()));
  75. $application->add(new OC\Core\Command\Config\App\DeleteConfig(\OC::$server->getConfig()));
  76. $application->add(new OC\Core\Command\Config\App\GetConfig(\OC::$server->getConfig()));
  77. $application->add(new OC\Core\Command\Config\App\SetConfig(\OC::$server->getConfig()));
  78. $application->add(new OC\Core\Command\Config\Import(\OC::$server->getConfig()));
  79. $application->add(new OC\Core\Command\Config\ListConfigs(\OC::$server->getSystemConfig(), \OC::$server->getAppConfig()));
  80. $application->add(new OC\Core\Command\Config\System\DeleteConfig(\OC::$server->getSystemConfig()));
  81. $application->add(new OC\Core\Command\Config\System\GetConfig(\OC::$server->getSystemConfig()));
  82. $application->add(new OC\Core\Command\Config\System\SetConfig(\OC::$server->getSystemConfig()));
  83. $application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig())));
  84. $application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->getLogger()));
  85. $application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->getDatabaseConnection()));
  86. $application->add(new OC\Core\Command\Db\AddMissingIndices(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher()));
  87. $application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->getDatabaseConnection()));
  88. $application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->getDatabaseConnection()));
  89. $application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager()));
  90. $application->add(new OC\Core\Command\Db\Migrations\GenerateFromSchemaFileCommand(\OC::$server->getConfig(), \OC::$server->getAppManager(), \OC::$server->getDatabaseConnection()));
  91. $application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager(), \OC::$server->getConfig()));
  92. $application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig()));
  93. $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager()));
  94. $application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager()));
  95. $application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager()));
  96. $application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager()));
  97. $application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper()));
  98. $application->add(new OC\Core\Command\Encryption\DecryptAll(
  99. \OC::$server->getEncryptionManager(),
  100. \OC::$server->getAppManager(),
  101. \OC::$server->getConfig(),
  102. new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()),
  103. new \Symfony\Component\Console\Helper\QuestionHelper())
  104. );
  105. $application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig()));
  106. $application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig()));
  107. $view = new \OC\Files\View();
  108. $util = new \OC\Encryption\Util(
  109. $view,
  110. \OC::$server->getUserManager(),
  111. \OC::$server->getGroupManager(),
  112. \OC::$server->getConfig()
  113. );
  114. $application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot(
  115. $view,
  116. \OC::$server->getUserManager(),
  117. \OC::$server->getConfig(),
  118. $util,
  119. new \Symfony\Component\Console\Helper\QuestionHelper()
  120. )
  121. );
  122. $application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util));
  123. $application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory()));
  124. $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader()));
  125. $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector()));
  126. $application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig()));
  127. $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess());
  128. $application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory()));
  129. $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->query(\OC\Installer::class)));
  130. $application->add(new OC\Core\Command\Maintenance\Repair(
  131. new \OC\Repair([], \OC::$server->getEventDispatcher()),
  132. \OC::$server->getConfig(),
  133. \OC::$server->getEventDispatcher(),
  134. \OC::$server->getAppManager()
  135. ));
  136. $application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  137. $application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager()));
  138. $application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager()));
  139. $application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager()));
  140. $application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager()));
  141. $application->add(new OC\Core\Command\User\Report(\OC::$server->getUserManager()));
  142. $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager()));
  143. $application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig(), \OC::$server->getDatabaseConnection()));
  144. $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager()));
  145. $application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  146. $application->add(new OC\Core\Command\Group\Add(\OC::$server->getGroupManager()));
  147. $application->add(new OC\Core\Command\Group\Delete(\OC::$server->getGroupManager()));
  148. $application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager()));
  149. $application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  150. $application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  151. $application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(null), \OC::$server->getL10N('core')));
  152. $application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager(null)));
  153. $application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager(null)));
  154. } else {
  155. $application->add(new OC\Core\Command\Maintenance\Install(\OC::$server->getSystemConfig()));
  156. }