diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-17 11:18:31 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-09-17 11:18:31 -0700 |
commit | 191ce0245d9f200f7d70bffc0499a2cece10487e (patch) | |
tree | d0ad081d70d4d0eebba364424228c1616601909c | |
parent | 2ca2e5b6f42e3c201827309535a4a5f5825f212a (diff) | |
parent | 6469763225b1f74bc5391f09446bcf280bea389e (diff) |
Merge branch 'master' into talmdal_dev
-rw-r--r-- | installer/cli.php | 5 | ||||
-rw-r--r-- | installer/installer.php | 41 | ||||
-rw-r--r-- | installer/web.php | 42 | ||||
-rw-r--r-- | modules/gallery/views/admin_languages.html.php | 2 | ||||
-rw-r--r-- | modules/server_add/controllers/admin_server_add.php | 4 | ||||
-rw-r--r-- | modules/server_add/controllers/server_add.php | 22 | ||||
-rw-r--r-- | modules/server_add/js/server_add.js | 4 | ||||
-rw-r--r-- | modules/server_add/views/server_add_tree_dialog.html.php | 1 |
8 files changed, 68 insertions, 53 deletions
diff --git a/installer/cli.php b/installer/cli.php index 50845ea4..182c3d26 100644 --- a/installer/cli.php +++ b/installer/cli.php @@ -30,6 +30,11 @@ if (installer::already_installed()) { return; } +$errors = installer::check_environment(); +if ($errors) { + oops(implode("errors", "\n")); +} + $config = parse_cli_params(); if (!installer::connect($config)) { oops("Unable to connect to the database.\n" . mysql_error() . "\n"); diff --git a/installer/installer.php b/installer/installer.php index 7a417634..70afc440 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -178,4 +178,45 @@ class installer { static function prepend_prefix($prefix, $sql) { return preg_replace("#{([a-zA-Z0-9_]+)}#", "{$prefix}$1", $sql); } + + static function check_environment() { + if (!function_exists("mysql_query") && !function_exists("mysqli_set_charset")) { + $errors[] = "Gallery 3 requires a MySQL database, but PHP doesn't have either the <a href=\"http://php.net/mysql\">MySQL</a> or the <a href=\"http://php.net/mysqli\">MySQLi</a> extension."; + } + + if (!@preg_match("/^.$/u", utf8_encode("\xF1"))) { + $errors[] = "PHP is missing <a href=\"http://php.net/pcre\">Perl-Compatible Regular Expression</a> support."; + } + + if (!(function_exists("spl_autoload_register"))) { + $errors[] = "PHP is missing <a href=\"http://php.net/spl\">Standard PHP Library (SPL)</a> support"; + } + + if (!(class_exists("ReflectionClass"))) { + $errors[] = "PHP is missing <a href=\"http://php.net/reflection\">reflection</a> support"; + } + + if (!(function_exists("filter_list"))) { + $errors[] = "PHP is missing the <a href=\"http://php.net/filter\">filter extension</a>"; + } + + if (!(extension_loaded("iconv"))) { + $errors[] = "PHP is missing the <a href=\"http://php.net/iconv\">iconv extension</a>"; + } + + if (!(extension_loaded("simplexml"))) { + $errors[] = "PHP is missing the <a href=\"http://php.net/simplexml\">SimpleXML extension</a>"; + } + + if (extension_loaded("mbstring") && (ini_get("mbstring.func_overload") & MB_OVERLOAD_STRING)) { + $errors[] = "The <a href=\"http://php.net/mbstring\">mbstring extension</a> is overloading PHP's native string functions. Please disable it."; + } + + if (!function_exists("json_encode")) { + $errors[] = "PHP is missing the <a href=\"http://php.net/manual/en/book.json.php\">JavaScript Object Notation (JSON) extension</a>. Please install it."; + } + + return @$errors; +} + } diff --git a/installer/web.php b/installer/web.php index eb0211a6..c46f072a 100644 --- a/installer/web.php +++ b/installer/web.php @@ -23,7 +23,7 @@ if (installer::already_installed()) { switch (@$_GET["step"]) { default: case "welcome": - $errors = check_environment(); + $errors = installer::check_environment(); if ($errors) { $content = render("environment_errors.html.php", array("errors" => $errors)); } else { @@ -80,43 +80,3 @@ function render($view, $args=array()) { function oops($error) { return render("oops.html.php", array("error" => $error)); } - -function check_environment() { - if (!function_exists("mysql_query") && !function_exists("mysqli_set_charset")) { - $errors[] = "Gallery 3 requires a MySQL database, but PHP doesn't have either the <a href=\"http://php.net/mysql\">MySQL</a> or the <a href=\"http://php.net/mysqli\">MySQLi</a> extension."; - } - - if (!@preg_match("/^.$/u", utf8_encode("\xF1"))) { - $errors[] = "PHP is missing <a href=\"http://php.net/pcre\">Perl-Compatible Regular Expression</a> support."; - } - - if (!(function_exists("spl_autoload_register"))) { - $errors[] = "PHP is missing <a href=\"http://php.net/spl\">Standard PHP Library (SPL)</a> support"; - } - - if (!(class_exists("ReflectionClass"))) { - $errors[] = "PHP is missing <a href=\"http://php.net/reflection\">reflection</a> support"; - } - - if (!(function_exists("filter_list"))) { - $errors[] = "PHP is missing the <a href=\"http://php.net/filter\">filter extension</a>"; - } - - if (!(extension_loaded("iconv"))) { - $errors[] = "PHP is missing the <a href=\"http://php.net/iconv\">iconv extension</a>"; - } - - if (!(extension_loaded("simplexml"))) { - $errors[] = "PHP is missing the <a href=\"http://php.net/simplexml\">SimpleXML extension</a>"; - } - - if (extension_loaded("mbstring") && (ini_get("mbstring.func_overload") & MB_OVERLOAD_STRING)) { - $errors[] = "The <a href=\"http://php.net/mbstring\">mbstring extension</a> is overloading PHP's native string functions. Please disable it."; - } - - if (!function_exists("json_encode")) { - $errors[] = "PHP is missing the <a href=\"http://php.net/manual/en/book.json.php\">JavaScript Object Notation (JSON) extension</a>. Please install it."; - } - - return @$errors; -} diff --git a/modules/gallery/views/admin_languages.html.php b/modules/gallery/views/admin_languages.html.php index ab370f88..fb30c7ba 100644 --- a/modules/gallery/views/admin_languages.html.php +++ b/modules/gallery/views/admin_languages.html.php @@ -98,6 +98,6 @@ </a> </div> -<h3>t("Sharing your translations")</h3> +<h3><?= t("Sharing your translations") ?></h3> <?= $share_translations_form ?> </div> diff --git a/modules/server_add/controllers/admin_server_add.php b/modules/server_add/controllers/admin_server_add.php index 7cd82d60..38190fee 100644 --- a/modules/server_add/controllers/admin_server_add.php +++ b/modules/server_add/controllers/admin_server_add.php @@ -36,7 +36,7 @@ class Admin_Server_Add_Controller extends Admin_Controller { if ($form->validate()) { if (is_link($form->add_path->path->value)) { $form->add_path->path->add_error("is_symlink", 1); - } else if (! is_readable($form->add_path->path->value)) { + } else if (!is_readable($form->add_path->path->value)) { $form->add_path->path->add_error("not_readable", 1); } else { $path = $form->add_path->path->value; @@ -73,7 +73,7 @@ class Admin_Server_Add_Controller extends Admin_Controller { $directories = array(); $path_prefix = $this->input->get("q"); foreach (glob("{$path_prefix}*") as $file) { - if (is_dir($file)) { + if (is_dir($file) && !is_link($file)) { $directories[] = $file; } } diff --git a/modules/server_add/controllers/server_add.php b/modules/server_add/controllers/server_add.php index 26b3bd08..9769cd6f 100644 --- a/modules/server_add/controllers/server_add.php +++ b/modules/server_add/controllers/server_add.php @@ -137,17 +137,25 @@ class Server_Add_Controller extends Admin_Controller { // form [path, parent_id] where the parent_id refers to another Server_Add_File_Model. We // have this extra level of abstraction because we don't know its Item_Model id yet. $queue = $task->get("queue"); + $paths = unserialize(module::get_var("server_add", "authorized_paths")); + while ($queue && microtime(true) - $start < 0.5) { list($file, $parent_entry_id) = array_shift($queue); - $entry = ORM::factory("server_add_file"); - $entry->task_id = $task->id; - $entry->file = $file; - $entry->parent_id = $parent_entry_id; - $entry->save(); + // Ignore the staging directories as directories to be imported. + if (empty($paths[$file])) { + $entry = ORM::factory("server_add_file"); + $entry->task_id = $task->id; + $entry->file = $file; + $entry->parent_id = $parent_entry_id; + $entry->save(); + $entry_id = $entry->id; + } else { + $entry_id = null; + } foreach (glob("$file/*") as $child) { if (is_dir($child)) { - $queue[] = array($child, $entry->id); + $queue[] = array($child, $entry_id); } else { $ext = strtolower(pathinfo($child, PATHINFO_EXTENSION)); if (in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4")) && @@ -155,7 +163,7 @@ class Server_Add_Controller extends Admin_Controller { $child_entry = ORM::factory("server_add_file"); $child_entry->task_id = $task->id; $child_entry->file = $child; - $child_entry->parent_id = $entry->id; + $child_entry->parent_id = $entry_id; $child_entry->save(); } } diff --git a/modules/server_add/js/server_add.js b/modules/server_add/js/server_add.js index 51ef41a7..4c411715 100644 --- a/modules/server_add/js/server_add.js +++ b/modules/server_add/js/server_add.js @@ -39,7 +39,7 @@ function start_add() { success: function(data, textStatus) { $("#gStatus").html(data.status); $("#gServerAdd .gProgressBar").progressbar("value", data.percent_complete); - setTimeout(function() { run_add(data.url); }, 0); + setTimeout(function() { run_add(data.url); }, 25); } }); return false; @@ -56,7 +56,7 @@ function run_add(url) { if (data.done) { $("#gServerAddProgress").slideUp(); } else { - setTimeout(function() { run_add(url); }, 0); + setTimeout(function() { run_add(url); }, 25); } } }); diff --git a/modules/server_add/views/server_add_tree_dialog.html.php b/modules/server_add/views/server_add_tree_dialog.html.php index 8eb6e4df..dd4efd06 100644 --- a/modules/server_add/views/server_add_tree_dialog.html.php +++ b/modules/server_add/views/server_add_tree_dialog.html.php @@ -50,6 +50,7 @@ }); $("#gServerCloseButton").click(function(event) { $("#gDialog").dialog("close"); + window.location.reload(); }); }); </script> |