Delete DownloadRankImageJob
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 9 Jun 2021 08:46:28 +0000 (10:46 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 9 Jun 2021 08:46:28 +0000 (10:46 +0200)
see 60cb68989dc3968a0a29eb71f00c16645b5f63f3

wcfsetup/install/files/lib/system/background/job/DownloadRankImageJob.class.php [deleted file]

diff --git a/wcfsetup/install/files/lib/system/background/job/DownloadRankImageJob.class.php b/wcfsetup/install/files/lib/system/background/job/DownloadRankImageJob.class.php
deleted file mode 100644 (file)
index 3145bc4..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-
-namespace wcf\system\background\job;
-
-use GuzzleHttp\Psr7\Request;
-use wcf\data\user\rank\UserRank;
-use wcf\data\user\rank\UserRankEditor;
-use wcf\system\io\HttpFactory;
-use wcf\util\Url;
-
-/**
- * Downloads the rank images and stores it locally within the rank image path.
- *
- * @author  Joshua Ruesweg
- * @copyright   2001-2021 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package WoltLabSuite\Core\System\Background\Job
- * @since   5.4
- * @deprecated  5.4 - This background job is used for the upgrade from 5.3 to 5.4 and will be removed with 5.5.
- */
-class DownloadRankImageJob extends AbstractBackgroundJob
-{
-    /**
-     * @inheritDoc
-     */
-    const MAX_FAILURES = 5;
-
-    /**
-     * @var int
-     */
-    protected $userRankID;
-
-    public function __construct(UserRank $userRank)
-    {
-        $this->userRankID = $userRank->rankID;
-    }
-
-    /**
-     * @return  int every 10 minutes
-     */
-    public function retryAfter()
-    {
-        return 10 * 60;
-    }
-
-    /**
-     * @inheritDoc
-     */
-    public function perform()
-    {
-        $rank = new UserRank($this->userRankID);
-        if (!$rank->rankID) {
-            return;
-        }
-        if (empty($rank->rankImage)) {
-            return;
-        }
-        if (!Url::is($rank->rankImage)) {
-            return;
-        }
-
-        $rankEditor = new UserRankEditor($rank);
-
-        $extension = \pathinfo(Url::parse($rank->rankImage)['path'], \PATHINFO_EXTENSION);
-        if (\in_array($extension, ['gif', 'png', 'jpg', 'jpeg', 'svg', 'webp'])) {
-            $http = HttpFactory::makeClientWithTimeout(10);
-
-            $imageDest = WCF_DIR . UserRank::RANK_IMAGE_DIR . $rank->rankID . '-rankImage.' . $extension;
-            $http->send(new Request('GET', $rank->rankImage), [
-                'sink' => $imageDest,
-            ]);
-
-            $rankEditor->update([
-                'rankImage' => \basename($imageDest),
-            ]);
-        } else {
-            $rankEditor->update([
-                'rankImage' => "",
-            ]);
-        }
-    }
-}