Delete DownloadStyleLogoJob.class.php
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 29 Oct 2020 10:17:04 +0000 (11:17 +0100)
committerGitHub <noreply@github.com>
Thu, 29 Oct 2020 10:17:04 +0000 (11:17 +0100)
This background job is required for the upgrade from 5.2 to 5.3 only.

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

diff --git a/wcfsetup/install/files/lib/system/background/job/DownloadStyleLogoJob.class.php b/wcfsetup/install/files/lib/system/background/job/DownloadStyleLogoJob.class.php
deleted file mode 100644 (file)
index b4b203c..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-namespace wcf\system\background\job;
-use GuzzleHttp\Psr7\Request;
-use wcf\data\style\Style;
-use wcf\data\style\StyleEditor;
-use wcf\system\io\HttpFactory;
-use wcf\util\Url;
-
-/**
- * Downloads the style's logo and stores it locally within the style's asset path.
- * 
- * @author     Tim Duesterhus
- * @copyright  2001-2020 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\System\Background\Job
- * @since      5.3
- * @deprecated 5.3 - This background job is used for the upgrade from 5.2 to 5.3.
- */
-class DownloadStyleLogoJob extends AbstractBackgroundJob {
-       /**
-        * @inheritDoc
-        */
-       const MAX_FAILURES = 5;
-       
-       /**
-        * @var int
-        */
-       protected $styleID;
-       
-       public function __construct(Style $style) {
-               $this->styleID = $style->styleID;
-       }
-       
-       /**
-        * @return      int     every 10 minutes
-        */
-       public function retryAfter() {
-               return 10 * 60;
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function perform() {
-               $style = new Style($this->styleID);
-               if (!$style->styleID) return;
-               $styleEditor = new StyleEditor($style);
-               
-               $style->loadVariables();
-               $variables = $style->getVariables();
-               
-               $http = HttpFactory::makeClient([
-                       'timeout' => 10,
-               ]);
-               
-               foreach (['pageLogo', 'pageLogoMobile'] as $type) {
-                       if ($variables[$type] && Url::is($variables[$type])) {
-                               $extension = pathinfo(Url::parse($variables[$type])['path'], PATHINFO_EXTENSION);
-                               
-                               if (in_array($extension, ['gif','png','jpg','jpeg','svg','webp'])) {
-                                       $newLocation = $type . '.' . $extension;
-                                       
-                                       $http->send(new Request('GET', $variables[$type]), [
-                                               'sink' => $style->getAssetPath() . $newLocation,
-                                       ]);
-                                       
-                                       $variables[$type] = $newLocation;
-                               }
-                               else {
-                                       $variables[$type] = '';
-                               }
-                               
-                               $styleEditor->setVariables($variables);
-                       }
-               }
-               StyleEditor::resetCache();
-       }
-}