summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-09-25 20:17:52 +0200
committerVincent Petry <pvince81@owncloud.com>2014-10-09 18:18:46 +0200
commitfe652258be5248aa2c9827a317ed30361f109594 (patch)
tree799447b1e7d8d45bb043f641bc8efea72b7847ab /apps/files_external
parent24dbdd2b8edc8a9dc83c5763f7ef6e357329aed3 (diff)
downloadnextcloud-server-fe652258be5248aa2c9827a317ed30361f109594.tar.gz
nextcloud-server-fe652258be5248aa2c9827a317ed30361f109594.zip
Added filesystem hooks for mount/unmount ext storage
Diffstat (limited to 'apps/files_external')
-rwxr-xr-xapps/files_external/lib/config.php27
1 files changed, 26 insertions, 1 deletions
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index 14788c112c2..68a9e7e4106 100755
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -491,6 +491,10 @@ class OC_Mount_Config {
}
$mountPoints = self::readData($isPersonal ? OCP\User::getUser() : NULL);
+ // who else loves multi-dimensional array ?
+ $isNew = !isset($mountPoints[$mountType]) ||
+ !isset($mountPoints[$mountType][$applicable]) ||
+ !isset($mountPoints[$mountType][$applicable][$mountPoint]);
$mountPoints = self::mergeMountPoints($mountPoints, $mount, $mountType);
// Set default priority if none set
@@ -506,7 +510,19 @@ class OC_Mount_Config {
self::writeData($isPersonal ? OCP\User::getUser() : NULL, $mountPoints);
- return self::getBackendStatus($class, $classOptions, $isPersonal);
+ $result = self::getBackendStatus($class, $classOptions, $isPersonal);
+ if ($result && $isNew) {
+ \OC_Hook::emit(
+ \OC\Files\Filesystem::CLASSNAME,
+ 'add_mount_point',
+ array(
+ 'path' => $mountPoint,
+ 'type' => $mountType,
+ 'applicable' => $applicable
+ )
+ );
+ }
+ return $result;
}
/**
@@ -539,6 +555,15 @@ class OC_Mount_Config {
}
}
self::writeData($isPersonal ? OCP\User::getUser() : NULL, $mountPoints);
+ \OC_Hook::emit(
+ \OC\Files\Filesystem::CLASSNAME,
+ 'remove_mount_point',
+ array(
+ 'path' => $mountPoint,
+ 'type' => $mountType,
+ 'applicable' => $applicable
+ )
+ );
return true;
}