Permalink
Browse files

Fix album db caching.

Don't include a "," in the cache, instead insert it
while looping.
  • Loading branch information...
1 parent ceee906 commit 44b8c9a81ff5dff02a172ca6dcf6a8b531e4d65f @sofar committed Nov 11, 2012
Showing with 12 additions and 9 deletions.
  1. +12 −9 db.php
View
21 db.php
@@ -72,6 +72,8 @@
fclose($fp);
}
$album = readdir($ah);
+ if ($album || ($x < count($users) - 1))
+ echo ", ";
continue;
} else {
# regen cache, discard old cache
@@ -159,15 +161,7 @@
$a .= "]" . ", date: " . $albumdate . " " . "}\n";
- $album = readdir($ah);
- if ($album || ($x < count($users) - 1))
- $a .= ", ";
- else
- $a .= " ";
-
- echo $a;
-
- # write cache entry
+ # write cache entry BEFORE appending ","
if (!is_dir($cache_base . "/" . $users[$x]))
mkdir($cache_base . "/" . $users[$x]);
if (!is_dir($cd))
@@ -181,6 +175,15 @@
}
fclose($fp);
}
+
+ $album = readdir($ah);
+ if ($album || ($x < count($users) - 1))
+ $a .= ", ";
+ else
+ $a .= " ";
+
+ echo $a;
+
}
closedir($ah);
}

0 comments on commit 44b8c9a

Please sign in to comment.