register_command.php 11 KB

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