register_command.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2016, ownCloud, Inc.
  5. *
  6. * @author Bart Visscher <bartv@thisnet.nl>
  7. * @author Björn Schießle <bjoern@schiessle.org>
  8. * @author Christian Kampka <christian@kampka.net>
  9. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  10. * @author Daniel Calviño Sánchez <danxuliu@gmail.com>
  11. * @author Daniel Kesselberg <mail@danielkesselberg.de>
  12. * @author Denis Mosolov <denismosolov@gmail.com>
  13. * @author Joas Schilling <coding@schilljs.com>
  14. * @author Johannes Leuker <j.leuker@hosting.de>
  15. * @author Johannes Riedel <joeried@users.noreply.github.com>
  16. * @author John Molakvoæ <skjnldsv@protonmail.com>
  17. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  18. * @author Julius Härtl <jus@bitgrid.net>
  19. * @author Lukas Reschke <lukas@statuscode.ch>
  20. * @author michag86 <micha_g@arcor.de>
  21. * @author Morris Jobke <hey@morrisjobke.de>
  22. * @author Patrik Kernstock <info@pkern.at>
  23. * @author Robin Appelman <robin@icewind.nl>
  24. * @author Robin McCorkell <robin@mccorkell.me.uk>
  25. * @author Roeland Jago Douma <roeland@famdouma.nl>
  26. * @author Ruben Homs <ruben@homs.codes>
  27. * @author Sean Molenaar <sean@seanmolenaar.eu>
  28. * @author sualko <klaus@jsxc.org>
  29. * @author Thomas Müller <thomas.mueller@tmit.eu>
  30. * @author Thomas Pulzer <t.pulzer@kniel.de>
  31. * @author Victor Dubiniuk <dubiniuk@owncloud.com>
  32. * @author Vincent Petry <vincent@nextcloud.com>
  33. *
  34. * @license AGPL-3.0
  35. *
  36. * This code is free software: you can redistribute it and/or modify
  37. * it under the terms of the GNU Affero General Public License, version 3,
  38. * as published by the Free Software Foundation.
  39. *
  40. * This program is distributed in the hope that it will be useful,
  41. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  42. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  43. * GNU Affero General Public License for more details.
  44. *
  45. * You should have received a copy of the GNU Affero General Public License, version 3,
  46. * along with this program. If not, see <http://www.gnu.org/licenses/>
  47. *
  48. */
  49. use Psr\Log\LoggerInterface;
  50. $application->add(new \Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand());
  51. $application->add(new OC\Core\Command\Status(\OC::$server->get(\OCP\IConfig::class), \OC::$server->get(\OCP\Defaults::class)));
  52. $application->add(new OC\Core\Command\Check(\OC::$server->getSystemConfig()));
  53. $application->add(new OC\Core\Command\L10n\CreateJs());
  54. $application->add(new \OC\Core\Command\Integrity\SignApp(
  55. \OC::$server->getIntegrityCodeChecker(),
  56. new \OC\IntegrityCheck\Helpers\FileAccessHelper(),
  57. \OC::$server->getURLGenerator()
  58. ));
  59. $application->add(new \OC\Core\Command\Integrity\SignCore(
  60. \OC::$server->getIntegrityCodeChecker(),
  61. new \OC\IntegrityCheck\Helpers\FileAccessHelper()
  62. ));
  63. $application->add(new \OC\Core\Command\Integrity\CheckApp(
  64. \OC::$server->getIntegrityCodeChecker()
  65. ));
  66. $application->add(new \OC\Core\Command\Integrity\CheckCore(
  67. \OC::$server->getIntegrityCodeChecker()
  68. ));
  69. if (\OC::$server->getConfig()->getSystemValue('installed', false)) {
  70. $application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager()));
  71. $application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager(), \OC::$server->getGroupManager()));
  72. $application->add(new OC\Core\Command\App\Install());
  73. $application->add(new OC\Core\Command\App\GetPath());
  74. $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager()));
  75. $application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->get(LoggerInterface::class)));
  76. $application->add(\OC::$server->query(\OC\Core\Command\App\Update::class));
  77. $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Cleanup::class));
  78. $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enforce::class));
  79. $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enable::class));
  80. $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Disable::class));
  81. $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\State::class));
  82. $application->add(new OC\Core\Command\Background\Cron(\OC::$server->getConfig()));
  83. $application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig()));
  84. $application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig()));
  85. $application->add(new OC\Core\Command\Background\Job(\OC::$server->getJobList(), \OC::$server->getLogger()));
  86. $application->add(new OC\Core\Command\Background\ListCommand(\OC::$server->getJobList()));
  87. $application->add(\OC::$server->query(\OC\Core\Command\Broadcast\Test::class));
  88. $application->add(new OC\Core\Command\Config\App\DeleteConfig(\OC::$server->getConfig()));
  89. $application->add(new OC\Core\Command\Config\App\GetConfig(\OC::$server->getConfig()));
  90. $application->add(new OC\Core\Command\Config\App\SetConfig(\OC::$server->getConfig()));
  91. $application->add(new OC\Core\Command\Config\Import(\OC::$server->getConfig()));
  92. $application->add(new OC\Core\Command\Config\ListConfigs(\OC::$server->getSystemConfig(), \OC::$server->getAppConfig()));
  93. $application->add(new OC\Core\Command\Config\System\DeleteConfig(\OC::$server->getSystemConfig()));
  94. $application->add(new OC\Core\Command\Config\System\GetConfig(\OC::$server->getSystemConfig()));
  95. $application->add(new OC\Core\Command\Config\System\SetConfig(\OC::$server->getSystemConfig()));
  96. $application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig())));
  97. $application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->get(LoggerInterface::class)));
  98. $application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->get(\OC\DB\Connection::class)));
  99. $application->add(new OC\Core\Command\Db\AddMissingIndices(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getEventDispatcher()));
  100. $application->add(new OC\Core\Command\Db\AddMissingColumns(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getEventDispatcher()));
  101. $application->add(new OC\Core\Command\Db\AddMissingPrimaryKeys(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getEventDispatcher()));
  102. if (\OC::$server->getConfig()->getSystemValueBool('debug', false)) {
  103. $application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->get(\OC\DB\Connection::class)));
  104. $application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->get(\OC\DB\Connection::class)));
  105. $application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getAppManager()));
  106. $application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getConfig()));
  107. }
  108. $application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig()));
  109. $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager()));
  110. $application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager(), \OC::$server->getConfig()));
  111. $application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager(), \OC::$server->getConfig()));
  112. $application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager()));
  113. $application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper()));
  114. $application->add(new OC\Core\Command\Encryption\DecryptAll(
  115. \OC::$server->getEncryptionManager(),
  116. \OC::$server->getAppManager(),
  117. \OC::$server->getConfig(),
  118. new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()),
  119. new \Symfony\Component\Console\Helper\QuestionHelper())
  120. );
  121. $application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig()));
  122. $application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig()));
  123. $view = new \OC\Files\View();
  124. $util = new \OC\Encryption\Util(
  125. $view,
  126. \OC::$server->getUserManager(),
  127. \OC::$server->getGroupManager(),
  128. \OC::$server->getConfig()
  129. );
  130. $application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot(
  131. $view,
  132. \OC::$server->getUserManager(),
  133. \OC::$server->getConfig(),
  134. $util,
  135. new \Symfony\Component\Console\Helper\QuestionHelper()
  136. )
  137. );
  138. $application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util));
  139. $application->add(new OC\Core\Command\Encryption\MigrateKeyStorage(
  140. $view,
  141. \OC::$server->getUserManager(),
  142. \OC::$server->getConfig(),
  143. $util,
  144. \OC::$server->getCrypto()
  145. )
  146. );
  147. $application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory()));
  148. $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader()));
  149. $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector()));
  150. $application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig()));
  151. $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess());
  152. $application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory()));
  153. $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->get(LoggerInterface::class), \OC::$server->query(\OC\Installer::class)));
  154. $application->add(new OC\Core\Command\Maintenance\Repair(
  155. new \OC\Repair([], \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class), \OC::$server->get(LoggerInterface::class)),
  156. \OC::$server->getConfig(),
  157. \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class),
  158. \OC::$server->getAppManager()
  159. ));
  160. $application->add(\OC::$server->query(OC\Core\Command\Maintenance\RepairShareOwnership::class));
  161. $application->add(\OC::$server->query(\OC\Core\Command\Preview\Repair::class));
  162. $application->add(\OC::$server->query(\OC\Core\Command\Preview\ResetRenderedTexts::class));
  163. $application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  164. $application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager()));
  165. $application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager()));
  166. $application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager()));
  167. $application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager()));
  168. $application->add(\OC::$server->get(\OC\Core\Command\User\Report::class));
  169. $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager(), \OC::$server->getAppManager()));
  170. $application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig()));
  171. $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  172. $application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  173. $application->add(new OC\Core\Command\User\AddAppPassword(\OC::$server->get(\OCP\IUserManager::class), \OC::$server->get(\OC\Authentication\Token\IProvider::class), \OC::$server->get(\OCP\Security\ISecureRandom::class), \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class)));
  174. $application->add(new OC\Core\Command\Group\Add(\OC::$server->getGroupManager()));
  175. $application->add(new OC\Core\Command\Group\Delete(\OC::$server->getGroupManager()));
  176. $application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager()));
  177. $application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  178. $application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  179. $application->add(new OC\Core\Command\Group\Info(\OC::$server->get(\OCP\IGroupManager::class)));
  180. $application->add(new OC\Core\Command\SystemTag\ListCommand(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
  181. $application->add(new OC\Core\Command\SystemTag\Delete(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
  182. $application->add(new OC\Core\Command\SystemTag\Add(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
  183. $application->add(new OC\Core\Command\SystemTag\Edit(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
  184. $application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(), \OC::$server->getL10N('core')));
  185. $application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager()));
  186. $application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager()));
  187. $application->add(new OC\Core\Command\Security\ResetBruteforceAttempts(\OC::$server->getBruteForceThrottler()));
  188. } else {
  189. $application->add(\OC::$server->get(\OC\Core\Command\Maintenance\Install::class));
  190. }