From 2a03d530535f99969daa0894057bb8cadcf96c30 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Fri, 6 Oct 2017 15:12:31 +0200 Subject: [PATCH] Fix closing files in sitemap rebuild worker --- .../files/lib/system/worker/SitemapRebuildWorker.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/worker/SitemapRebuildWorker.class.php b/wcfsetup/install/files/lib/system/worker/SitemapRebuildWorker.class.php index 7544c9d594..96d1af4385 100755 --- a/wcfsetup/install/files/lib/system/worker/SitemapRebuildWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/SitemapRebuildWorker.class.php @@ -182,6 +182,7 @@ class SitemapRebuildWorker extends AbstractWorker { $this->workerData['dataCount'] = 0; } + $closeFile = true; // finish sitemap if (count($objectList) < $this->limit) { if ($this->workerData['dataCount'] > 0) { @@ -196,12 +197,13 @@ class SitemapRebuildWorker extends AbstractWorker { if (count($this->sitemapObjects) <= $this->workerData['sitemap']) { $this->writeIndexFile(); + $closeFile = false; } } $this->workerData['sitemapLoopCount']++; $this->storeWorkerData(); - $this->closeFile(); + if ($closeFile) $this->closeFile(); } finally { // change session owner back to the actual user @@ -254,6 +256,8 @@ class SitemapRebuildWorker extends AbstractWorker { $this->workerData['finished'] = true; + $this->closeFile(); + if ($this->workerData['tmpFile'] && file_exists($this->workerData['tmpFile'])) { unlink($this->workerData['tmpFile']); } -- 2.20.1