Skip to content

Commit a364bd1

Browse files
committed
perf: also do updater optimization for deleting for object store
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 82f43ba commit a364bd1

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

lib/private/Files/ObjectStore/ObjectStoreStorage.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,12 @@ public function rmdir(string $path): bool {
153153
return false;
154154
}
155155

156-
return $this->rmObjects($entry);
156+
$result = $this->rmObjects($entry);
157+
if ($result) {
158+
$this->getUpdater()->correctParentStorageMtime($path);
159+
$this->propagator->propagateChange($path, time(), -$entry->getSize());
160+
}
161+
return $result;
157162
}
158163

159164
private function rmObjects(ICacheEntry $entry): bool {
@@ -180,15 +185,22 @@ private function rmObjects(ICacheEntry $entry): bool {
180185
public function unlink(string $path): bool {
181186
$path = $this->normalizePath($path);
182187
$entry = $this->getCache()->get($path);
188+
$result = false;
183189

184190
if ($entry instanceof ICacheEntry) {
185191
if ($entry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) {
186-
return $this->rmObjects($entry);
192+
$result = $this->rmObjects($entry);
187193
} else {
188-
return $this->rmObject($entry);
194+
$result = $this->rmObject($entry);
189195
}
190196
}
191-
return false;
197+
198+
if ($result) {
199+
$this->getUpdater()->correctParentStorageMtime($path);
200+
$this->propagator->propagateChange($path, time(), -$entry->getSize());
201+
}
202+
203+
return $result;
192204
}
193205

194206
public function rmObject(ICacheEntry $entry): bool {

lib/private/Files/ObjectStore/ObjectStoreUpdater.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ class ObjectStoreUpdater extends Updater {
1818
public function update($path, $time = null, ?int $sizeDifference = null) {
1919
// Noop
2020
}
21+
22+
public function remove($path) {
23+
// Noop
24+
}
2125
}

0 commit comments

Comments
 (0)