Linux anchor 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
Apache/2.4.18 (Ubuntu)
Server IP : 10.10.100.4 & Your IP : 216.73.217.150
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
www /
owncloud-prm /
apps /
files_trashbin /
lib /
Delete
Unzip
Name
Size
Permission
Date
Action
AppInfo
[ DIR ]
drwxr-xr-x
2018-04-19 18:15
BackgroundJob
[ DIR ]
drwxr-xr-x
2018-04-19 18:15
Command
[ DIR ]
drwxr-xr-x
2018-04-19 18:15
Exceptions
[ DIR ]
drwxr-xr-x
2018-04-19 18:15
Capabilities.php
1.17
KB
-rw-r--r--
2018-04-19 18:15
Expiration.php
4.63
KB
-rw-r--r--
2018-04-19 18:15
Helper.php
4.3
KB
-rw-r--r--
2018-04-19 18:15
Hooks.php
1.52
KB
-rw-r--r--
2018-04-19 18:15
Quota.php
2.68
KB
-rw-r--r--
2018-04-19 18:15
Storage.php
6.94
KB
-rw-r--r--
2018-04-19 18:15
Trashbin.php
34.19
KB
-rw-r--r--
2018-04-19 18:15
Save
Rename
<?php /** * @author Viktar Dubiniuk <dubiniuk@owncloud.com> * * @copyright Copyright (c) 2018, ownCloud GmbH * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * 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, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ namespace OCA\Files_Trashbin; use OC\Files\Filesystem; use OCP\Files\FileInfo; use OCP\IConfig; use OCP\IUserManager; use OCP\IUser; class Quota { // percent of free disk space/quota that triggers trashbin cleanup by default const DEFAULTMAXSIZE = 50; /** @var IUserManager */ protected $userManager; /** @var IConfig */ protected $config; public function __construct(IUserManager $userManager, IConfig $config){ $this->userManager = $userManager; $this->config = $config; } /** * Calculate remaining free space for trash bin * * @param integer $trashbinSize current size of the trash bin * @param string $user * @return int available free space for trash bin */ public function calculateFreeSpace($trashbinSize, $user) { $userObject = $this->userManager->get($user); if(is_null($userObject)) { return 0; } $quota = $this->getUserQuota($userObject); $userFolder = \OC::$server->getUserFolder($user); if(is_null($userFolder)) { return 0; } $free = $quota - $userFolder->getSize(); // remaining free space for user if ($free > 0) { // does trashbin size hit purge limit with the current free space $availableSpace = ($free * $this->getPurgeLimit() / 100) - $trashbinSize; } else { $availableSpace = $free - $trashbinSize; } return $availableSpace; } /** * Get a percentage of free space that should trigger * cleanup for outdated files in trashbin * * @return int */ public function getPurgeLimit(){ return $this->config->getSystemValue('trashbin_purge_limit', self::DEFAULTMAXSIZE); } /** * Get user quota or free space when there is no quota set * * @param IUser $user * @return int|mixed */ protected function getUserQuota(IUser $user) { $quota = \OC_Util::getUserQuota($user); if ($quota === FileInfo::SPACE_UNLIMITED) { $quota = Filesystem::free_space('/'); // inf or unknown free space if ($quota < 0) { $quota = PHP_INT_MAX; } } return $quota; } }