diff options
Diffstat (limited to 'phpBB/install/install_update.php')
-rw-r--r-- | phpBB/install/install_update.php | 60 |
1 files changed, 48 insertions, 12 deletions
diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index ab5fcc3f2b..28777a8d24 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -66,7 +66,7 @@ class install_update extends module function main($mode, $sub) { global $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language; - global $request, $phpbb_admin_path, $phpbb_adm_relative_path, $phpbb_container; + global $request, $phpbb_admin_path, $phpbb_adm_relative_path, $phpbb_container, $phpbb_config_php_file; // We must enable super globals, otherwise creating a new instance of the request class, // using the new container with a dbal connection will fail with the following PHP Notice: @@ -74,14 +74,14 @@ class install_update extends module $request->enable_super_globals(); // Create a normal container now + $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx); + $phpbb_container_builder->set_dump_container(false); + $phpbb_container_builder->set_use_extensions(false); if (file_exists($phpbb_root_path . 'install/update/new/config')) { - $phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, $phpbb_root_path . 'install/update/new/config'); - } - else - { - $phpbb_container = phpbb_create_update_container($phpbb_root_path, $phpEx, $phpbb_root_path . 'config'); + $phpbb_container_builder->set_config_path($phpbb_root_path . 'install/update/new/config'); } + $phpbb_container = $phpbb_container_builder->get_container(); // Writes into global $cache $cache = $phpbb_container->get('cache'); @@ -93,7 +93,7 @@ class install_update extends module $this->new_location = $phpbb_root_path . 'install/update/new/'; // Init DB - require($phpbb_root_path . 'config.' . $phpEx); + extract($phpbb_config_php_file->get_all()); require($phpbb_root_path . 'includes/constants.' . $phpEx); // Special options for conflicts/modified files @@ -102,7 +102,7 @@ class install_update extends module define('MERGE_NEW_FILE', 3); define('MERGE_MOD_FILE', 4); - $dbms = phpbb_convert_30_dbms_to_31($dbms); + $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms); $db = new $dbms(); @@ -396,7 +396,7 @@ class install_update extends module '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'])), + '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; @@ -422,7 +422,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; } @@ -489,7 +489,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; @@ -831,7 +831,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; } @@ -1221,6 +1221,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 = ''; @@ -1266,7 +1276,9 @@ class install_update extends module 'new_conflict' => array(), 'conflict' => array(), 'no_update' => array(), + 'deleted' => array(), 'status' => 0, + 'status_deleted'=> 0, ); } @@ -1345,7 +1357,31 @@ class install_update extends module $update_list['status']++; } + 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']++; + } + + $update_list['status_deleted'] = -1; $update_list['status'] = -1; + /* if (!sizeof($this->update_info['files'])) { return $update_list; |