From: Tim Düsterhus Date: Tue, 1 Sep 2020 14:46:17 +0000 (+0200) Subject: Queue DownloadStyleLogoJob during style upgrade X-Git-Tag: 5.3.0_Alpha_1~10^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=df12256a0bce3ccf2e42ad69dc1ef9619d5213fc;p=GitHub%2FWoltLab%2FWCF.git Queue DownloadStyleLogoJob during style upgrade --- diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3_style.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3_style.php index b5669d8509..32ba4420ca 100644 --- a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3_style.php +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3_style.php @@ -2,7 +2,10 @@ use wcf\data\style\StyleEditor; use wcf\data\style\StyleList; +use wcf\system\background\BackgroundQueueHandler; +use wcf\system\background\job\DownloadStyleLogoJob; use wcf\util\FileUtil; +use wcf\util\Url; /** * @author Tim Duesterhus @@ -112,8 +115,14 @@ foreach ($styleList as $style) { // 7) Copy styleLogo. // Moving is unsafe, we cannot even guarantee that the logo is a file on the local filesystem. + $queueDownload = false; foreach (['pageLogo', 'pageLogoMobile'] as $type) { if (empty($variables[$type])) continue; + if (Url::is($variables[$type])) { + $queueDownload = true; + continue; + } + $srcPath = WCF_DIR . 'images/' . $variables[$type]; if (!file_exists($srcPath)) { $srcPath = WCF_DIR . $style->imagePath . '/' . $style->getVariable($type); @@ -128,4 +137,7 @@ foreach ($styleList as $style) { $variables[$type] = basename($srcPath); } $styleEditor->setVariables($variables); + if ($queueDownload) { + BackgroundQueueHandler::getInstance()->enqueueIn(new DownloadStyleLogoJob($style), 150); + } }