From 6e6891f841dfc4131a41a83a4c41f04feaa7397d Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Fri, 23 May 2014 22:59:46 +0200 Subject: [PATCH 1/6] [ticket/12325] Automatic update should notify about outdated files PHPBB3-12325 --- phpBB/adm/style/install_update.html | 19 +++++++++++ phpBB/install/install_update.php | 50 +++++++++++++++++++++++++---- phpBB/language/en/install.php | 4 +++ 3 files changed, 66 insertions(+), 7 deletions(-) diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index f0df138641..c61f5ce1a2 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -348,6 +348,25 @@ + +

{L_FILES_DELETED}

+

{L_FILES_DELETED_EXPLAIN}

+ +
+ {L_STATUS_DELETED} + +
+
{deleted.DIR_PART}
{deleted.FILE_PART}
+
+
+ [{deleted.L_SHOW_DIFF}]{L_BINARY_FILE} +
+
+ +
+ + +
diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 87b7d8d703..e7a7a906d2 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -366,7 +366,7 @@ class install_update extends module $get_new_list = true; } - if (!$get_new_list && $update_list['status'] != -1) + if (!$get_new_list && ($update_list['status'] != -1 || $update_list['status_deleted'] != -1)) { $get_new_list = true; } @@ -377,17 +377,17 @@ class install_update extends module $cache->put('_update_list', $update_list); // Refresh the page if we are still not finished... - if ($update_list['status'] != -1) + if ($update_list['status'] != -1 || $update_list['status_deleted'] != -1) { $refresh_url = append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"); meta_refresh(2, $refresh_url); $template->assign_vars(array( 'S_IN_PROGRESS' => true, - 'S_COLLECTED' => (int) $update_list['status'], + 'S_COLLECTED' => (int) $update_list['status'] + (int) $update_list['status_deleted'], 'S_TO_COLLECT' => sizeof($this->update_info['files']), 'L_IN_PROGRESS' => $user->lang['COLLECTING_FILE_DIFFS'], - 'L_IN_PROGRESS_EXPLAIN' => sprintf($user->lang['NUMBER_OF_FILES_COLLECTED'], (int) $update_list['status'], sizeof($this->update_info['files'])), + 'L_IN_PROGRESS_EXPLAIN' => sprintf($user->lang['NUMBER_OF_FILES_COLLECTED'], (int) $update_list['status'], sizeof($this->update_info['files']) + sizeof($this->update_info['deleted'])), )); return; @@ -413,7 +413,7 @@ class install_update extends module // Now assign the list to the template foreach ($update_list as $status => $filelist) { - if ($status == 'no_update' || !sizeof($filelist) || $status == 'status') + if ($status == 'no_update' || !sizeof($filelist) || $status == 'status' || $status == 'status_deleted') { continue; } @@ -480,7 +480,7 @@ class install_update extends module $all_up_to_date = true; foreach ($update_list as $status => $filelist) { - if ($status != 'up_to_date' && $status != 'custom' && $status != 'status' && sizeof($filelist)) + if ($status != 'up_to_date' && $status != 'custom' && $status != 'status' && $status != 'status_deleted' && sizeof($filelist)) { $all_up_to_date = false; break; @@ -822,7 +822,7 @@ class install_update extends module foreach ($update_list as $status => $files) { - if ($status == 'up_to_date' || $status == 'no_update' || $status == 'status') + if ($status == 'up_to_date' || $status == 'no_update' || $status == 'status' || $status == 'status_deleted') { continue; } @@ -1212,6 +1212,16 @@ class install_update extends module $this->page_title = 'VIEWING_FILE_CONTENTS'; break; + + case 'deleted': + + $diff = $this->return_diff(array(), $phpbb_root_path . $original_file); + + $template->assign_var('S_DIFF_NEW_FILE', true); + $diff_mode = 'inline'; + $this->page_title = 'VIEWING_FILE_CONTENTS'; + + break; } $diff_mode_options = ''; @@ -1257,7 +1267,9 @@ class install_update extends module 'new_conflict' => array(), 'conflict' => array(), 'no_update' => array(), + 'deleted' => array(), 'status' => 0, + 'status_deleted'=> 0, ); } @@ -1337,6 +1349,30 @@ class install_update extends module } $update_list['status'] = -1; + + foreach ($this->update_info['deleted'] as $index => $file) + { + if (is_int($update_list['status_deleted']) && $index < $update_list['status_deleted']) + { + continue; + } + + if ($num_bytes_processed >= 500 * 1024) + { + return; + } + + if (file_exists($phpbb_root_path . $file)) + { + $update_list['deleted'][] = array('filename' => $file, 'custom' => false, 'as_expected' => false); + $num_bytes_processed += filesize($phpbb_root_path . $file); + } + + $update_list['status_deleted']++; + } + + $update_list['status_deleted'] = -1; + /* if (!sizeof($this->update_info['files'])) { return $update_list; diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index caefc1219d..65c53c0d35 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -431,6 +431,8 @@ $lang = array_merge($lang, array( 'FILE_USED' => 'Information used from', // Single file 'FILES_CONFLICT' => 'Conflict files', 'FILES_CONFLICT_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. phpBB determined that these files create conflicts if they are tried to be merged. Please investigate the conflicts and try to manually resolve them or continue the update choosing the preferred merging method. If you resolve the conflicts manually check the files again after you modified them. You are also able to choose between the preferred merge method for every file. The first one will result in a file where the conflicting lines from your old file will be lost, the other one will result in losing the changes from the newer file.', + 'FILES_DELETED' => 'Deleted files', + 'FILES_DELETED_EXPLAIN' => 'The following files do not exist in the new version. These files have to be deleted from your installation.', 'FILES_MODIFIED' => 'Modified files', 'FILES_MODIFIED_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. The updated file will be a merge between your modifications and the new file.', 'FILES_NEW' => 'New files', @@ -501,6 +503,7 @@ $lang = array_merge($lang, array( 'SELECT_DOWNLOAD_FORMAT' => 'Select download archive format', 'SELECT_FTP_SETTINGS' => 'Select FTP settings', 'SHOW_DIFF_CONFLICT' => 'Show differences/conflicts', + 'SHOW_DIFF_DELETED' => 'Show file contents', 'SHOW_DIFF_FINAL' => 'Show resulting file', 'SHOW_DIFF_MODIFIED' => 'Show merged differences', 'SHOW_DIFF_NEW' => 'Show file contents', @@ -514,6 +517,7 @@ $lang = array_merge($lang, array( 'STAGE_UPDATE_FILES' => 'Update files', 'STAGE_VERSION_CHECK' => 'Version check', 'STATUS_CONFLICT' => 'Modified file producing conflicts', + 'L_STATUS_DELETED' => 'Deleted file', 'STATUS_MODIFIED' => 'Modified file', 'STATUS_NEW' => 'New file', 'STATUS_NEW_CONFLICT' => 'Conflicting new file', From 088f5b47c3eff946bdb00a0d38a4247fef0123b4 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sat, 24 May 2014 14:06:14 +0200 Subject: [PATCH 2/6] [ticket/12325] Fix: it's not stuck in an inifinite loop anymore PHPBB3-12325 --- phpBB/install/install_update.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index e7a7a906d2..c166c33be9 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -366,7 +366,7 @@ class install_update extends module $get_new_list = true; } - if (!$get_new_list && ($update_list['status'] != -1 || $update_list['status_deleted'] != -1)) + if (!$get_new_list && $update_list['status'] != -1) { $get_new_list = true; } @@ -377,14 +377,14 @@ class install_update extends module $cache->put('_update_list', $update_list); // Refresh the page if we are still not finished... - if ($update_list['status'] != -1 || $update_list['status_deleted'] != -1) + if ($update_list['status'] != -1) { $refresh_url = append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"); meta_refresh(2, $refresh_url); $template->assign_vars(array( 'S_IN_PROGRESS' => true, - 'S_COLLECTED' => (int) $update_list['status'] + (int) $update_list['status_deleted'], + 'S_COLLECTED' => (int) $update_list['status'], 'S_TO_COLLECT' => sizeof($this->update_info['files']), 'L_IN_PROGRESS' => $user->lang['COLLECTING_FILE_DIFFS'], 'L_IN_PROGRESS_EXPLAIN' => sprintf($user->lang['NUMBER_OF_FILES_COLLECTED'], (int) $update_list['status'], sizeof($this->update_info['files']) + sizeof($this->update_info['deleted'])), @@ -1348,8 +1348,6 @@ class install_update extends module $update_list['status']++; } - $update_list['status'] = -1; - foreach ($this->update_info['deleted'] as $index => $file) { if (is_int($update_list['status_deleted']) && $index < $update_list['status_deleted']) @@ -1369,9 +1367,11 @@ class install_update extends module } $update_list['status_deleted']++; + $update_list['status']++; } $update_list['status_deleted'] = -1; + $update_list['status'] = -1; /* if (!sizeof($this->update_info['files'])) { From 2f52934fad69d86a524e34cb498427d4177f705e Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sat, 24 May 2014 14:12:11 +0200 Subject: [PATCH 3/6] [ticket/12325] Don't use L_COLON PHPBB3-12325 --- phpBB/adm/style/install_update.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index c61f5ce1a2..965a66a7d7 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -358,7 +358,7 @@
{deleted.DIR_PART}
{deleted.FILE_PART}
-
+
[{deleted.L_SHOW_DIFF}]{L_BINARY_FILE}
From 672ffbe8f6c0ba4999303c42234ede3c75498013 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sat, 24 May 2014 14:25:04 +0200 Subject: [PATCH 4/6] [ticket/12325] Fix: add a missing colon PHPBB3-12325 --- phpBB/adm/style/install_update.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index 965a66a7d7..fc056bbf1f 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -358,7 +358,7 @@
{deleted.DIR_PART}
{deleted.FILE_PART}
-
+
[{deleted.L_SHOW_DIFF}]{L_BINARY_FILE}
From 2ff3efc4a1d7c5cdf26eed28876b8e3f28b47cf5 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 26 May 2014 23:38:30 +0200 Subject: [PATCH 5/6] [ticket/12325] Update coding style in template PHPBB3-12325 --- phpBB/adm/style/install_update.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index fc056bbf1f..2faa2bb6fa 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -356,8 +356,7 @@ {L_STATUS_DELETED}
-
{deleted.DIR_PART}
{deleted.FILE_PART}
-
+
{deleted.DIR_PART}
{deleted.FILE_PART}
[{deleted.L_SHOW_DIFF}]{L_BINARY_FILE}
From 7c16d1c2abd78460c69b27a9b187e9b0e796fedc Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Fri, 30 May 2014 23:23:01 +0200 Subject: [PATCH 6/6] [ticket/12325] Fix the language var name PHPBB3-12325 --- phpBB/language/en/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 65c53c0d35..60704f2cd9 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -517,7 +517,7 @@ $lang = array_merge($lang, array( 'STAGE_UPDATE_FILES' => 'Update files', 'STAGE_VERSION_CHECK' => 'Version check', 'STATUS_CONFLICT' => 'Modified file producing conflicts', - 'L_STATUS_DELETED' => 'Deleted file', + 'STATUS_DELETED' => 'Deleted file', 'STATUS_MODIFIED' => 'Modified file', 'STATUS_NEW' => 'New file', 'STATUS_NEW_CONFLICT' => 'Conflicting new file',