implement delete hooks in file versions lib
This commit is contained in:
parent
90fac1f371
commit
238e4bc3eb
|
@ -156,6 +156,7 @@ class Storage {
|
||||||
}
|
}
|
||||||
foreach ($versions as $v) {
|
foreach ($versions as $v) {
|
||||||
unlink($abs_path . $v['version']);
|
unlink($abs_path . $v['version']);
|
||||||
|
\OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $abs_path . $v['version']));
|
||||||
$versionsSize -= $v['size'];
|
$versionsSize -= $v['size'];
|
||||||
}
|
}
|
||||||
self::setVersionsSize($uid, $versionsSize);
|
self::setVersionsSize($uid, $versionsSize);
|
||||||
|
@ -465,6 +466,7 @@ class Storage {
|
||||||
while ($availableSpace < 0 && $i < $numOfVersions) {
|
while ($availableSpace < 0 && $i < $numOfVersions) {
|
||||||
$version = current($allVersions);
|
$version = current($allVersions);
|
||||||
$versionsFileview->unlink($version['path'].'.v'.$version['version']);
|
$versionsFileview->unlink($version['path'].'.v'.$version['version']);
|
||||||
|
\OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $version['path'].'.v'.$version['version']));
|
||||||
$versionsSize -= $version['size'];
|
$versionsSize -= $version['size'];
|
||||||
$availableSpace += $version['size'];
|
$availableSpace += $version['size'];
|
||||||
next($allVersions);
|
next($allVersions);
|
||||||
|
@ -515,6 +517,7 @@ class Storage {
|
||||||
if ($version['version'] > $nextVersion) {
|
if ($version['version'] > $nextVersion) {
|
||||||
//distance between two version too small, delete version
|
//distance between two version too small, delete version
|
||||||
$versionsFileview->unlink($version['path'] . '.v' . $version['version']);
|
$versionsFileview->unlink($version['path'] . '.v' . $version['version']);
|
||||||
|
\OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $version['path'] . '.v' . $version['version']));
|
||||||
$size += $version['size'];
|
$size += $version['size'];
|
||||||
unset($allVersions[$key]); // update array with all versions
|
unset($allVersions[$key]); // update array with all versions
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue