You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

console.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. $self = basename($argv[0]);
  20. if ($argc <= 1) {
  21. $argv[1] = "help";
  22. }
  23. $command = $argv[1];
  24. array_shift($argv);
  25. switch ($command) {
  26. case 'files:scan':
  27. require_once 'apps/files/console/scan.php';
  28. break;
  29. case 'status':
  30. require_once 'status.php';
  31. break;
  32. case 'help':
  33. echo "Usage:" . PHP_EOL;
  34. echo " " . $self . " <command>" . PHP_EOL;
  35. echo PHP_EOL;
  36. echo "Available commands:" . PHP_EOL;
  37. echo " files:scan -> rescan filesystem" .PHP_EOL;
  38. echo " status -> show some status information" .PHP_EOL;
  39. echo " help -> show this help screen" .PHP_EOL;
  40. break;
  41. default:
  42. echo "Unknown command '$command'" . PHP_EOL;
  43. echo "For available commands type ". $self . " help" . PHP_EOL;
  44. break;
  45. }