summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/gallery/helpers/graphics.php13
-rw-r--r--modules/gallery/helpers/l10n_client.php3
2 files changed, 15 insertions, 1 deletions
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index 7ff09d13..cc4d2e76 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -117,7 +117,18 @@ class graphics_Core {
static function generate($item) {
if ($item->is_album()) {
if (!$cover = $item->album_cover()) {
- // This album has no cover; there's nothing to generate.
+ // This album has no cover; there's nothing to generate. Because of an old bug, it's
+ // possible that there's an album cover item id that points to an invalid item. In that
+ // case, just null out the album cover item id. It's not optimal to do that at this low
+ // level, but it's not trivial to find these cases quickly in an upgrade script and if we
+ // don't do this, the album may be permanently marked as "needs rebuilding"
+ //
+ // ref: http://sourceforge.net/apps/trac/gallery/ticket/1172
+ // http://gallery.menalto.com/node/96926
+ if ($item->album_cover_item_id) {
+ $item->album_cover_item_id = null;
+ $item->save();
+ }
return;
}
$input_file = $cover->file_path();
diff --git a/modules/gallery/helpers/l10n_client.php b/modules/gallery/helpers/l10n_client.php
index 52c13c78..43cc2036 100644
--- a/modules/gallery/helpers/l10n_client.php
+++ b/modules/gallery/helpers/l10n_client.php
@@ -194,12 +194,15 @@ class l10n_client_Core {
// @todo Batch requests (max request size)
// @todo include base_revision in submission / how to handle resubmissions / edit fights?
+ $request = new stdClass();
foreach (db::build()
->select("key", "message", "locale", "base_revision", "translation")
->from("outgoing_translations")
->execute() as $row) {
$key = $row->key;
if (!isset($request->{$key})) {
+ $request->{$key} = new stdClass();
+ $request->{$key}->translations = new stdClass();
$request->{$key}->message = json_encode(unserialize($row->message));
}
$request->{$key}->translations->{$row->locale} = json_encode(unserialize($row->translation));