mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
fix: Recalculate storage statistics on updating the quota
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
b59cf4c1d4
commit
3287eddbbc
4 changed files with 12 additions and 6 deletions
|
|
@ -35,7 +35,6 @@ namespace OCA\DAV\Connector\Sabre;
|
|||
use OC\Files\Mount\MoveableMount;
|
||||
use OC\Files\View;
|
||||
use OC\Metadata\FileMetadata;
|
||||
use OC\Metadata\MetadataGroup;
|
||||
use OCA\DAV\Connector\Sabre\Exception\FileLocked;
|
||||
use OCA\DAV\Connector\Sabre\Exception\Forbidden;
|
||||
use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
|
||||
|
|
@ -57,7 +56,6 @@ use Sabre\DAV\INode;
|
|||
use OCP\Share\IManager as IShareManager;
|
||||
|
||||
class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuota, \Sabre\DAV\IMoveTarget, \Sabre\DAV\ICopyTarget {
|
||||
|
||||
/**
|
||||
* Cached directory content
|
||||
* @var \OCP\Files\FileInfo[]
|
||||
|
|
@ -116,7 +114,6 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
|
|||
// for chunked upload also updating a existing file is a "createFile"
|
||||
// because we create all the chunks before re-assemble them to the existing file.
|
||||
if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
|
||||
|
||||
// exit if we can't create a new file and we don't updatable existing file
|
||||
$chunkInfo = \OC_FileChunking::decodeName($name);
|
||||
if (!$this->fileView->isCreatable($this->path) &&
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ use OCP\User\Backend\ISetDisplayNameBackend;
|
|||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class UsersController extends AUserData {
|
||||
|
||||
/** @var IURLGenerator */
|
||||
protected $urlGenerator;
|
||||
/** @var LoggerInterface */
|
||||
|
|
@ -374,7 +373,7 @@ class UsersController extends AUserData {
|
|||
$group = $this->groupManager->get($groupid);
|
||||
// Check if group exists
|
||||
if ($group === null) {
|
||||
throw new OCSException('Subadmin group does not exist', 102);
|
||||
throw new OCSException('Subadmin group does not exist', 102);
|
||||
}
|
||||
// Check if trying to make subadmin of admin group
|
||||
if ($group->getGID() === 'admin') {
|
||||
|
|
@ -1311,7 +1310,7 @@ class UsersController extends AUserData {
|
|||
}
|
||||
// Check if group exists
|
||||
if ($group === null) {
|
||||
throw new OCSException('Group does not exist', 102);
|
||||
throw new OCSException('Group does not exist', 102);
|
||||
}
|
||||
// Check if trying to make subadmin of admin group
|
||||
if ($group->getGID() === 'admin') {
|
||||
|
|
|
|||
|
|
@ -529,6 +529,7 @@ class User implements IUser {
|
|||
$this->config->setUserValue($this->uid, 'files', 'quota', $quota);
|
||||
$this->triggerChange('quota', $quota, $oldQuota);
|
||||
}
|
||||
\OC_Helper::clearStorageInfo('/' . $this->uid . '/files');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -620,6 +620,15 @@ class OC_Helper {
|
|||
];
|
||||
}
|
||||
|
||||
public static function clearStorageInfo(string $absolutePath): void {
|
||||
/** @var ICacheFactory $cacheFactory */
|
||||
$cacheFactory = \OC::$server->get(ICacheFactory::class);
|
||||
$memcache = $cacheFactory->createLocal('storage_info');
|
||||
$cacheKey = Filesystem::normalizePath($absolutePath) . '::';
|
||||
$memcache->remove($cacheKey . 'include');
|
||||
$memcache->remove($cacheKey . 'exclude');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the config file is set manually to read-only
|
||||
* @return bool
|
||||
|
|
|
|||
Loading…
Reference in a new issue