console.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. }