console.php 832 B

12345678910111213141516171819202122232425262728293031323334353637
  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. $RUNTIME_NOAPPS = true;
  9. require_once 'lib/base.php';
  10. // Don't do anything if ownCloud has not been installed yet
  11. if (!OC_Config::getValue('installed', false)) {
  12. echo "Console can only be used once ownCloud has been installed" . PHP_EOL;
  13. exit(0);
  14. }
  15. if (!OC::$CLI) {
  16. echo "This script can be run from the command line only" . PHP_EOL;
  17. exit(0);
  18. }
  19. if ($argc <= 1) {
  20. echo "Usage:" . PHP_EOL;
  21. echo " " . basename($argv[0]) . " <command>" . PHP_EOL;
  22. exit(0);
  23. }
  24. $command = $argv[1];
  25. array_shift($argv);
  26. if ($command === 'files:scan') {
  27. require_once 'apps/files/console/scan.php';
  28. } else {
  29. echo "Unknown command '$command'" . PHP_EOL;
  30. }