diff options
author | Bharat Mediratta <bharat@menalto.com> | 2011-01-09 22:34:44 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2011-01-09 22:36:20 -0800 |
commit | 65ff2470a505fbc18211093ac131c29b1e820c3e (patch) | |
tree | 3bd42092beae2e0f1c67e696b557e9658aad7cf8 /modules/server_add/controllers/server_add.php | |
parent | 65448548637f462ad17c12b149cdb2a169d07026 (diff) |
Use eeldivad's fallback code from http://gallery.menalto.com/node/96806#comment-358404
instead of relying solely on preg_quote. Fixes #1460.
Diffstat (limited to 'modules/server_add/controllers/server_add.php')
-rw-r--r-- | modules/server_add/controllers/server_add.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/server_add/controllers/server_add.php b/modules/server_add/controllers/server_add.php index 15b92cc0..05543a68 100644 --- a/modules/server_add/controllers/server_add.php +++ b/modules/server_add/controllers/server_add.php @@ -167,8 +167,11 @@ class Server_Add_Controller extends Admin_Controller { $entry->delete(); } - $path = preg_replace("/(\*|\?|\[)/", "[$1]", $entry->path); - foreach (glob("$path/*") as $child_path) { + $child_paths = glob(preg_quote($entry->path) . "/*"); + if (!$child_paths) { + $child_paths = glob("$path/*"); + } + foreach ($child_paths as $child_path) { if (!is_dir($child_path)) { $ext = strtolower(pathinfo($child_path, PATHINFO_EXTENSION)); if (!in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v")) || @@ -189,8 +192,8 @@ class Server_Add_Controller extends Admin_Controller { // We've processed this entry, mark it as done. $entry->checked = 1; $entry->save(); + $dirs_scanned++; } - $dirs_scanned++; } // We have no idea how long this can take because we have no idea how deep the tree |