register_command.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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\Migrations\StatusCommand(\OC::$server->getDatabaseConnection()));
  95. $application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->getDatabaseConnection()));
  96. $application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager()));
  97. $application->add(new OC\Core\Command\Db\Migrations\GenerateFromSchemaFileCommand(\OC::$server->getConfig(), \OC::$server->getAppManager(), \OC::$server->getDatabaseConnection()));
  98. $application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager(), \OC::$server->getConfig()));
  99. $application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig()));
  100. $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager()));
  101. $application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager(), \OC::$server->getConfig()));
  102. $application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager(), \OC::$server->getConfig()));
  103. $application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager()));
  104. $application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper()));
  105. $application->add(new OC\Core\Command\Encryption\DecryptAll(
  106. \OC::$server->getEncryptionManager(),
  107. \OC::$server->getAppManager(),
  108. \OC::$server->getConfig(),
  109. new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()),
  110. new \Symfony\Component\Console\Helper\QuestionHelper())
  111. );
  112. $application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig()));
  113. $application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig()));
  114. $view = new \OC\Files\View();
  115. $util = new \OC\Encryption\Util(
  116. $view,
  117. \OC::$server->getUserManager(),
  118. \OC::$server->getGroupManager(),
  119. \OC::$server->getConfig()
  120. );
  121. $application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot(
  122. $view,
  123. \OC::$server->getUserManager(),
  124. \OC::$server->getConfig(),
  125. $util,
  126. new \Symfony\Component\Console\Helper\QuestionHelper()
  127. )
  128. );
  129. $application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util));
  130. $application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory()));
  131. $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader()));
  132. $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector()));
  133. $application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig()));
  134. $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess());
  135. $application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory()));
  136. $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->query(\OC\Installer::class)));
  137. $application->add(new OC\Core\Command\Maintenance\Repair(
  138. new \OC\Repair([], \OC::$server->getEventDispatcher()),
  139. \OC::$server->getConfig(),
  140. \OC::$server->getEventDispatcher(),
  141. \OC::$server->getAppManager()
  142. ));
  143. $application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  144. $application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager()));
  145. $application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager()));
  146. $application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager()));
  147. $application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager()));
  148. $application->add(new OC\Core\Command\User\Report(\OC::$server->getUserManager()));
  149. $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager()));
  150. $application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig(), \OC::$server->getDatabaseConnection()));
  151. $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  152. $application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  153. $application->add(new OC\Core\Command\Group\Add(\OC::$server->getGroupManager()));
  154. $application->add(new OC\Core\Command\Group\Delete(\OC::$server->getGroupManager()));
  155. $application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager()));
  156. $application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  157. $application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager()));
  158. $application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(null), \OC::$server->getL10N('core')));
  159. $application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager(null)));
  160. $application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager(null)));
  161. } else {
  162. $application->add(new OC\Core\Command\Maintenance\Install(\OC::$server->getSystemConfig()));
  163. }