<classname>wcf\system\worker\AttachmentRebuildDataWorker</classname>
<nicevalue>100</nicevalue>
</type>
+ <type>
+ <name>com.woltlab.wcf.media</name>
+ <definitionname>com.woltlab.wcf.rebuildData</definitionname>
+ <classname>wcf\system\worker\MediaRebuildDataWorker</classname>
+ <nicevalue>105</nicevalue>
+ </type>
<type>
<name>com.woltlab.wcf.statDaily</name>
<definitionname>com.woltlab.wcf.rebuildData</definitionname>
return $result;
}
+ /**
+ * Generates thumbnails.
+ */
+ public function generateThumbnails() {
+ if (empty($this->objects)) {
+ $this->readObjects();
+ }
+
+ $saveStrategy = new DefaultUploadFileSaveStrategy(self::class);
+
+ foreach ($this->getObjects() as $mediaEditor) {
+ if ($mediaEditor->getDecoratedObject()->isImage) {
+ $saveStrategy->generateThumbnails($mediaEditor->getDecoratedObject());
+ }
+ }
+ }
+
/**
* Returns the data of the media file to be returned by AJAX requests.
*
--- /dev/null
+<?php
+namespace wcf\system\worker;
+use wcf\data\media\MediaAction;
+use wcf\data\media\MediaList;
+use wcf\system\exception\SystemException;
+
+/**
+ * Worker implementation for updating media thumbnails.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2017 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\System\Worker
+ *
+ * @method MediaList getObjectList()
+ */
+class MediaRebuildDataWorker extends AbstractRebuildDataWorker {
+ /**
+ * @inheritDoc
+ */
+ protected $objectListClassName = MediaList::class;
+
+ /**
+ * @inheritDoc
+ */
+ protected $limit = 10;
+
+ /**
+ * @inheritDoc
+ */
+ protected function initObjectList() {
+ parent::initObjectList();
+
+ $this->objectList->sqlOrderBy = 'media.mediaID';
+ $this->objectList->getConditionBuilder()->add('media.isImage = ?', [1]);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function execute() {
+ parent::execute();
+
+ foreach ($this->objectList as $media) {
+ try {
+ (new MediaAction([$media], 'generateThumbnails'))->executeAction();
+ }
+ catch (SystemException $e) {}
+ }
+ }
+}
<item name="wcf.acp.rebuildData.com.woltlab.wcf.like.user.description"><![CDATA[Aktualisiert die Liste der Like-Benutzer]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.attachment"><![CDATA[Dateianhänge aktualisieren]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.attachment.description"><![CDATA[Erzeugt Vorschaubilder neu]]></item>
+ <item name="wcf.acp.rebuildData.com.woltlab.wcf.media"><![CDATA[Medien aktualisieren]]></item>
+ <item name="wcf.acp.rebuildData.com.woltlab.wcf.media.description"><![CDATA[Erzeugt Vorschaubilder neu]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.statDaily"><![CDATA[Statistiken aktualisieren]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.statDaily.description"><![CDATA[Erzeugt die täglichen Statistiken neu]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.poll"><![CDATA[Umfragen aktualisieren]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.like.user.description"><![CDATA[Rebuilds the users using the Likes System.]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.attachment"><![CDATA[Rebuild Attachments]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.attachment.description"><![CDATA[Rebuilds the attachment preview images.]]></item>
+ <item name="wcf.acp.rebuildData.com.woltlab.wcf.media"><![CDATA[Rebuild Media]]></item>
+ <item name="wcf.acp.rebuildData.com.woltlab.wcf.media.description"><![CDATA[Rebuilds the media preview images.]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.statDaily"><![CDATA[Rebuild Statistics]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.statDaily.description"><![CDATA[Rebuilds the daily statistics.]]></item>
<item name="wcf.acp.rebuildData.com.woltlab.wcf.poll"><![CDATA[Rebuild Polls]]></item>