Browse Source
Add propfind properties to trashbin
Add propfind properties to trashbin
* get original filename (without the weird timestamp) * get original location Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>pull/9202/head
No known key found for this signature in database
GPG Key ID: F941078878347C0C
9 changed files with 131 additions and 10 deletions
-
3apps/files_trashbin/appinfo/info.xml
-
1apps/files_trashbin/composer/composer/autoload_classmap.php
-
1apps/files_trashbin/composer/composer/autoload_static.php
-
4apps/files_trashbin/lib/Sabre/ITrash.php
-
63apps/files_trashbin/lib/Sabre/PropfindPlugin.php
-
9apps/files_trashbin/lib/Sabre/TrashFile.php
-
16apps/files_trashbin/lib/Sabre/TrashFolder.php
-
18apps/files_trashbin/lib/Sabre/TrashFolderFile.php
-
26apps/files_trashbin/lib/Sabre/TrashFolderFolder.php
@ -0,0 +1,63 @@ |
|||
<?php |
|||
/** |
|||
* @copyright 2018, Roeland Jago Douma <roeland@famdouma.nl> |
|||
* |
|||
* @author Roeland Jago Douma <roeland@famdouma.nl> |
|||
* |
|||
* @license GNU AGPL version 3 or any later version |
|||
* |
|||
* 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/>. |
|||
* |
|||
*/ |
|||
|
|||
namespace OCA\Files_Trashbin\Sabre; |
|||
|
|||
use Sabre\DAV\INode; |
|||
use Sabre\DAV\PropFind; |
|||
use Sabre\DAV\Server; |
|||
use Sabre\DAV\ServerPlugin; |
|||
|
|||
class PropfindPlugin extends ServerPlugin { |
|||
|
|||
const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename'; |
|||
const TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location'; |
|||
|
|||
/** @var Server */ |
|||
private $server; |
|||
|
|||
public function __construct() { |
|||
} |
|||
|
|||
public function initialize(Server $server) { |
|||
$this->server = $server; |
|||
|
|||
$this->server->on('propFind', [$this, 'propFind']); |
|||
} |
|||
|
|||
|
|||
public function propFind(PropFind $propFind, INode $node) { |
|||
if (!($node instanceof ITrash)) { |
|||
return; |
|||
} |
|||
|
|||
$propFind->handle(self::TRASHBIN_FILENAME, function() use ($node) { |
|||
return $node->getFilename(); |
|||
}); |
|||
|
|||
$propFind->handle(self::TRASHBIN_ORIGINAL_LOCATION, function() use ($node) { |
|||
return $node->getOriginalLocation(); |
|||
}); |
|||
} |
|||
|
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue