summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/sharedstorage.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/sharedstorage.php')
-rw-r--r--apps/files_sharing/sharedstorage.php38
1 files changed, 28 insertions, 10 deletions
diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php
index 3bb6e73035e..62c86ee18e4 100644
--- a/apps/files_sharing/sharedstorage.php
+++ b/apps/files_sharing/sharedstorage.php
@@ -320,6 +320,11 @@ class OC_Filestorage_Shared extends OC_Filestorage {
public function file_get_contents($path) {
$source = $this->getSource($path);
if ($source) {
+ $info = array(
+ 'target' => $this->datadir.$path,
+ 'source' => $source,
+ );
+ OCP\Util::emitHook('OC_Filestorage_Shared', 'file_get_contents', $info);
$storage = OC_Filesystem::getStorage($source);
return $storage->file_get_contents($this->getInternalPath($source));
}
@@ -329,6 +334,11 @@ class OC_Filestorage_Shared extends OC_Filestorage {
if ($this->is_writable($path)) {
$source = $this->getSource($path);
if ($source) {
+ $info = array(
+ 'target' => $this->datadir.$path,
+ 'source' => $source,
+ );
+ OCP\Util::emitHook('OC_Filestorage_Shared', 'file_put_contents', $info);
$storage = OC_Filesystem::getStorage($source);
$result = $storage->file_put_contents($this->getInternalPath($source), $data);
if ($result) {
@@ -416,6 +426,12 @@ class OC_Filestorage_Shared extends OC_Filestorage {
public function fopen($path, $mode) {
$source = $this->getSource($path);
if ($source) {
+ $info = array(
+ 'target' => $this->datadir.$path,
+ 'source' => $source,
+ 'mode' => $mode,
+ );
+ OCP\Util::emitHook('OC_Filestorage_Shared', 'fopen', $info);
$storage = OC_Filesystem::getStorage($source);
return $storage->fopen($this->getInternalPath($source), $mode);
}
@@ -508,16 +524,18 @@ class OC_Filestorage_Shared extends OC_Filestorage {
}
}
- public static function setup() {
- OC_Filesystem::mount('OC_Filestorage_Shared', array('datadir' => '/'.OCP\USER::getUser().'/files/Shared'), '/'.OCP\USER::getUser().'/files/Shared/');
+ public static function setup($options) {
+ $user_dir = $options['user_dir'];
+ OC_Filesystem::mount('OC_Filestorage_Shared', array('datadir' => $user_dir.'/Shared'), $user_dir.'/Shared/');
}
+ /**
+ * check if a file or folder has been updated since $time
+ * @param int $time
+ * @return bool
+ */
+ public function hasUpdated($path,$time){
+ //TODO
+ return $this->filemtime($path)>$time;
+ }
}
-
-if (OCP\USER::isLoggedIn()) {
- OC_Filestorage_Shared::setup();
-} else {
- OCP\Util::connectHook('OC_User', 'post_login', 'OC_Filestorage_Shared', 'setup');
-}
-
-?>