refactor(trashbin): get expiration class directly from Server::get

instead of going through Application container

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
pull/55908/head
Thomas Citharel 7 months ago committed by Louis
parent 05d5fdb429
commit b44f35a42a
  1. 10
      apps/files_trashbin/lib/Trashbin.php
  2. 2
      build/psalm-baseline.xml

@ -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>

Loading…
Cancel
Save