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-08 14:22:17 +0200
commit0610937ac3ccd491b2e62133edbf76f1bb151467 (patch)
treec821d36c9e91cbc16cf58bb13321282cd67b7d97 /apps/files_external
parent789437633f4088115c7c426fbc726a7c97b66ccf (diff)
downloadnextcloud-server-0610937ac3ccd491b2e62133edbf76f1bb151467.tar.gz
nextcloud-server-0610937ac3ccd491b2e62133edbf76f1bb151467.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 952463b8015..2a32d239b4c 100755
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -495,6 +495,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
@@ -510,7 +514,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;
}
/**
@@ -543,6 +559,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;
}