Sets the progress information
public set_progress ( string $task_lang_key, integer $task_number ) | ||
$task_lang_key | string | Language key for the name of the task |
$task_number | integer | Position of the current task in the task queue |
/** * {@inheritdoc} */ public function run() { $this->language->add_lang('migrator'); if (!isset($this->config['version_update_from'])) { $this->config->set('version_update_from', $this->config['version']); } $original_version = $this->config['version_update_from']; $this->migrator->set_output_handler(new log_wrapper_migrator_output_handler($this->language, new installer_migrator_output_handler($this->iohandler), $this->phpbb_root_path . 'store/migrations_' . time() . '.log', $this->filesystem)); $this->migrator->create_migrations_table(); $migrations = $this->extension_manager->get_finder()->core_path('phpbb/db/migration/data/')->extension_directory('/migrations')->get_classes(); $this->migrator->set_migrations($migrations); $migration_step_count = $this->installer_config->get('database_update_migration_steps', -1); if ($migration_step_count < 0) { $migration_step_count = count($this->migrator->get_installable_migrations()) * 2; $this->installer_config->set('database_update_migration_steps', $migration_step_count); } $progress_count = $this->installer_config->get('database_update_count', 0); $restart_progress_bar = $progress_count === 0; // Only "restart" when the update runs for the first time $this->iohandler->set_task_count($migration_step_count, $restart_progress_bar); $this->installer_config->set_task_progress_count($migration_step_count); while (!$this->migrator->finished()) { try { $this->migrator->update(); $progress_count++; $last_run_migration = $this->migrator->get_last_run_migration(); if (isset($last_run_migration['effectively_installed']) && $last_run_migration['effectively_installed']) { // We skipped two step, so increment $progress_count by another one $progress_count++; } else { if ($last_run_migration['task'] === 'process_schema_step' && !$last_run_migration['state']['migration_schema_done'] || $last_run_migration['task'] === 'process_data_step' && !$last_run_migration['state']['migration_data_done']) { // We just run a step that wasn't counted yet so make it count $migration_step_count++; } } $this->iohandler->set_task_count($migration_step_count); $this->installer_config->set_task_progress_count($migration_step_count); $this->iohandler->set_progress('STAGE_UPDATE_DATABASE', $progress_count); } catch (exception $e) { $msg = $e->getParameters(); array_unshift($msg, $e->getMessage()); $this->iohandler->add_error_message($msg); throw new user_interaction_required_exception(); } if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0) { $this->installer_config->set('database_update_count', $progress_count); $this->installer_config->set('database_update_migration_steps', $migration_step_count); throw new resource_limit_reached_exception(); } } if ($original_version !== $this->config['version']) { $this->log->add('admin', isset($this->user->data['user_id']) ? $this->user->data['user_id'] : ANONYMOUS, $this->user->ip, 'LOG_UPDATE_DATABASE', false, array($original_version, $this->config['version'])); } $this->iohandler->add_success_message('INLINE_UPDATE_SUCCESSFUL'); $this->config->delete('version_update_from'); $this->cache->purge(); $this->config->increment('assets_version', 1); }
/** * {@inheritdoc} */ public function run() { if (!$this->installer_config->has_restart_point('check_update_files')) { $this->installer_config->create_progress_restart_point('check_update_files'); } $old_path = $this->update_helper->get_path_to_old_update_files(); $new_path = $this->update_helper->get_path_to_new_update_files(); $update_info = $this->installer_config->get('update_info', array()); $file_update_info = $this->installer_config->get('update_files', array()); if (empty($update_info)) { $root_path = $this->phpbb_root_path; $update_info = $this->installer_config->get('update_info_unprocessed', array()); $file_update_info = array(); $file_update_info['update_without_diff'] = array_diff($update_info['binary'], $update_info['deleted']); // Filter out files that are already deleted $file_update_info['delete'] = array_filter($update_info['deleted'], function ($filename) use($root_path) { return file_exists($root_path . $filename); }); } $progress_count = $this->installer_config->get('file_check_progress_count', 0); $task_count = count($update_info['files']); $this->iohandler->set_task_count($task_count); $this->iohandler->set_progress('UPDATE_CHECK_FILES', 0); foreach ($update_info['files'] as $key => $filename) { $old_file = $old_path . $filename; $new_file = $new_path . $filename; $file = $this->phpbb_root_path . $filename; if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0) { // Save progress $this->installer_config->set('update_info', $update_info); $this->installer_config->set('file_check_progress_count', $progress_count); $this->installer_config->set('update_files', $file_update_info); // Request refresh throw new resource_limit_reached_exception(); } $progress_count++; $this->iohandler->set_progress('UPDATE_CHECK_FILES', $progress_count); if (!$this->filesystem->exists($file)) { $file_update_info['new'][] = $filename; } else { $file_checksum = md5_file($file); if ($file_checksum === md5_file($new_file)) { // File already up to date continue; } else { if ($this->filesystem->exists($old_file) && $file_checksum === md5_file($old_file)) { // No need to diff the file $file_update_info['update_without_diff'][] = $filename; } else { $file_update_info['update_with_diff'][] = $filename; } } } unset($update_info['files'][$key]); } $this->installer_config->set('update_files', $file_update_info); $this->installer_config->set('update_info', array()); }
/** * {@inheritdoc} */ public function run() { // Recover install progress $task_name = $this->recover_progress(); $task_found = false; /** * @var string $name ID of the service * @var \phpbb\install\task_interface $task Task object */ foreach ($this->task_collection as $name => $task) { // Run until there are available resources if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) { throw new resource_limit_reached_exception(); } // Skip forward until the next task is reached if (!$task_found) { if ($name === $task_name || empty($task_name)) { $task_found = true; if ($name === $task_name) { continue; } } else { continue; } } // Send progress information if ($this->allow_progress_bar) { $this->iohandler->set_progress($task->get_task_lang_name(), $this->install_config->get_current_task_progress()); } // Check if we can run the task if (!$task->is_essential() && !$task->check_requirements()) { $this->iohandler->add_log_message(array('SKIP_TASK', $name)); $this->install_config->increment_current_task_progress($this->task_step_count[$name]); continue; } if ($this->allow_progress_bar) { // Only increment progress by one, as if a task has more than one steps // then that should be incremented in the task itself $this->install_config->increment_current_task_progress(); } $task->run(); // Log install progress $this->install_config->set_finished_task($name); // Send progress information if ($this->allow_progress_bar) { $this->iohandler->set_progress($task->get_task_lang_name(), $this->install_config->get_current_task_progress()); } $this->iohandler->send_response(); } // Module finished, so clear task progress $this->install_config->set_finished_task(''); }
/** * {@inheritdoc} */ public function run() { // Recover install progress $task_index = $this->recover_progress(); $iterator = $this->task_collection->getIterator(); if ($task_index < $iterator->count()) { $iterator->seek($task_index); } else { $this->install_config->set_finished_task(0); return; } while ($iterator->valid()) { $task = $iterator->current(); $name = $iterator->key(); // Check if we can run the task if (!$task->is_essential() && !$task->check_requirements()) { $this->iohandler->add_log_message(array('SKIP_TASK', $name)); $this->install_config->increment_current_task_progress($this->task_step_count[$name]); } else { // Send progress information if ($this->allow_progress_bar) { $this->iohandler->set_progress($task->get_task_lang_name(), $this->install_config->get_current_task_progress()); $this->iohandler->send_response(); } $task->run(); if ($this->allow_progress_bar) { // Only increment progress by one, as if a task has more than one steps // then that should be incremented in the task itself $this->install_config->increment_current_task_progress(); } } $task_index++; $this->install_config->set_finished_task($task_index); $iterator->next(); // Send progress information if ($this->allow_progress_bar) { $this->iohandler->set_progress($task->get_task_lang_name(), $this->install_config->get_current_task_progress()); } $this->iohandler->send_response(); // Stop execution if resource limit is reached if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) { throw new resource_limit_reached_exception(); } } // Module finished, so clear task progress $this->install_config->set_finished_task(0); }
/** * {@inheritdoc} */ public function run() { $this->language->add_lang('migrator'); if (!isset($this->config['version_update_from'])) { $this->config->set('version_update_from', $this->config['version']); } $original_version = $this->config['version_update_from']; $this->migrator->set_output_handler(new log_wrapper_migrator_output_handler($this->language, new installer_migrator_output_handler($this->iohandler), $this->phpbb_root_path . 'store/migrations_' . time() . '.log', $this->filesystem)); $this->migrator->create_migrations_table(); $migrations = $this->extension_manager->get_finder()->core_path('phpbb/db/migration/data/')->extension_directory('/migrations')->get_classes(); $this->migrator->set_migrations($migrations); $migration_count = count($this->migrator->get_migrations()); $this->iohandler->set_task_count($migration_count, true); $progress_count = $this->installer_config->get('database_update_count', 0); while (!$this->migrator->finished()) { try { $this->migrator->update(); $progress_count++; $this->iohandler->set_progress('STAGE_UPDATE_DATABASE', $progress_count); } catch (exception $e) { $msg = $e->getParameters(); array_unshift($msg, $e->getMessage()); $this->iohandler->add_error_message($msg); $this->iohandler->send_response(); throw new user_interaction_required_exception(); } if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0) { $this->installer_config->set('database_update_count', $progress_count); throw new resource_limit_reached_exception(); } } if ($original_version !== $this->config['version']) { $this->log->add('admin', isset($this->user->data['user_id']) ? $this->user->data['user_id'] : ANONYMOUS, $this->user->ip, 'LOG_UPDATE_DATABASE', false, array($original_version, $this->config['version'])); } $this->iohandler->finish_progress('INLINE_UPDATE_SUCCESSFUL'); $this->iohandler->add_success_message('INLINE_UPDATE_SUCCESSFUL'); $this->config->delete('version_update_from'); $this->cache->purge(); $this->config->increment('assets_version', 1); }
/** * {@inheritdoc} */ public function run() { // Include diff engine $this->update_helper->include_file('includes/diff/diff.' . $this->php_ext); $this->update_helper->include_file('includes/diff/engine.' . $this->php_ext); // Set up basic vars $old_path = $this->update_helper->get_path_to_old_update_files(); $new_path = $this->update_helper->get_path_to_new_update_files(); $files_to_diff = $this->installer_config->get('update_files', array()); $files_to_diff = $files_to_diff['update_with_diff']; // Set progress bar $this->iohandler->set_task_count(count($files_to_diff), true); $this->iohandler->set_progress('UPDATE_FILE_DIFF', 0); $progress_count = $this->installer_config->get('file_diff_update_count', 0); // Recover progress $progress_key = $this->installer_config->get('differ_progress_key', -1); $progress_recovered = $progress_key === -1; $merge_conflicts = $this->installer_config->get('merge_conflict_list', array()); foreach ($files_to_diff as $key => $filename) { if ($progress_recovered === false) { if ($progress_key === $key) { $progress_recovered = true; } continue; } // Read in files' content $file_contents = array(); // Handle the special case when user created a file with the filename that is now new in the core $file_contents[0] = file_exists($old_path . $filename) ? file_get_contents($old_path . $filename) : ''; $filenames = array($this->phpbb_root_path . $filename, $new_path . $filename); foreach ($filenames as $file_to_diff) { $file_contents[] = file_get_contents($file_to_diff); if ($file_contents[sizeof($file_contents) - 1] === false) { $this->iohandler->add_error_message(array('FILE_DIFFER_ERROR_FILE_CANNOT_BE_READ', $files_to_diff)); unset($file_contents); throw new user_interaction_required_exception(); } } $diff = new \diff3($file_contents[0], $file_contents[1], $file_contents[2]); unset($file_contents); // Handle conflicts if ($diff->get_num_conflicts() !== 0) { $merge_conflicts[] = $filename; } // Save merged output $this->cache->put('_file_' . md5($filename), base64_encode(implode("\n", $diff->merged_output()))); unset($diff); $progress_count++; $this->iohandler->set_progress('UPDATE_FILE_DIFF', $progress_count); if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0) { // Save differ progress $this->installer_config->set('differ_progress_key', $key); $this->installer_config->set('merge_conflict_list', $merge_conflicts); $this->installer_config->set('file_diff_update_count', $progress_count); // Request refresh throw new resource_limit_reached_exception(); } } $this->iohandler->finish_progress('ALL_FILES_DIFFED'); $this->installer_config->set('merge_conflict_list', $merge_conflicts); }
/** * Run phpBB installer */ public function run() { if ($this->iohandler instanceof ajax_iohandler) { $this->iohandler->acquire_lock(); } // Load install progress $this->install_config->load_config(); if (!$this->install_config->get('cache_purged_before', false) && $this->purge_cache_before) { /** @var \phpbb\cache\driver\driver_interface $cache */ $cache = $this->container_factory->get('cache.driver'); $cache->purge(); $this->install_config->set('cache_purged_before', true); } // Recover install progress $module_index = $this->recover_progress(); // Variable used to check if the install process have been finished $install_finished = false; $fail_cleanup = false; $send_refresh = false; // We are installing something, so the introduction stage can go now... $this->install_config->set_finished_navigation_stage(array('install', 0, 'introduction')); $this->iohandler->set_finished_stage_menu(array('install', 0, 'introduction')); if ($this->install_config->get_task_progress_count() === 0) { // Count all tasks in the current installer modules $step_count = 0; /** @var \phpbb\install\module_interface $module */ foreach ($this->installer_modules as $name => $module) { $module_step_count = $module->get_step_count(); $step_count += $module_step_count; $this->module_step_count[$name] = $module_step_count; } // Set task count $this->install_config->set_task_progress_count($step_count); } // Set up progress information $this->iohandler->set_task_count($this->install_config->get_task_progress_count()); try { $iterator = $this->installer_modules->getIterator(); if ($module_index < $iterator->count()) { $iterator->seek($module_index); } else { $iterator->seek($module_index - 1); $iterator->next(); } while ($iterator->valid()) { $module = $iterator->current(); $name = $iterator->key(); // Check if module should be executed if (!$module->is_essential() && !$module->check_requirements()) { $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); $this->iohandler->add_log_message(array('SKIP_MODULE', $name)); $this->install_config->increment_current_task_progress($this->module_step_count[$name]); } else { // Set the correct stage in the navigation bar $this->install_config->set_active_navigation_stage($module->get_navigation_stage_path()); $this->iohandler->set_active_stage_menu($module->get_navigation_stage_path()); $this->iohandler->send_response(); $module->run(); $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); } $module_index++; $iterator->next(); // Save progress $this->install_config->set_active_module($name, $module_index); if ($iterator->valid() && ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0)) { throw new resource_limit_reached_exception(); } } // Installation finished $install_finished = true; if ($this->iohandler instanceof cli_iohandler) { $this->iohandler->add_success_message('INSTALLER_FINISHED'); } else { global $SID; $acp_url = $this->web_root . 'adm/index.php' . $SID; $this->iohandler->add_success_message('INSTALLER_FINISHED', array('ACP_LINK', $acp_url)); } } catch (user_interaction_required_exception $e) { $this->iohandler->send_response(true); } catch (resource_limit_reached_exception $e) { $send_refresh = true; } catch (jump_to_restart_point_exception $e) { $this->install_config->jump_to_restart_point($e->get_restart_point_name()); $send_refresh = true; } catch (\Exception $e) { $this->iohandler->add_error_message($e->getMessage()); $this->iohandler->send_response(true); $fail_cleanup = true; } if ($this->iohandler instanceof ajax_iohandler) { $this->iohandler->release_lock(); } if ($install_finished) { // Send install finished message $this->iohandler->set_progress('INSTALLER_FINISHED', $this->install_config->get_task_progress_count()); $this->iohandler->send_response(true); } else { if ($send_refresh) { $this->iohandler->request_refresh(); $this->iohandler->send_response(true); } } // Save install progress try { if ($install_finished || $fail_cleanup) { $this->install_config->clean_up_config_file(); $this->cache->purge(); try { /** @var \phpbb\cache\driver\driver_interface $cache */ $cache = $this->container_factory->get('cache.driver'); $cache->purge(); } catch (cannot_build_container_exception $e) { // Do not do anything, this just means there is no config.php yet } } else { $this->install_config->save_config(); } } catch (installer_config_not_writable_exception $e) { // It is allowed to fail this test during requirements testing $progress_data = $this->install_config->get_progress_data(); if ($progress_data['last_task_module_name'] !== 'installer.module.requirements_install') { $this->iohandler->add_error_message('INSTALLER_CONFIG_NOT_WRITABLE'); } } }
/** * Run phpBB installer */ public function run() { // Load install progress $this->install_config->load_config(); // Recover install progress $module_name = $this->recover_progress(); $module_found = false; // Variable used to check if the install process have been finished $install_finished = false; $fail_cleanup = false; $send_refresh = false; // We are installing something, so the introduction stage can go now... $this->install_config->set_finished_navigation_stage(array('install', 0, 'introduction')); $this->iohandler->set_finished_stage_menu(array('install', 0, 'introduction')); if ($this->install_config->get_task_progress_count() === 0) { // Count all tasks in the current installer modules $step_count = 0; /** @var \phpbb\install\module_interface $module */ foreach ($this->installer_modules as $name => $module) { $module_step_count = $module->get_step_count(); $step_count += $module_step_count; $this->module_step_count[$name] = $module_step_count; } // Set task count $this->install_config->set_task_progress_count($step_count); } // Set up progress information $this->iohandler->set_task_count($this->install_config->get_task_progress_count()); try { foreach ($this->installer_modules as $name => $module) { // Skip forward until the current task is reached if (!$module_found) { if ($module_name === $name || empty($module_name)) { $module_found = true; } else { continue; } } // Log progress $this->install_config->set_active_module($name); // Run until there are available resources if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) { throw new resource_limit_reached_exception(); } // Check if module should be executed if (!$module->is_essential() && !$module->check_requirements()) { $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); $this->iohandler->add_log_message(array('SKIP_MODULE', $name)); $this->install_config->increment_current_task_progress($this->module_step_count[$name]); continue; } // Set the correct stage in the navigation bar $this->install_config->set_active_navigation_stage($module->get_navigation_stage_path()); $this->iohandler->set_active_stage_menu($module->get_navigation_stage_path()); $module->run(); $this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path()); $this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path()); } // Installation finished $install_finished = true; if ($this->iohandler instanceof cli_iohandler) { $this->iohandler->add_success_message('INSTALLER_FINISHED'); } else { global $SID; $acp_url = $this->web_root . 'adm/index.php' . $SID; $this->iohandler->add_success_message('INSTALLER_FINISHED', array('ACP_LINK', $acp_url)); } } catch (user_interaction_required_exception $e) { // Do nothing } catch (resource_limit_reached_exception $e) { $send_refresh = true; } catch (jump_to_restart_point_exception $e) { $this->install_config->jump_to_restart_point($e->get_restart_point_name()); $send_refresh = true; } catch (\Exception $e) { $this->iohandler->add_error_message($e->getMessage()); $this->iohandler->send_response(); $fail_cleanup = true; } if ($install_finished) { // Send install finished message $this->iohandler->set_progress('INSTALLER_FINISHED', $this->install_config->get_task_progress_count()); } else { if ($send_refresh) { $this->iohandler->request_refresh(); $this->iohandler->send_response(); } } // Save install progress try { if ($install_finished || $fail_cleanup) { $this->install_config->clean_up_config_file(); } else { $this->install_config->save_config(); } } catch (installer_config_not_writable_exception $e) { // It is allowed to fail this test during requirements testing $progress_data = $this->install_config->get_progress_data(); if ($progress_data['last_task_module_name'] !== 'installer.module.requirements_install') { $this->iohandler->add_error_message('INSTALLER_CONFIG_NOT_WRITABLE'); } } }
/** * {@inheritdoc} */ public function run() { if (!$this->installer_config->has_restart_point('check_update_files')) { $this->installer_config->create_progress_restart_point('check_update_files'); } $old_path = $this->update_helper->get_path_to_old_update_files(); $new_path = $this->update_helper->get_path_to_new_update_files(); $update_info = $this->installer_config->get('update_info', array()); $file_update_info = $this->installer_config->get('update_files', array()); if (empty($update_info)) { $root_path = $this->phpbb_root_path; $update_info = $this->installer_config->get('update_info_unprocessed', array()); $file_update_info = array(); $file_update_info['update_without_diff'] = array_diff($update_info['binary'], $update_info['deleted']); // Filter out files that are already deleted $file_update_info['delete'] = array_filter($update_info['deleted'], function ($filename) use($root_path) { return file_exists($root_path . $filename); }); } $progress_count = $this->installer_config->get('file_check_progress_count', 0); $task_count = count($update_info['files']); $this->iohandler->set_task_count($task_count); $this->iohandler->set_progress('UPDATE_CHECK_FILES', 0); // Create list of default extensions that should have been added prior // to this update $default_update_extensions = []; foreach (\phpbb\install\module\update_database\task\update_extensions::$default_extensions_update as $version => $extensions) { if ($this->update_helper->phpbb_version_compare($update_info['version']['from'], $version, '>')) { $default_update_extensions = array_merge($default_update_extensions, $extensions); } } foreach ($update_info['files'] as $key => $filename) { $old_file = $old_path . $filename; $new_file = $new_path . $filename; $file = $this->phpbb_root_path . $filename; if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0) { // Save progress $this->installer_config->set('update_info', $update_info); $this->installer_config->set('file_check_progress_count', $progress_count); $this->installer_config->set('update_files', $file_update_info); // Request refresh throw new resource_limit_reached_exception(); } $progress_count++; $this->iohandler->set_progress('UPDATE_CHECK_FILES', $progress_count); // Do not copy default extension again if the previous version was // packaged with it but it does not exist (e.g. deleted by admin) if (strpos($file, $this->phpbb_root_path . 'ext/') !== false) { $skip_file = false; foreach ($default_update_extensions as $ext_name) { if (strpos($file, $this->phpbb_root_path . 'ext/' . $ext_name) !== false && !$this->filesystem->exists($this->phpbb_root_path . 'ext/' . $ext_name . '/composer.json')) { $skip_file = true; break; } } if ($skip_file) { continue; } } if (!$this->filesystem->exists($file)) { $file_update_info['new'][] = $filename; } else { $file_checksum = md5_file($file); if ($file_checksum === md5_file($new_file)) { // File already up to date continue; } else { if ($this->filesystem->exists($old_file) && $file_checksum === md5_file($old_file)) { // No need to diff the file $file_update_info['update_without_diff'][] = $filename; } else { $file_update_info['update_with_diff'][] = $filename; } } } unset($update_info['files'][$key]); } $this->installer_config->set('update_files', $file_update_info); $this->installer_config->set('update_info', array()); }
/** * {@inheritdoc} */ public function run() { $new_path = $this->update_helper->get_path_to_new_update_files(); $file_update_info = $this->installer_config->get('update_files', array()); $update_type_progress = $this->installer_config->get('file_updater_type_progress', ''); $update_elem_progress = $this->installer_config->get('file_updater_elem_progress', ''); $type_progress_found = false; $elem_progress_found = false; // Progress bar $task_count = 0; foreach ($file_update_info as $sub_array) { $task_count += count($sub_array); } // Everything is up to date, so just continue if ($task_count === 0) { return; } $progress_count = $this->installer_config->get('file_update_progress_count', 0); $this->iohandler->set_task_count($task_count, true); $this->iohandler->set_progress('UPDATE_UPDATING_FILES', 0); $this->file_updater = $this->get_file_updater(); // File updater fallback logic try { // Update files foreach ($file_update_info as $type => $file_update_vector) { if (!$type_progress_found) { if ($type === $update_type_progress || empty($update_elem_progress)) { $type_progress_found = true; } else { continue; } } foreach ($file_update_vector as $path) { if (!$elem_progress_found) { if ($path === $update_elem_progress || empty($update_elem_progress)) { $elem_progress_found = true; } else { continue; } } switch ($type) { case 'delete': $this->file_updater->delete_file($path); break; case 'new': $this->file_updater->create_new_file($path, $new_path . $path); break; case 'update_without_diff': $this->file_updater->update_file($path, $new_path . $path); break; case 'update_with_diff': $this->file_updater->update_file($path, $this->cache->get('_file_' . md5($path)), true); break; } // Save progress $this->installer_config->set('file_updater_type_progress', $type); $this->installer_config->set('file_updater_elem_progress', $path); $progress_count++; $this->iohandler->set_progress('UPDATE_UPDATING_FILES', $progress_count); if ($this->installer_config->get_time_remaining() <= 0 || $this->installer_config->get_memory_remaining() <= 0) { // Request refresh throw new resource_limit_reached_exception(); } } } $this->iohandler->finish_progress('UPDATE_UPDATING_FILES'); } catch (runtime_exception $e) { if ($e instanceof resource_limit_reached_exception) { throw new resource_limit_reached_exception(); } $current_method = $this->installer_config->get('file_update_method', ''); // File updater failed, try to fallback to download file update mode if ($current_method !== 'compression') { $this->iohandler->add_warning_message(array('UPDATE_FILE_UPDATER_HAS_FAILED', $current_method, 'compression')); $this->installer_config->set('file_update_method', 'compression'); // We only want a simple refresh here throw new resource_limit_reached_exception(); } else { // Nowhere to fallback to :( // Due to the way the installer handles fatal errors, we need to throw a low level exception throw new runtime_exception('UPDATE_FILE_UPDATERS_HAVE_FAILED'); } } $file_updater_method = $this->installer_config->get('file_update_method', ''); if ($file_updater_method === 'compression' || $file_updater_method === 'ftp') { $this->file_updater->close(); } }