register_command.php 12 KB

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