register_command.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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 Maxence Lange <maxence@artificial-owl.com>
  21. * @author michag86 <micha_g@arcor.de>
  22. * @author Morris Jobke <hey@morrisjobke.de>
  23. * @author Patrik Kernstock <info@pkern.at>
  24. * @author Robin Appelman <robin@icewind.nl>
  25. * @author Robin McCorkell <robin@mccorkell.me.uk>
  26. * @author Roeland Jago Douma <roeland@famdouma.nl>
  27. * @author Ruben Homs <ruben@homs.codes>
  28. * @author Sean Molenaar <sean@seanmolenaar.eu>
  29. * @author sualko <klaus@jsxc.org>
  30. * @author Thomas Müller <thomas.mueller@tmit.eu>
  31. * @author Thomas Pulzer <t.pulzer@kniel.de>
  32. * @author Victor Dubiniuk <dubiniuk@owncloud.com>
  33. * @author Vincent Petry <vincent@nextcloud.com>
  34. *
  35. * @license AGPL-3.0
  36. *
  37. * This code is free software: you can redistribute it and/or modify
  38. * it under the terms of the GNU Affero General Public License, version 3,
  39. * as published by the Free Software Foundation.
  40. *
  41. * This program is distributed in the hope that it will be useful,
  42. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  43. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  44. * GNU Affero General Public License for more details.
  45. *
  46. * You should have received a copy of the GNU Affero General Public License, version 3,
  47. * along with this program. If not, see <http://www.gnu.org/licenses/>
  48. *
  49. */
  50. use Psr\Log\LoggerInterface;
  51. $application->add(new \Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand());
  52. $application->add(new OC\Core\Command\Status(\OC::$server->get(\OCP\IConfig::class), \OC::$server->get(\OCP\Defaults::class)));
  53. $application->add(new OC\Core\Command\Check(\OC::$server->getSystemConfig()));
  54. $application->add(new OC\Core\Command\L10n\CreateJs());
  55. $application->add(new \OC\Core\Command\Integrity\SignApp(
  56. \OC::$server->getIntegrityCodeChecker(),
  57. new \OC\IntegrityCheck\Helpers\FileAccessHelper(),
  58. \OC::$server->getURLGenerator()
  59. ));
  60. $application->add(new \OC\Core\Command\Integrity\SignCore(
  61. \OC::$server->getIntegrityCodeChecker(),
  62. new \OC\IntegrityCheck\Helpers\FileAccessHelper()
  63. ));
  64. $application->add(new \OC\Core\Command\Integrity\CheckApp(
  65. \OC::$server->getIntegrityCodeChecker()
  66. ));
  67. $application->add(new \OC\Core\Command\Integrity\CheckCore(
  68. \OC::$server->getIntegrityCodeChecker()
  69. ));
  70. if (\OC::$server->getConfig()->getSystemValue('installed', false)) {
  71. $application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager()));
  72. $application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager(), \OC::$server->getGroupManager()));
  73. $application->add(new OC\Core\Command\App\Install());
  74. $application->add(new OC\Core\Command\App\GetPath());
  75. $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager()));
  76. $application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->get(LoggerInterface::class)));
  77. $application->add(\OC::$server->query(\OC\Core\Command\App\Update::class));
  78. $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Cleanup::class));
  79. $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enforce::class));
  80. $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enable::class));
  81. $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Disable::class));
  82. $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\State::class));
  83. $application->add(new OC\Core\Command\Background\Cron(\OC::$server->getConfig()));
  84. $application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig()));
  85. $application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig()));
  86. $application->add(new OC\Core\Command\Background\Job(\OC::$server->getJobList(), \OC::$server->getLogger()));
  87. $application->add(new OC\Core\Command\Background\ListCommand(\OC::$server->getJobList()));
  88. $application->add(\OCP\Server::get(\OC\Core\Command\Background\Delete::class));
  89. $application->add(\OC::$server->query(\OC\Core\Command\Broadcast\Test::class));
  90. $application->add(new OC\Core\Command\Config\App\DeleteConfig(\OC::$server->getConfig()));
  91. $application->add(new OC\Core\Command\Config\App\GetConfig(\OC::$server->getConfig()));
  92. $application->add(new OC\Core\Command\Config\App\SetConfig(\OC::$server->getConfig()));
  93. $application->add(new OC\Core\Command\Config\Import(\OC::$server->getConfig()));
  94. $application->add(new OC\Core\Command\Config\ListConfigs(\OC::$server->getSystemConfig(), \OC::$server->getAppConfig()));
  95. $application->add(new OC\Core\Command\Config\System\DeleteConfig(\OC::$server->getSystemConfig()));
  96. $application->add(new OC\Core\Command\Config\System\GetConfig(\OC::$server->getSystemConfig()));
  97. $application->add(new OC\Core\Command\Config\System\SetConfig(\OC::$server->getSystemConfig()));
  98. $application->add(\OC::$server->get(OC\Core\Command\Info\File::class));
  99. $application->add(\OC::$server->get(OC\Core\Command\Info\Space::class));
  100. $application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig())));
  101. $application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->get(LoggerInterface::class)));
  102. $application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->get(\OC\DB\Connection::class)));
  103. $application->add(\OCP\Server::get(\OC\Core\Command\Db\AddMissingColumns::class));
  104. $application->add(\OCP\Server::get(\OC\Core\Command\Db\AddMissingIndices::class));
  105. $application->add(\OCP\Server::get(\OC\Core\Command\Db\AddMissingPrimaryKeys::class));
  106. if (\OC::$server->getConfig()->getSystemValueBool('debug', false)) {
  107. $application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->get(\OC\DB\Connection::class)));
  108. $application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->get(\OC\DB\Connection::class)));
  109. $application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getAppManager()));
  110. $application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->get(\OC\DB\Connection::class), \OC::$server->getConfig()));
  111. }
  112. $application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig()));
  113. $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager()));
  114. $application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager(), \OC::$server->getConfig()));
  115. $application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager(), \OC::$server->getConfig()));
  116. $application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager()));
  117. $application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper()));
  118. $application->add(new OC\Core\Command\Encryption\DecryptAll(
  119. \OC::$server->getEncryptionManager(),
  120. \OC::$server->getAppManager(),
  121. \OC::$server->getConfig(),
  122. new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()),
  123. new \Symfony\Component\Console\Helper\QuestionHelper())
  124. );
  125. $application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig()));
  126. $application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig()));
  127. $view = new \OC\Files\View();
  128. $util = new \OC\Encryption\Util(
  129. $view,
  130. \OC::$server->getUserManager(),
  131. \OC::$server->getGroupManager(),
  132. \OC::$server->getConfig()
  133. );
  134. $application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot(
  135. $view,
  136. \OC::$server->getUserManager(),
  137. \OC::$server->getConfig(),
  138. $util,
  139. new \Symfony\Component\Console\Helper\QuestionHelper()
  140. )
  141. );
  142. $application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util));
  143. $application->add(new OC\Core\Command\Encryption\MigrateKeyStorage(
  144. $view,
  145. \OC::$server->getUserManager(),
  146. \OC::$server->getConfig(),
  147. $util,
  148. \OC::$server->getCrypto()
  149. )
  150. );
  151. $application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory()));
  152. $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader()));
  153. $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector()));
  154. $application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig()));
  155. $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess());
  156. $application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory()));
  157. $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->get(LoggerInterface::class), \OC::$server->query(\OC\Installer::class)));
  158. $application->add(new OC\Core\Command\Maintenance\Repair(
  159. new \OC\Repair([], \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class), \OC::$server->get(LoggerInterface::class)),
  160. \OC::$server->getConfig(),
  161. \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class),
  162. \OC::$server->getAppManager()
  163. ));
  164. $application->add(\OC::$server->query(OC\Core\Command\Maintenance\RepairShareOwnership::class));
  165. $application->add(\OC::$server->get(\OC\Core\Command\Preview\Generate::class));
  166. $application->add(\OC::$server->query(\OC\Core\Command\Preview\Repair::class));
  167. $application->add(\OC::$server->query(\OC\Core\Command\Preview\ResetRenderedTexts::class));
  168. $application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  169. $application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager()));
  170. $application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager()));
  171. $application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager()));
  172. $application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager()));
  173. $application->add(\OC::$server->get(\OC\Core\Command\User\Report::class));
  174. $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager(), \OC::$server->getAppManager()));
  175. $application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig()));
  176. $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  177. $application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  178. $application->add(new OC\Core\Command\User\SyncAccountDataCommand(\OC::$server->getUserManager(), \OC::$server->get(\OCP\Accounts\IAccountManager::class)));
  179. $application->add(\OC::$server->get(\OC\Core\Command\User\AuthTokens\Add::class));
  180. $application->add(\OC::$server->get(\OC\Core\Command\User\AuthTokens\ListCommand::class));
  181. $application->add(\OC::$server->get(\OC\Core\Command\User\AuthTokens\Delete::class));
  182. $application->add(new OC\Core\Command\Group\Add(\OC::$server->getGroupManager()));
  183. $application->add(new OC\Core\Command\Group\Delete(\OC::$server->getGroupManager()));
  184. $application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager()));
  185. $application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  186. $application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  187. $application->add(new OC\Core\Command\Group\Info(\OC::$server->get(\OCP\IGroupManager::class)));
  188. $application->add(new OC\Core\Command\SystemTag\ListCommand(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
  189. $application->add(new OC\Core\Command\SystemTag\Delete(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
  190. $application->add(new OC\Core\Command\SystemTag\Add(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
  191. $application->add(new OC\Core\Command\SystemTag\Edit(\OC::$server->get(\OCP\SystemTag\ISystemTagManager::class)));
  192. $application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(), \OC::$server->getL10N('core')));
  193. $application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager()));
  194. $application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager()));
  195. $application->add(\OC::$server->get(\OC\Core\Command\Security\BruteforceAttempts::class));
  196. $application->add(\OC::$server->get(\OC\Core\Command\Security\BruteforceResetAttempts::class));
  197. $application->add(\OC::$server->get(\OC\Core\Command\SetupChecks::class));
  198. $application->add(\OCP\Server::get(\OC\Core\Command\FilesMetadata\Get::class));
  199. } else {
  200. $application->add(\OC::$server->get(\OC\Core\Command\Maintenance\Install::class));
  201. }