From 7b736c70fa4fa6c7c05a428865f19a52b8bf8928 Mon Sep 17 00:00:00 2001 From: Kenji ITO Date: Sun, 4 Dec 2016 11:24:13 +0900 Subject: [PATCH] Fixed a bug where a compressed file containing no SQL files caused a blank screen during migration. --- .../admin/install/classes/installer.class.php | 26 ++++++++++++------- .../language/chinese_simplified_utf-8.php | 2 +- .../language/chinese_traditional_utf-8.php | 2 +- .../admin/install/language/english.php | 2 +- public_html/admin/install/language/german.php | 2 +- .../admin/install/language/hebrew_utf-8.php | 2 +- .../admin/install/language/japanese_utf-8.php | 2 +- public_html/admin/install/language/polish.php | 2 +- 8 files changed, 24 insertions(+), 16 deletions(-) diff --git a/public_html/admin/install/classes/installer.class.php b/public_html/admin/install/classes/installer.class.php index 0973a9886..e59157aa6 100644 --- a/public_html/admin/install/classes/installer.class.php +++ b/public_html/admin/install/classes/installer.class.php @@ -586,7 +586,7 @@ private function checkFileLocations() // If the script was able to locate all the system files/directories move onto the next step $args = array( - 'mode' => 'check_permissions', + 'mode' => 'check_permissions', 'dbconfig_path' => $this->env['dbconfig_path'], ); @@ -3286,20 +3286,20 @@ private function unpackFile($backupPath, $backupFile, &$display) $file = ''; $files = $archive->getList(); - foreach ($files as $file) { - if (!isset($file['folder']) || !$file['folder']) { - if (preg_match('/\.sql$/', $file['filename'])) { - $dirName = preg_replace('/\/.*$/', '', $file['filename']); - $foundSqlFile = true; - break; + if (is_array($files) && (count($files) > 0)) { + foreach ($files as $file) { + if (!isset($file['folder']) || !$file['folder']) { + if (preg_match('/\.sql$/', $file['filename'])) { + $dirName = preg_replace('/\/.*$/', '', $file['filename']); + $foundSqlFile = true; + break; + } } } } if (!$foundSqlFile) { // no .sql file found in archive - $display .= $this->getAlertMsg(sprintf($LANG_MIGRATE[40], $backupFile)); - return false; } @@ -3927,6 +3927,14 @@ private function migrateStep3() . '&site_url=' . urlencode($_REQUEST['site_url']) . '&site_admin_url=' . urlencode($_REQUEST['site_admin_url'])); } + } else { + // No SQL file found + $backLink = 'index.php?' + . http_build_query(array( + 'mode' => 'migrate', + 'language' => $this->getLanguage(), + )); + exit($this->getAlertMsg(sprintf($LANG_MIGRATE[40], $backupFile, $backLink))); } } diff --git a/public_html/admin/install/language/chinese_simplified_utf-8.php b/public_html/admin/install/language/chinese_simplified_utf-8.php index eb3bd380a..dfa70a41a 100644 --- a/public_html/admin/install/language/chinese_simplified_utf-8.php +++ b/public_html/admin/install/language/chinese_simplified_utf-8.php @@ -237,7 +237,7 @@ 37 => 'Migration Complete', 38 => 'The migration process has completed. However, the installation script found the following issues:', 39 => 'Failed to set PEAR include path. Sorry, can\'t handle compressed database backups without PEAR.', - 40 => 'The archive \'%s\' does not appear to contain any SQL files.', + 40 => 'The archive "%1$s" does not appear to contain any SQL files. To retry, click on this', 41 => 'Error extracting database backup \'%s\' from compressed backup file.', 42 => 'Backup file \'%s\' just vanished ...', 43 => 'Import aborted: The file \'%s\' does not appear to be an SQL dump.', diff --git a/public_html/admin/install/language/chinese_traditional_utf-8.php b/public_html/admin/install/language/chinese_traditional_utf-8.php index fc6b76d5f..6cc763d4c 100644 --- a/public_html/admin/install/language/chinese_traditional_utf-8.php +++ b/public_html/admin/install/language/chinese_traditional_utf-8.php @@ -237,7 +237,7 @@ 37 => 'Migration Complete', 38 => 'The migration process has completed. However, the installation script found the following issues:', 39 => 'Failed to set PEAR include path. Sorry, can\'t handle compressed database backups without PEAR.', - 40 => 'The archive \'%s\' does not appear to contain any SQL files.', + 40 => 'The archive "%1$s" does not appear to contain any SQL files. To retry, click on this', 41 => 'Error extracting database backup \'%s\' from compressed backup file.', 42 => 'Backup file \'%s\' just vanished ...', 43 => 'Import aborted: The file \'%s\' does not appear to be an SQL dump.', diff --git a/public_html/admin/install/language/english.php b/public_html/admin/install/language/english.php index 280b81c5b..011351da1 100644 --- a/public_html/admin/install/language/english.php +++ b/public_html/admin/install/language/english.php @@ -236,7 +236,7 @@ 37 => 'Migration Complete', 38 => 'The migration process has completed. However, the installation script found the following issues:', 39 => "Failed to set PEAR include path. Sorry, can't handle compressed database backups without PEAR.", - 40 => "The archive '%s' does not appear to contain any SQL files.", + 40 => 'The archive "%1$s" does not appear to contain any SQL files. To retry, click on this', 41 => "Error extracting database backup '%s' from compressed backup file.", 42 => "Backup file '%s' just vanished ...", 43 => "Import aborted: The file '%s' does not appear to be an SQL dump.", diff --git a/public_html/admin/install/language/german.php b/public_html/admin/install/language/german.php index 7b7434b96..5da7eec94 100644 --- a/public_html/admin/install/language/german.php +++ b/public_html/admin/install/language/german.php @@ -236,7 +236,7 @@ 37 => 'Migration abgeschlossen', 38 => 'Die Datenbank-Migration wurde erfolgreich abgeschlossen. Es wurden allerdings die folgenden Probleme gefunden:', 39 => 'Der Pfad für PEAR konnte nicht gesetzt werden. Ohne PEAR können leider keine komprimierten Datenbank-Backups importiert werden.', - 40 => 'Das Archiv \'%s\' scheint keine SQL-Dateien zu enthalten.', + 40 => 'Das Archiv "%1$s" scheint keine SQL-Dateien zu enthalten. Um es erneut zu versuchen, klicken Sie auf hier. ', 41 => 'Fehler beim extrahieren des Datenbank-Backups \'%s\' aus dem Archiv.', 42 => 'Backup-Datei \'%s\' nicht (mehr) auffindbar ...', 43 => 'Import abgebrochen: Die Datei \'%s\' scheint kein Datenbank-Backup zu sein.', diff --git a/public_html/admin/install/language/hebrew_utf-8.php b/public_html/admin/install/language/hebrew_utf-8.php index 9d83028bc..ccbb3b123 100644 --- a/public_html/admin/install/language/hebrew_utf-8.php +++ b/public_html/admin/install/language/hebrew_utf-8.php @@ -231,7 +231,7 @@ 37 => 'הנדידה הושלמה', 38 => 'תהליך הנדידה הושלם. עם זאת, סקריפט ההתקנה מצא את הדברים הבאים:', 39 => 'נכשלה הגדרת נתיב PEAR include. מצטערים, אין דרך לטפל בגיבויי מאגר מידע מכווצים בלי PEAR.', - 40 => 'הארכיון \'%s\' לא נראה שמכיל קבצי SQL.', + 40 => 'הארכיון "s$1%" לא נראה שהוא הכיל קבצי SQL. כדי לנסות שוב, לחץ על זה ', 41 => 'שגיאה בהוצאת גיבוי מאגר המידע \'%s\' מתוך קובץ הגיבוי המכווץ.', 42 => 'קובץ הגיבוי \'%s\' פשוט נעלם ...', 43 => 'היבוא בוטל. הקובץ \'%s\' לא נראה כמו SQL dump.', diff --git a/public_html/admin/install/language/japanese_utf-8.php b/public_html/admin/install/language/japanese_utf-8.php index 11d082538..cd2b53be2 100644 --- a/public_html/admin/install/language/japanese_utf-8.php +++ b/public_html/admin/install/language/japanese_utf-8.php @@ -238,7 +238,7 @@ 37 => '移行完了', 38 => '移行プロセスは完了しました。次の問題があるので対応してください:', 39 => 'PEARが見つかりません。残念ながらPEARがない場合はバックアップの圧縮形式を処理できません。', - 40 => '圧縮ファイル \'%s\' には、SQLファイルが含まれていません。', + 40 => '圧縮ファイル "%1$s" には、SQLファイルが含まれていません。移行をやり直すには、ここクリックしてください。', 41 => 'データベース \'%s\' におけるバックアップファイルの解凍でエラーが発生しました。', 42 => 'バックアップファイル \'%s\' が消えました...', 43 => 'インポートアボート: ファイル \'%s\'がSQLダンプで表示されません。', diff --git a/public_html/admin/install/language/polish.php b/public_html/admin/install/language/polish.php index caf42022e..1a831f59e 100644 --- a/public_html/admin/install/language/polish.php +++ b/public_html/admin/install/language/polish.php @@ -236,7 +236,7 @@ 37 => 'Migration Complete', 38 => 'The migration process has completed. However, the installation script found the following issues:', 39 => 'Failed to set PEAR include path. Sorry, can\'t handle compressed database backups without PEAR.', - 40 => 'The archive \'%s\' does not appear to contain any SQL files.', + 40 => 'The archive "%1$s" does not appear to contain any SQL files. To retry, click on this', 41 => 'Error extracting database backup \'%s\' from compressed backup file.', 42 => 'Backup file \'%s\' just vanished ...', 43 => 'Import aborted: The file \'%s\' does not appear to be an SQL dump.',