summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/gallery_task.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-11-16 14:25:25 -0800
committerTim Almdal <tnalmdal@shaw.ca>2009-11-16 14:25:25 -0800
commitbf4c518bb56917b9960c67afe2893da4569a3938 (patch)
tree0a59d54dfed6836e3e74902b9e59a0f28296abba /modules/gallery/helpers/gallery_task.php
parent2e4d29e7dd59ebd30886285076ad8ec4f8b7adcd (diff)
Store the directory, files and translation cache in the gallery3 cache instead of trying to store it in the task. It is possible with lots of modules and lots of incoming translations to go beyond the 64K limit in the task context. Possible fix for #886.
Diffstat (limited to 'modules/gallery/helpers/gallery_task.php')
-rw-r--r--modules/gallery/helpers/gallery_task.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/modules/gallery/helpers/gallery_task.php b/modules/gallery/helpers/gallery_task.php
index 95216cf0..e0b03682 100644
--- a/modules/gallery/helpers/gallery_task.php
+++ b/modules/gallery/helpers/gallery_task.php
@@ -120,15 +120,16 @@ class gallery_task_Core {
$errors = array();
try {
$start = microtime(true);
- $dirs = $task->get("dirs");
- $files = $task->get("files");
- $cache = $task->get("cache", array());
+ $data = Cache::instance()->get("update_l10n_cache:{$task->id}");
+ if ($data) {
+ list($dirs, $files, $cache) = unserialize($data);
+ }
$i = 0;
switch ($task->get("mode", "init")) {
case "init": // 0%
$dirs = array("gallery", "modules", "themes", "installer");
- $files = array();
+ $files = $cache = array();
$task->set("mode", "find_files");
$task->status = t("Finding files");
break;
@@ -194,9 +195,12 @@ class gallery_task_Core {
$task->percent_complete = 100;
}
- $task->set("files", $files);
- $task->set("dirs", $dirs);
- $task->set("cache", $cache);
+ if ($task->percent_complete < 100) {
+ Cache::instance()->set("update_l10n_cache:{$task->id}",
+ serialize(array($dirs, $files, $cache)));
+ } else {
+ Cache::instance()->delete("update_l10n_cache:{$task->id}");
+ }
} catch (Exception $e) {
$task->done = true;
$task->state = "error";