From 88bf1d7f5802fc37bf77277a8ee65c6fb1f34c87 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Mon, 20 Jul 2015 18:22:53 +0200 Subject: [PATCH] [ticket/13740] Clean up install config file when installation has finished PHPBB3-13740 --- phpBB/phpbb/install/helper/config.php | 23 +++++++++++++++++++++++ phpBB/phpbb/install/installer.php | 9 ++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/phpBB/phpbb/install/helper/config.php b/phpBB/phpbb/install/helper/config.php index 38fdf960f7..457b64b301 100644 --- a/phpBB/phpbb/install/helper/config.php +++ b/phpBB/phpbb/install/helper/config.php @@ -73,6 +73,13 @@ class config */ protected $navigation_data; + /** + * Flag indicating that config file should be cleaned up + * + * @var bool + */ + protected $do_clean_up; + /** * Constructor */ @@ -81,6 +88,7 @@ class config $this->filesystem = $filesystem; $this->php_ini = $php_ini; $this->phpbb_root_path = $phpbb_root_path; + $this->do_clean_up = false; // Set up data arrays $this->navigation_data = array(); @@ -228,6 +236,12 @@ class config */ public function save_config() { + if ($this->do_clean_up) + { + @unlink($this->install_config_file); + return; + } + // Create array to save $save_array = array( 'installer_config' => $this->installer_config, @@ -336,6 +350,15 @@ class config return $this->navigation_data; } + /** + * Removes install config file + */ + public function clean_up_config_file() + { + $this->do_clean_up = true; + @unlink($this->install_config_file); + } + /** * Filling up system_data array */ diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 548615cb1d..695632472a 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -219,7 +219,14 @@ class installer // Save install progress try { - $this->install_config->save_config(); + if ($install_finished) + { + $this->install_config->clean_up_config_file(); + } + else + { + $this->install_config->save_config(); + } } catch (installer_config_not_writable_exception $e) {