Page MenuHomePhorge

No OneTemporary

Size
4 KB
Referenced Files
None
Subscribers
None
diff --git a/lib/api/folder_subscribe.php b/lib/api/folder_subscribe.php
new file mode 100644
index 0000000..d4bdff6
--- /dev/null
+++ b/lib/api/folder_subscribe.php
@@ -0,0 +1,48 @@
+<?php
+/*
+ +--------------------------------------------------------------------------+
+ | This file is part of the Kolab File API |
+ | |
+ | Copyright (C) 2012-2015, Kolab Systems AG |
+ | |
+ | This program is free software: you can redistribute it and/or modify |
+ | it under the terms of the GNU Affero General Public License as published |
+ | by the Free Software Foundation, either version 3 of the License, or |
+ | (at your option) any later version. |
+ | |
+ | This program is distributed in the hope that it will be useful, |
+ | but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ | GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public License |
+ | along with this program. If not, see <http://www.gnu.org/licenses/> |
+ +--------------------------------------------------------------------------+
+ | Author: Aleksander Machniak <machniak@kolabsys.com> |
+ +--------------------------------------------------------------------------+
+*/
+
+class file_api_folder_subscribe extends file_api_common
+{
+ /**
+ * Request handler
+ */
+ public function handle()
+ {
+ parent::handle();
+
+ if (!isset($this->args['folder']) || $this->args['folder'] === '') {
+ throw new Exception("Missing folder name", file_api_core::ERROR_CODE);
+ }
+
+ list($driver, $path) = $this->api->get_driver($this->args['folder']);
+
+ // subscribe mount point?
+ if ($driver->title() === $this->args['folder']) {
+ throw new Exception("Mount point is subscribed by default", file_api_core::ERROR_CODE);
+ }
+
+ // subscribe folder...
+ $driver->folder_subscribe($path);
+ }
+}
diff --git a/lib/api/folder_unsubscribe.php b/lib/api/folder_unsubscribe.php
new file mode 100644
index 0000000..3e647bd
--- /dev/null
+++ b/lib/api/folder_unsubscribe.php
@@ -0,0 +1,48 @@
+<?php
+/*
+ +--------------------------------------------------------------------------+
+ | This file is part of the Kolab File API |
+ | |
+ | Copyright (C) 2012-2015, Kolab Systems AG |
+ | |
+ | This program is free software: you can redistribute it and/or modify |
+ | it under the terms of the GNU Affero General Public License as published |
+ | by the Free Software Foundation, either version 3 of the License, or |
+ | (at your option) any later version. |
+ | |
+ | This program is distributed in the hope that it will be useful, |
+ | but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ | GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public License |
+ | along with this program. If not, see <http://www.gnu.org/licenses/> |
+ +--------------------------------------------------------------------------+
+ | Author: Aleksander Machniak <machniak@kolabsys.com> |
+ +--------------------------------------------------------------------------+
+*/
+
+class file_api_folder_unsubscribe extends file_api_common
+{
+ /**
+ * Request handler
+ */
+ public function handle()
+ {
+ parent::handle();
+
+ if (!isset($this->args['folder']) || $this->args['folder'] === '') {
+ throw new Exception("Missing folder name", file_api_core::ERROR_CODE);
+ }
+
+ list($driver, $path) = $this->api->get_driver($this->args['folder']);
+
+ // subscribe mount point?
+ if ($driver->title() === $this->args['folder']) {
+ throw new Exception("Mount point cannot be unsubscribed", file_api_core::ERROR_CODE);
+ }
+
+ // unsubscribe folder...
+ $driver->folder_unsubscribe($path);
+ }
+}

File Metadata

Mime Type
text/x-diff
Expires
Fri, Feb 6, 12:27 AM (7 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
428021
Default Alt Text
(4 KB)

Event Timeline