MCPcopy Create free account
hub / github.com/error311/FileRise / delete

Method delete

src/FileRise/WebDAV/FileRiseFile.php:53–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51 }
52
53 public function delete(): void
54 {
55 [$folderKey, $fileName] = $this->split();
56
57 if (FolderCrypto::isEncryptedOrAncestor($folderKey)) {
58 throw new Forbidden('WebDAV is disabled inside encrypted folders');
59 }
60
61 if (!$this->isAdmin && !ACL::canDelete($this->user, $this->perms, $folderKey)) {
62 throw new Forbidden('No delete permission in this folder');
63 }
64 if (!$this->canTouchOwnership($folderKey, $fileName)) {
65 throw new Forbidden('You do not own this file');
66 }
67 $result = FileModel::deleteFiles($folderKey, [$fileName]);
68 if (is_array($result) && isset($result['success'])) {
69 \AuditHook::log('file.delete', [
70 'user' => $this->user,
71 'source' => 'webdav',
72 'folder' => $folderKey,
73 'path' => ($folderKey === 'root') ? $fileName : ($folderKey . '/' . $fileName),
74 ]);
75 }
76 }
77
78 public function setName($newName): void
79 {

Callers 15

fetchFolderStatsFunction · 0.45
fetchFolderSummaryStatsFunction · 0.45
clearFolderSummaryCacheFunction · 0.45
fileListView.jsFile · 0.45
fetchFolderCapsFunction · 0.45
clearPeekCacheFunction · 0.45
getFolderCapabilitiesFunction · 0.45
fetchFolderCountsFunction · 0.45
invalidateFolderCachesFunction · 0.45
clearAuthFileLinkFromUrlFunction · 0.45
toStableBodyFunction · 0.45
main.jsFile · 0.45

Calls 6

splitMethod · 0.95
canTouchOwnershipMethod · 0.95
isEncryptedOrAncestorMethod · 0.80
canDeleteMethod · 0.80
logMethod · 0.80
deleteFilesMethod · 0.45

Tested by

no test coverage detected