console.php 916 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. use Symfony\Component\Console\Application;
  9. $RUNTIME_NOAPPS = true;
  10. require_once 'lib/base.php';
  11. // Don't do anything if ownCloud has not been installed yet
  12. if (!OC_Config::getValue('installed', false)) {
  13. echo "Console can only be used once ownCloud has been installed" . PHP_EOL;
  14. exit(0);
  15. }
  16. if (!OC::$CLI) {
  17. echo "This script can be run from the command line only" . PHP_EOL;
  18. exit(0);
  19. }
  20. $defaults = new OC_Defaults;
  21. $application = new Application($defaults->getName(), \OC_Util::getVersionString());
  22. require_once 'core/register_command.php';
  23. foreach(OC_App::getAllApps() as $app) {
  24. $file = OC_App::getAppPath($app).'/appinfo/register_command.php';
  25. if(file_exists($file)) {
  26. require $file;
  27. }
  28. }
  29. $application->run();