Skip to content

Commit

Permalink
Sort files by path in _dump_var() for consistent output.
Browse files Browse the repository at this point in the history
Skip . and .. (PHP 5.3 iterators seem to include those now).
  • Loading branch information
bharat committed Jun 15, 2010
1 parent d96ce71 commit 4d40cf6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/gallery/controllers/packager.php
Expand Up @@ -163,9 +163,11 @@ private function _dump_var() {

$paths = array();
foreach($objects as $name => $file){
if ($file->getBasename() == "database.php") {
$path = $file->getPath();
$basename = $file->getBasename();
if ($basename == "database.php" || $basename == "." || $basename == "..") {
continue;
} else if (basename($file->getPath()) == "logs" && $file->getBasename() != ".htaccess") {
} else if (basename($path) == "logs" && $basename != ".htaccess") {
continue;
}

Expand All @@ -186,6 +188,7 @@ private function _dump_var() {
foreach ($paths as $path) {
fwrite($fd, "!file_exists($path) && mkdir($path);\n");
}
ksort($files);
foreach ($files as $file => $contents) {
fwrite($fd, "file_put_contents($file, base64_decode(\"$contents\"));\n");
}
Expand Down

0 comments on commit 4d40cf6

Please sign in to comment.