]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add a CLI script for manually triggering checking a folder for updates
authorRobin Appelman <icewind@owncloud.com>
Sun, 23 Jun 2013 15:49:38 +0000 (17:49 +0200)
committerRobin Appelman <icewind@owncloud.com>
Sun, 23 Jun 2013 15:49:38 +0000 (17:49 +0200)
apps/files/triggerupdate.php [new file with mode: 0644]

diff --git a/apps/files/triggerupdate.php b/apps/files/triggerupdate.php
new file mode 100644 (file)
index 0000000..0e29edb
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+require_once __DIR__ . '/../../lib/base.php';
+
+if (OC::$CLI) {
+       if (count($argv) === 2) {
+               $file = $argv[1];
+               list(, $user) = explode('/', $file);
+               OC_Util::setupFS($user);
+               $view = new \OC\Files\View('');
+               /**
+                * @var \OC\Files\Storage\Storage $storage
+                */
+               list($storage, $internalPath) = $view->resolvePath($file);
+               $watcher = $storage->getWatcher($internalPath);
+               $watcher->checkUpdate($internalPath);
+       } else {
+               echo "Usage: php triggerupdate.php /path/to/file\n";
+       }
+} else {
+       echo "This script can be run from the command line only\n";
+}