mirror of
https://github.com/nextcloud/server.git
synced 2026-02-27 18:37:17 +01:00
refactor(trashbin): get expiration class directly from Server::get
instead of going through Application container Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -16,7 +16,6 @@ use OC\Files\Node\NonExistingFolder;
|
||||
use OC\Files\View;
|
||||
use OC\User\NoUserException;
|
||||
use OC_User;
|
||||
use OCA\Files_Trashbin\AppInfo\Application;
|
||||
use OCA\Files_Trashbin\Command\Expire;
|
||||
use OCA\Files_Trashbin\Events\BeforeNodeRestoredEvent;
|
||||
use OCA\Files_Trashbin\Events\NodeRestoredEvent;
|
||||
@@ -857,9 +856,7 @@ class Trashbin implements IEventListener {
|
||||
*/
|
||||
private static function scheduleExpire($user) {
|
||||
// let the admin disable auto expire
|
||||
/** @var Application $application */
|
||||
$application = Server::get(Application::class);
|
||||
$expiration = $application->getContainer()->query('Expiration');
|
||||
$expiration = Server::get(Expiration::class);
|
||||
if ($expiration->isEnabled()) {
|
||||
Server::get(IBus::class)->push(new Expire($user));
|
||||
}
|
||||
@@ -875,9 +872,7 @@ class Trashbin implements IEventListener {
|
||||
* @return int|float size of deleted files
|
||||
*/
|
||||
protected static function deleteFiles(array $files, string $user, int|float $availableSpace): int|float {
|
||||
/** @var Application $application */
|
||||
$application = Server::get(Application::class);
|
||||
$expiration = $application->getContainer()->query('Expiration');
|
||||
$expiration = Server::get(Expiration::class);
|
||||
$size = 0;
|
||||
|
||||
if ($availableSpace <= 0) {
|
||||
@@ -909,7 +904,6 @@ class Trashbin implements IEventListener {
|
||||
* @return array{int|float, int} size of deleted files and number of deleted files
|
||||
*/
|
||||
public static function deleteExpiredFiles($files, $user) {
|
||||
/** @var Expiration $expiration */
|
||||
$expiration = Server::get(Expiration::class);
|
||||
$size = 0;
|
||||
$count = 0;
|
||||
|
||||
@@ -1907,8 +1907,6 @@
|
||||
<code><![CDATA[getUserFolder]]></code>
|
||||
<code><![CDATA[getUserFolder]]></code>
|
||||
<code><![CDATA[getUserFolder]]></code>
|
||||
<code><![CDATA[query]]></code>
|
||||
<code><![CDATA[query]]></code>
|
||||
</DeprecatedMethod>
|
||||
<InternalClass>
|
||||
<code><![CDATA[new View('/' . $owner)]]></code>
|
||||
|
||||
Reference in New Issue
Block a user