{foreach from=$sitemapObjectTypes item=object}
<tr class="sitemapObjectRow jsObjectActionObject" data-object-id="{@$object->getObjectID()}">
<td class="columnIcon">
- {assign var='sitemapIsDisabled' value=false}
- {if $object->isDisabled}
- {assign var='sitemapIsDisabled' value=true}
+ {if $sitemapData[$object->objectType]['isDisabled']}
+ {objectAction action="toggle" isDisabled=true}
+ {else}
+ {objectAction action="toggle" isDisabled=false}
{/if}
- {objectAction action="toggle" isDisabled=$sitemapIsDisabled}
<a href="{link controller="SitemapEdit"}objectType={$object->objectType}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip">{icon name='pencil'}</a>
</td>
<td class="columnTitle columnSitemap"><a href="{link controller="SitemapEdit"}objectType={$object->objectType}{/link}">{lang}wcf.acp.sitemap.objectType.{$object->objectType}{/lang}</a></td>
<td class="columnInteger columnPriority">{$object->priority}</td>
- <td class="columnText columnChangeFreq">{lang}wcf.acp.sitemap.changeFreq.{$object->changeFreq}{/lang}</td>
- <td class="columnInteger columnRebuildTime">{dateInterval end=TIME_NOW+$object->rebuildTime full=true format='plain'}</td>
+ <td class="columnText columnChangeFreq">{lang}wcf.acp.sitemap.changeFreq.{$sitemapData[$object->objectType]['changeFreq']}{/lang}</td>
+ <td class="columnInteger columnRebuildTime">{dateInterval end=TIME_NOW+$sitemapData[$object->objectType]['rebuildTime'] full=true format='plain'}</td>
{event name='columns'}
</tr>
use wcf\data\object\type\ObjectType;
use wcf\data\object\type\ObjectTypeCache;
use wcf\page\AbstractPage;
+use wcf\system\registry\RegistryHandler;
use wcf\system\WCF;
use wcf\system\worker\SitemapRebuildWorker;
*/
public $sitemapObjectTypes = [];
+ /**
+ * @var mixed[]
+ */
+ private $sitemapData = [];
+
/**
* @inheritDoc
*/
$this->sitemapObjectTypes = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.sitemap.object');
foreach ($this->sitemapObjectTypes as $sitemapObjectType) {
- SitemapRebuildWorker::prepareSitemapObject($sitemapObjectType);
+ $this->sitemapData[$sitemapObjectType->objectType] = [
+ 'changeFreq' => $sitemapObjectType->changeFreq,
+ 'rebuildTime' => $sitemapObjectType->rebuildTime,
+ 'isDisabled' => 0,
+ ];
+
+ $sitemapData = RegistryHandler::getInstance()->get(
+ 'com.woltlab.wcf',
+ SitemapRebuildWorker::REGISTRY_PREFIX . $sitemapObjectType->objectType
+ );
+
+ if ($sitemapData !== null) {
+ $sitemapData = @\unserialize($sitemapData);
+
+ if (\is_array($sitemapData)) {
+ $this->sitemapData[$sitemapObjectType->objectType]['changeFreq'] = $sitemapData['changeFreq'];
+ $this->sitemapData[$sitemapObjectType->objectType]['rebuildTime'] = $sitemapData['rebuildTime'];
+ $this->sitemapData[$sitemapObjectType->objectType]['isDisabled'] = $sitemapData['isDisabled'];
+ }
+ }
}
}
WCF::getTPL()->assign([
'sitemapObjectTypes' => $this->sitemapObjectTypes,
+ 'sitemapData' => $this->sitemapData,
]);
}
}
*/
private $actualUser;
+ /**
+ * @var mixed[]
+ */
+ private $sitemapData = [];
+
/**
* @inheritDoc
*/
// read sitemaps
$sitemapObjects = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.sitemap.object');
foreach ($sitemapObjects as $sitemapObject) {
- self::prepareSitemapObject($sitemapObject);
+ $this->prepareSitemapObject($sitemapObject);
$processor = $sitemapObject->getProcessor();
if (
$processor->isAvailableType()
- && ($sitemapObject->isDisabled === null || !$sitemapObject->isDisabled)
+ && !$this->sitemapData[$sitemapObject->objectType]['isDisabled']
) {
$this->sitemapObjects[] = $sitemapObject;
$object->{$sitemapObject->getLastModifiedColumn()}
);
+ $objectType = $this->sitemapObjects[$this->workerData['sitemap']];
if ($sitemapObject->canView($object)) {
$this->file->write(WCF::getTPL()->fetch('sitemapEntry', 'wcf', [
// strip session links
'link' => MessageUtil::stripCrap($link),
'lastModifiedTime' => $lastModifiedTime,
- 'priority' => $this->sitemapObjects[$this->workerData['sitemap']]->priority,
- 'changeFreq' => $this->sitemapObjects[$this->workerData['sitemap']]->changeFreq,
+ 'priority' => $objectType->priority,
+ 'changeFreq' => $this->sitemapData[$objectType->objectType]['changeFreq'],
]));
$this->workerData['dataCount']++;
while (
$object
&& \file_exists(self::getSitemapPath() . $object->objectType . '.xml')
- && \filectime(self::getSitemapPath() . $object->objectType . '.xml') > TIME_NOW - (($object->rebuildTime !== null) ? $object->rebuildTime : 60 * 60 * 24 * 7)
+ && \filectime(self::getSitemapPath() . $object->objectType . '.xml') > TIME_NOW - ($this->sitemapData[$object->objectType]['rebuildTime'] ?: 60 * 60 * 24 * 7)
) {
$filenames = \array_merge(
\glob(self::getSitemapPath() . $object->objectType . '_*'),
}
/**
- * Reads the columns changed by the user for this sitemap object from the registry and
- * modifies the object accordingly.
+ * Reads the columns changed by the user for this sitemap object from the registry.
*
* @param ObjectType $object
* @since 5.3
*/
- public static function prepareSitemapObject(ObjectType $object)
+ private function prepareSitemapObject(ObjectType $object): void
{
+ $this->sitemapData[$object->objectType] = [
+ 'changeFreq' => $object->changeFreq,
+ 'rebuildTime' => $object->rebuildTime,
+ 'isDisabled' => 0,
+ ];
+
$sitemapData = RegistryHandler::getInstance()->get(
'com.woltlab.wcf',
self::REGISTRY_PREFIX . $object->objectType
$sitemapData = @\unserialize($sitemapData);
if (\is_array($sitemapData)) {
- $object->changeFreq = $sitemapData['changeFreq'];
- $object->rebuildTime = $sitemapData['rebuildTime'];
- $object->isDisabled = $sitemapData['isDisabled'];
+ $this->sitemapData[$object->objectType]['changeFreq'] = $sitemapData['changeFreq'];
+ $this->sitemapData[$object->objectType]['rebuildTime'] = $sitemapData['rebuildTime'];
+ $this->sitemapData[$object->objectType]['isDisabled'] = $sitemapData['isDisabled'];
}
}
}