From ae707279a1945e383c312cd648d288606a79e341 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sat, 19 Oct 2013 17:43:04 +0000 Subject: remove all array_push (50% slower than []) + some changes missing for feature:2978 git-svn-id: http://piwigo.org/svn/trunk@25018 68402e56-0260-453c-a942-63ccdbb3a9ee --- install.php | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'install.php') diff --git a/install.php b/install.php index d1a6f88ea..e41498cbb 100644 --- a/install.php +++ b/install.php @@ -252,25 +252,35 @@ include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$dblayer.'.inc.php'); include(PHPWG_ROOT_PATH . 'admin/include/functions_install.inc.php'); include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php'); -if ( isset( $_POST['install'] )) +if (isset($_POST['install'])) { install_db_connect($infos, $errors); pwg_db_check_charset(); - $webmaster = trim(preg_replace( '/\s{2,}/', ' ', $admin_name )); - if ( empty($webmaster)) - array_push( $errors, l10n('enter a login for webmaster') ); - else if ( preg_match( '/[\'"]/', $webmaster ) ) - array_push( $errors, l10n('webmaster login can\'t contain characters \' or "') ); - if ( $admin_pass1 != $admin_pass2 || empty($admin_pass1) ) - array_push( $errors, l10n('please enter your password again') ); - if ( empty($admin_mail)) - array_push( $errors, l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)') ); + $webmaster = trim(preg_replace('/\s{2,}/', ' ', $admin_name)); + if (empty($webmaster)) + { + $errors[] = l10n('enter a login for webmaster'); + } + else if (preg_match( '/[\'"]/', $webmaster)) + { + $errors[] = l10n('webmaster login can\'t contain characters \' or "'); + } + if ($admin_pass1 != $admin_pass2 || empty($admin_pass1)) + { + $errors[] = l10n('please enter your password again'); + } + if (empty($admin_mail)) + { + $errors[] = l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)'); + } else { $error_mail_address = validate_mail_address(null, $admin_mail); if (!empty($error_mail_address)) - array_push( $errors, $error_mail_address ); + { + $errors[] = $error_mail_address; + } } if ( count( $errors ) == 0 ) @@ -388,13 +398,10 @@ INSERT INTO '.$prefixeTable.'config (param,value,comment) $datas = array(); foreach (get_available_upgrade_ids() as $upgrade_id) { - array_push( - $datas, - array( - 'id' => $upgrade_id, - 'applied' => CURRENT_DATE, - 'description' => 'upgrade included in installation', - ) + $datas[] = array( + 'id' => $upgrade_id, + 'applied' => CURRENT_DATE, + 'description' => 'upgrade included in installation', ); } mass_inserts( @@ -449,14 +456,11 @@ if ($step == 1) } else { - array_push( - $infos, - l10n('Congratulations, Piwigo installation is completed') - ); + $infos[] = l10n('Congratulations, Piwigo installation is completed'); if (isset($error_copy)) { - array_push($errors, $error_copy); + $errors[] = $error_copy; } else { -- cgit v1.2.3