diff options
Diffstat (limited to 'phpBB/includes/db')
-rw-r--r-- | phpBB/includes/db/migration.php | 6 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_1.php (renamed from phpBB/includes/db/migration/3_0_1.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_10.php (renamed from phpBB/includes/db/migration/3_0_10.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_10_rc1.php (renamed from phpBB/includes/db/migration/3_0_10_rc1.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_10_rc2.php (renamed from phpBB/includes/db/migration/3_0_10_rc2.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_10_rc3.php (renamed from phpBB/includes/db/migration/3_0_10_rc3.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_11.php (renamed from phpBB/includes/db/migration/3_0_11.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_11_rc1.php (renamed from phpBB/includes/db/migration/3_0_11_rc1.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_11_rc2 (renamed from phpBB/includes/db/migration/3_0_11_rc2) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_12_rc1.php (renamed from phpBB/includes/db/migration/3_0_12_rc1.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_1_rc1.php (renamed from phpBB/includes/db/migration/3_0_1_rc1.php) | 2 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_2.php (renamed from phpBB/includes/db/migration/3_0_2.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_2_rc1.php (renamed from phpBB/includes/db/migration/3_0_2_rc1.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_2_rc2.php (renamed from phpBB/includes/db/migration/3_0_2_rc2.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_3.php (renamed from phpBB/includes/db/migration/3_0_3.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_3_rc1.php (renamed from phpBB/includes/db/migration/3_0_3_rc1.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_4.php (renamed from phpBB/includes/db/migration/3_0_4.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_4_rc1.php (renamed from phpBB/includes/db/migration/3_0_4_rc1.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_5.php (renamed from phpBB/includes/db/migration/3_0_5.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_5_rc1.php (renamed from phpBB/includes/db/migration/3_0_5_rc1.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_5_rc1part2.php (renamed from phpBB/includes/db/migration/3_0_5_rc1part2.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_6.php (renamed from phpBB/includes/db/migration/3_0_6.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_6_rc1.php (renamed from phpBB/includes/db/migration/3_0_6_rc1.php) | 101 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_6_rc2.php (renamed from phpBB/includes/db/migration/3_0_6_rc2.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_6_rc3.php (renamed from phpBB/includes/db/migration/3_0_6_rc3.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_6_rc4.php (renamed from phpBB/includes/db/migration/3_0_6_rc4.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_7.php (renamed from phpBB/includes/db/migration/3_0_7.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_7_pl1.php (renamed from phpBB/includes/db/migration/3_0_7_pl1.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_7_rc1.php (renamed from phpBB/includes/db/migration/3_0_7_rc1.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_7_rc2.php (renamed from phpBB/includes/db/migration/3_0_7_rc2.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_8.php (renamed from phpBB/includes/db/migration/3_0_8.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_8_rc1.php (renamed from phpBB/includes/db/migration/3_0_8_rc1.php) | 16 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_9.php (renamed from phpBB/includes/db/migration/3_0_9.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_9_rc1.php (renamed from phpBB/includes/db/migration/3_0_9_rc1.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_9_rc2.php (renamed from phpBB/includes/db/migration/3_0_9_rc2.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_9_rc3.php (renamed from phpBB/includes/db/migration/3_0_9_rc3.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/data/3_0_9_rc4.php (renamed from phpBB/includes/db/migration/3_0_9_rc4.php) | 4 | ||||
-rw-r--r-- | phpBB/includes/db/migration/tools/base.php | 47 | ||||
-rw-r--r-- | phpBB/includes/db/migration/tools/config.php | 106 | ||||
-rw-r--r-- | phpBB/includes/db/migration/tools/module.php | 419 | ||||
-rw-r--r-- | phpBB/includes/db/migration/tools/permission.php | 480 | ||||
-rw-r--r-- | phpBB/includes/db/migration/tools/umil.php (renamed from phpBB/includes/db/migrationtools/umil.php) | 0 | ||||
-rw-r--r-- | phpBB/includes/db/migrationtools/base.php | 15 | ||||
-rw-r--r-- | phpBB/includes/db/migrationtools/config.php | 121 | ||||
-rw-r--r-- | phpBB/includes/db/migrator.php | 14 |
45 files changed, 1179 insertions, 280 deletions
diff --git a/phpBB/includes/db/migration.php b/phpBB/includes/db/migration.php index de9f6d07e3..c98ac8728a 100644 --- a/phpBB/includes/db/migration.php +++ b/phpBB/includes/db/migration.php @@ -44,10 +44,10 @@ class phpbb_db_migration * @param string $phpbb_root_path * @param string $php_ext */ - function phpbb_db_migration(&$db, &$db_tools, $table_prefix, $phpbb_root_path, $php_ext) + function phpbb_db_migration($db, $db_tools, $table_prefix, $phpbb_root_path, $php_ext) { - $this->db = &$db; - $this->db_tools = &$db_tools; + $this->db = $db; + $this->db_tools = $db_tools; $this->table_prefix = $table_prefix; $this->phpbb_root_path = $phpbb_root_path; diff --git a/phpBB/includes/db/migration/3_0_1.php b/phpBB/includes/db/migration/data/3_0_1.php index 1cb069a2b1..294db3d946 100644 --- a/phpBB/includes/db/migration/3_0_1.php +++ b/phpBB/includes/db/migration/data/3_0_1.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_1 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_1 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_1_rc1'); + return array('phpbb_db_migration_data_3_0_1_rc1'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_10.php b/phpBB/includes/db/migration/data/3_0_10.php index aae27a08c7..6d39969d48 100644 --- a/phpBB/includes/db/migration/3_0_10.php +++ b/phpBB/includes/db/migration/data/3_0_10.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_10 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_10 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_10_rc3'); + return array('phpbb_db_migration_data_3_0_10_rc3'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_10_rc1.php b/phpBB/includes/db/migration/data/3_0_10_rc1.php index 5d65ae15da..06105c5b0d 100644 --- a/phpBB/includes/db/migration/3_0_10_rc1.php +++ b/phpBB/includes/db/migration/data/3_0_10_rc1.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_10_rc1 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_10_rc1 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_9'); + return array('phpbb_db_migration_data_3_0_9'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_10_rc2.php b/phpBB/includes/db/migration/data/3_0_10_rc2.php index d5dc4caec9..04161caf28 100644 --- a/phpBB/includes/db/migration/3_0_10_rc2.php +++ b/phpBB/includes/db/migration/data/3_0_10_rc2.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_10_rc2 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_10_rc2 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_10_rc1'); + return array('phpbb_db_migration_data_3_0_10_rc1'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_10_rc3.php b/phpBB/includes/db/migration/data/3_0_10_rc3.php index dc962b73c8..539f0b8fec 100644 --- a/phpBB/includes/db/migration/3_0_10_rc3.php +++ b/phpBB/includes/db/migration/data/3_0_10_rc3.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_10_rc3 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_10_rc3 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_10_rc2'); + return array('phpbb_db_migration_data_3_0_10_rc2'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_11.php b/phpBB/includes/db/migration/data/3_0_11.php index 89ffe310f4..3404272ef9 100644 --- a/phpBB/includes/db/migration/3_0_11.php +++ b/phpBB/includes/db/migration/data/3_0_11.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_11 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_11 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_11_rc2'); + return array('phpbb_db_migration_data_3_0_11_rc2'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_11_rc1.php b/phpBB/includes/db/migration/data/3_0_11_rc1.php index 1b74aa9a4c..f44226df02 100644 --- a/phpBB/includes/db/migration/3_0_11_rc1.php +++ b/phpBB/includes/db/migration/data/3_0_11_rc1.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_11_rc1 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_11_rc1 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_10'); + return array('phpbb_db_migration_data_3_0_10'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_11_rc2 b/phpBB/includes/db/migration/data/3_0_11_rc2 index f4e64871ed..6add980c73 100644 --- a/phpBB/includes/db/migration/3_0_11_rc2 +++ b/phpBB/includes/db/migration/data/3_0_11_rc2 @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_11_rc2 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_11_rc2 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_11_rc1'); + return array('phpbb_db_migration_data_3_0_11_rc1'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_12_rc1.php b/phpBB/includes/db/migration/data/3_0_12_rc1.php index 58e112a43a..734a57ecee 100644 --- a/phpBB/includes/db/migration/3_0_12_rc1.php +++ b/phpBB/includes/db/migration/data/3_0_12_rc1.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_12_rc1 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_12_rc1 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_11'); + return array('phpbb_db_migration_data_3_0_11'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_1_rc1.php b/phpBB/includes/db/migration/data/3_0_1_rc1.php index e3be8b36d4..1a696e0003 100644 --- a/phpBB/includes/db/migration/3_0_1_rc1.php +++ b/phpBB/includes/db/migration/data/3_0_1_rc1.php @@ -7,7 +7,7 @@ * */ -class phpbb_db_migration_3_0_1_rc1 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_1_rc1 extends phpbb_db_migration { function depends_on() { diff --git a/phpBB/includes/db/migration/3_0_2.php b/phpBB/includes/db/migration/data/3_0_2.php index 36e8d52e6b..a5f94e644b 100644 --- a/phpBB/includes/db/migration/3_0_2.php +++ b/phpBB/includes/db/migration/data/3_0_2.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_2 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_2 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_2_rc2'); + return array('phpbb_db_migration_data_3_0_2_rc2'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_2_rc1.php b/phpBB/includes/db/migration/data/3_0_2_rc1.php index cd21b7f64f..1b4d3bc2b8 100644 --- a/phpBB/includes/db/migration/3_0_2_rc1.php +++ b/phpBB/includes/db/migration/data/3_0_2_rc1.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_1_rc1 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_1_rc1 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_1'); + return array('phpbb_db_migration_data_3_0_1'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_2_rc2.php b/phpBB/includes/db/migration/data/3_0_2_rc2.php index a1fab753e2..9ddeb60a14 100644 --- a/phpBB/includes/db/migration/3_0_2_rc2.php +++ b/phpBB/includes/db/migration/data/3_0_2_rc2.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_2_rc2 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_2_rc2 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_2_rc1'); + return array('phpbb_db_migration_data_3_0_2_rc1'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_3.php b/phpBB/includes/db/migration/data/3_0_3.php index c9ca33ee88..f989eea025 100644 --- a/phpBB/includes/db/migration/3_0_3.php +++ b/phpBB/includes/db/migration/data/3_0_3.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_3 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_3 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_2_rc2'); + return array('phpbb_db_migration_data_3_0_2_rc2'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_3_rc1.php b/phpBB/includes/db/migration/data/3_0_3_rc1.php index 0cd99457ee..737eab4bd3 100644 --- a/phpBB/includes/db/migration/3_0_3_rc1.php +++ b/phpBB/includes/db/migration/data/3_0_3_rc1.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_3_rc1 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_3_rc1 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_2'); + return array('phpbb_db_migration_data_3_0_2'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_4.php b/phpBB/includes/db/migration/data/3_0_4.php index bbaaea54c9..cd34fda9ab 100644 --- a/phpBB/includes/db/migration/3_0_4.php +++ b/phpBB/includes/db/migration/data/3_0_4.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_4 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_4 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_4_rc1'); + return array('phpbb_db_migration_data_3_0_4_rc1'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_4_rc1.php b/phpBB/includes/db/migration/data/3_0_4_rc1.php index b783e58e24..342f1fa910 100644 --- a/phpBB/includes/db/migration/3_0_4_rc1.php +++ b/phpBB/includes/db/migration/data/3_0_4_rc1.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_4_rc1 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_4_rc1 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_3'); + return array('phpbb_db_migration_data_3_0_3'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_5.php b/phpBB/includes/db/migration/data/3_0_5.php index 272779f083..5671832a82 100644 --- a/phpBB/includes/db/migration/3_0_5.php +++ b/phpBB/includes/db/migration/data/3_0_5.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_5 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_5 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_5_rc1part2'); + return array('phpbb_db_migration_data_3_0_5_rc1part2'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_5_rc1.php b/phpBB/includes/db/migration/data/3_0_5_rc1.php index 8975728cca..9205f0d5f8 100644 --- a/phpBB/includes/db/migration/3_0_5_rc1.php +++ b/phpBB/includes/db/migration/data/3_0_5_rc1.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_5_rc1 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_5_rc1 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_4'); + return array('phpbb_db_migration_data_3_0_4'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_5_rc1part2.php b/phpBB/includes/db/migration/data/3_0_5_rc1part2.php index 710c8dce91..6be8ea9845 100644 --- a/phpBB/includes/db/migration/3_0_5_rc1part2.php +++ b/phpBB/includes/db/migration/data/3_0_5_rc1part2.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_5_rc1part2 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_5_rc1part2 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_5_rc1'); + return array('phpbb_db_migration_data_3_0_5_rc1'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_6.php b/phpBB/includes/db/migration/data/3_0_6.php index 9582038b36..c2cb59e62a 100644 --- a/phpBB/includes/db/migration/3_0_6.php +++ b/phpBB/includes/db/migration/data/3_0_6.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_6 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_6 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_6_rc4'); + return array('phpbb_db_migration_data_3_0_6_rc4'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_6_rc1.php b/phpBB/includes/db/migration/data/3_0_6_rc1.php index 0aa5746164..eefdc1692d 100644 --- a/phpBB/includes/db/migration/3_0_6_rc1.php +++ b/phpBB/includes/db/migration/data/3_0_6_rc1.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_6_rc1 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_6_rc1 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_5'); + return array('phpbb_db_migration_data_3_0_5'); } function update_schema() @@ -62,12 +62,10 @@ class phpbb_db_migration_3_0_6_rc1 extends phpbb_db_migration function update_data() { return array( - //array('custom', array(array(&$this, ''))) array('config.add', array('captcha_plugin', 'phpbb_captcha_nogd')), - array('config.update_if', array( + array('if', array( ($this->config['captcha_gd']), - 'captcha_plugin', - 'phpbb_captcha_gd', + array('config.update', array('captcha_plugin', 'phpbb_captcha_gd')), )), array('config.add', array('feed_enable', 0)), @@ -89,83 +87,70 @@ class phpbb_db_migration_3_0_6_rc1 extends phpbb_db_migration array('config.add', array('delete_time', $this->config['edit_time'])), array('config.add', array('allow_avatar', 0)), - array('config.add_if', array( + array('if', array( ($this->config['allow_avatar_upload'] || $this->config['allow_avatar_local'] || $this->config['allow_avatar_remote']), - 'allow_avatar', - 1, + array('config.add', array('allow_avatar', 1)), )), array('config.add', array('allow_avatar_remote_upload', 0)), - array('config.add_if', array( + array('if', array( ($this->config['allow_avatar_remote'] && $this->config['allow_avatar_upload']), - 'allow_avatar_remote_upload', - 1, + array('config.add', array('allow_avatar_remote_upload', 1)), )), array('module.add', array( - 'feed' => array( - 'base' => 'board', - 'class' => 'acp', - 'title' => 'ACP_FEED_SETTINGS', - 'auth' => 'acl_a_board', - 'cat' => 'ACP_BOARD_CONFIGURATION', - 'after' => array('signature', 'ACP_SIGNATURE_SETTINGS') + 'acp', + 'ACP_BOARD_CONFIGURATION', + array( + 'module_basename' => 'board', + 'modes' => array('feed'), ), )), array('module.add', array( - 'warnings' => array( - 'base' => 'users', - 'class' => 'acp', - 'title' => 'ACP_USER_WARNINGS', - 'auth' => 'acl_a_user', - 'display' => 0, - 'cat' => 'ACP_CAT_USERS', - 'after' => array('feedback', 'ACP_USER_FEEDBACK') + 'acp', + 'ACP_CAT_USERS', + array( + 'module_basename' => 'users', + 'modes' => array('warnings'), ), )), array('module.add', array( - 'send_statistics' => array( - 'base' => 'send_statistics', - 'class' => 'acp', - 'title' => 'ACP_SEND_STATISTICS', - 'auth' => 'acl_a_server', - 'cat' => 'ACP_SERVER_CONFIGURATION' + 'acp', + 'ACP_SERVER_CONFIGURATION', + array( + 'module_basename' => 'send_statistics', + 'modes' => array('send_statistics'), ), )), array('module.add', array( - 'setting_forum_copy' => array( - 'base' => 'permissions', - 'class' => 'acp', - 'title' => 'ACP_FORUM_PERMISSIONS_COPY', - 'auth' => 'acl_a_fauth && acl_a_authusers && acl_a_authgroups && acl_a_mauth', - 'cat' => 'ACP_FORUM_BASED_PERMISSIONS', - 'after' => array('setting_forum_local', 'ACP_FORUM_PERMISSIONS') + 'acp', + 'ACP_FORUM_BASED_PERMISSIONS', + array( + 'module_basename' => 'permissions', + 'modes' => array('setting_forum_copy'), ), )), array('module.add', array( - 'pm_reports' => array( - 'base' => 'pm_reports', - 'class' => 'mcp', - 'title' => 'MCP_PM_REPORTS_OPEN', - 'auth' => 'aclf_m_report', - 'cat' => 'MCP_REPORTS' + 'mcp', + 'MCP_REPORTS', + array( + 'module_basename' => 'pm_reports', + 'modes' => array('pm_reports'), ), )), array('module.add', array( - 'pm_reports_closed' => array( - 'base' => 'pm_reports', - 'class' => 'mcp', - 'title' => 'MCP_PM_REPORTS_CLOSED', - 'auth' => 'aclf_m_report', - 'cat' => 'MCP_REPORTS' + 'mcp', + 'MCP_REPORTS', + array( + 'module_basename' => 'pm_reports', + 'modes' => array('pm_reports_closed'), ), )), array('module.add', array( - 'pm_report_details' => array( - 'base' => 'pm_reports', - 'class' => 'mcp', - 'title' => 'MCP_PM_REPORT_DETAILS', - 'auth' => 'aclf_m_report', - 'cat' => 'MCP_REPORTS' + 'mcp', + 'MCP_REPORTS', + array( + 'module_basename' => 'pm_reports', + 'modes' => array('pm_report_details'), ), )), array('custom', array(array(&$this, 'add_newly_registered_group'))), diff --git a/phpBB/includes/db/migration/3_0_6_rc2.php b/phpBB/includes/db/migration/data/3_0_6_rc2.php index 1552485d0a..07b31a53b9 100644 --- a/phpBB/includes/db/migration/3_0_6_rc2.php +++ b/phpBB/includes/db/migration/data/3_0_6_rc2.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_6_rc2 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_6_rc2 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_6_rc1'); + return array('phpbb_db_migration_data_3_0_6_rc1'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_6_rc3.php b/phpBB/includes/db/migration/data/3_0_6_rc3.php index 6a7ad1c56d..c19a792bad 100644 --- a/phpBB/includes/db/migration/3_0_6_rc3.php +++ b/phpBB/includes/db/migration/data/3_0_6_rc3.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_6_rc3 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_6_rc3 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_6_rc2'); + return array('phpbb_db_migration_data_3_0_6_rc2'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_6_rc4.php b/phpBB/includes/db/migration/data/3_0_6_rc4.php index 00161456b6..c48b1ca394 100644 --- a/phpBB/includes/db/migration/3_0_6_rc4.php +++ b/phpBB/includes/db/migration/data/3_0_6_rc4.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_6_rc4 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_6_rc4 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_6_rc3'); + return array('phpbb_db_migration_data_3_0_6_rc3'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_7.php b/phpBB/includes/db/migration/data/3_0_7.php index 2b5ec15fa9..05781b7b49 100644 --- a/phpBB/includes/db/migration/3_0_7.php +++ b/phpBB/includes/db/migration/data/3_0_7.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_7 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_7 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_7_rc2'); + return array('phpbb_db_migration_data_3_0_7_rc2'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_7_pl1.php b/phpBB/includes/db/migration/data/3_0_7_pl1.php index 22c04f1daf..cee7a91a2e 100644 --- a/phpBB/includes/db/migration/3_0_7_pl1.php +++ b/phpBB/includes/db/migration/data/3_0_7_pl1.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_7_pl1 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_7_pl1 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_7'); + return array('phpbb_db_migration_data_3_0_7'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_7_rc1.php b/phpBB/includes/db/migration/data/3_0_7_rc1.php index d08a468941..b2d49cce63 100644 --- a/phpBB/includes/db/migration/3_0_7_rc1.php +++ b/phpBB/includes/db/migration/data/3_0_7_rc1.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_7_rc1 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_7_rc1 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_6'); + return array('phpbb_db_migration_data_3_0_6'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_7_rc2.php b/phpBB/includes/db/migration/data/3_0_7_rc2.php index 4ab4e906d7..8a751328bf 100644 --- a/phpBB/includes/db/migration/3_0_7_rc2.php +++ b/phpBB/includes/db/migration/data/3_0_7_rc2.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_7_rc2 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_7_rc2 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_7_rc1'); + return array('phpbb_db_migration_data_3_0_7_rc1'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_8.php b/phpBB/includes/db/migration/data/3_0_8.php index 3e7f843a65..a714a3d2f6 100644 --- a/phpBB/includes/db/migration/3_0_8.php +++ b/phpBB/includes/db/migration/data/3_0_8.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_8 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_8 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_8_rc1'); + return array('phpbb_db_migration_data_3_0_8_rc1'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_8_rc1.php b/phpBB/includes/db/migration/data/3_0_8_rc1.php index 0d93efedce..73838d9d29 100644 --- a/phpBB/includes/db/migration/3_0_8_rc1.php +++ b/phpBB/includes/db/migration/data/3_0_8_rc1.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_8_rc1 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_8_rc1 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_7_pl1'); + return array('phpbb_db_migration_data_3_0_7_pl1'); } function update_schema() @@ -27,13 +27,11 @@ class phpbb_db_migration_3_0_8_rc1 extends phpbb_db_migration array('custom', array(array(&$this, 'update_bots'))), array('custom', array(array(&$this, 'delete_orphan_shadow_topics'))), array('module.add', array( - 'post' => array( - 'base' => 'board', - 'class' => 'acp', - 'title' => 'ACP_POST_SETTINGS', - 'auth' => 'acl_a_board', - 'cat' => 'ACP_MESSAGES', - 'after' => array('message', 'ACP_MESSAGE_SETTINGS') + 'acp', + 'ACP_MESSAGES', + array( + 'module_basename' => 'board', + 'modes' => array('post'), ), )), array('config.add', array('load_unreads_search', 1)), diff --git a/phpBB/includes/db/migration/3_0_9.php b/phpBB/includes/db/migration/data/3_0_9.php index 2e1eab26e7..4b2c08a256 100644 --- a/phpBB/includes/db/migration/3_0_9.php +++ b/phpBB/includes/db/migration/data/3_0_9.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_9 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_9 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_9_rc4'); + return array('phpbb_db_migration_data_3_0_9_rc4'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_9_rc1.php b/phpBB/includes/db/migration/data/3_0_9_rc1.php index 4ee18349ce..98d3a26481 100644 --- a/phpBB/includes/db/migration/3_0_9_rc1.php +++ b/phpBB/includes/db/migration/data/3_0_9_rc1.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_9_rc1 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_9_rc1 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_8'); + return array('phpbb_db_migration_data_3_0_8'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_9_rc2.php b/phpBB/includes/db/migration/data/3_0_9_rc2.php index 96782b2b01..589047670a 100644 --- a/phpBB/includes/db/migration/3_0_9_rc2.php +++ b/phpBB/includes/db/migration/data/3_0_9_rc2.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_9_rc2 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_9_rc2 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_9_rc1'); + return array('phpbb_db_migration_data_3_0_9_rc1'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_9_rc3.php b/phpBB/includes/db/migration/data/3_0_9_rc3.php index ac0f3cb972..06061cbcb6 100644 --- a/phpBB/includes/db/migration/3_0_9_rc3.php +++ b/phpBB/includes/db/migration/data/3_0_9_rc3.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_9_rc3 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_9_rc3 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_9_rc2'); + return array('phpbb_db_migration_data_3_0_9_rc2'); } function update_schema() diff --git a/phpBB/includes/db/migration/3_0_9_rc4.php b/phpBB/includes/db/migration/data/3_0_9_rc4.php index 7880e1b864..04b3ae4b39 100644 --- a/phpBB/includes/db/migration/3_0_9_rc4.php +++ b/phpBB/includes/db/migration/data/3_0_9_rc4.php @@ -7,11 +7,11 @@ * */ -class phpbb_db_migration_3_0_9_rc4 extends phpbb_db_migration +class phpbb_db_migration_data_3_0_9_rc4 extends phpbb_db_migration { function depends_on() { - return array('phpbb_db_migration_3_0_9_rc3'); + return array('phpbb_db_migration_data_3_0_9_rc3'); } function update_schema() diff --git a/phpBB/includes/db/migration/tools/base.php b/phpBB/includes/db/migration/tools/base.php new file mode 100644 index 0000000000..61116d8b55 --- /dev/null +++ b/phpBB/includes/db/migration/tools/base.php @@ -0,0 +1,47 @@ +<?php +/** +* +* @package migration +* @copyright (c) 2012 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* +*/ + +class phpbb_db_migration_tools_base +{ + /** @var phpbb_auth */ + protected $auth = null; + + /** @var phpbb_cache_service */ + protected $cache = null; + + /** @var phpbb_config */ + protected $config = null; + + /** @var dbal */ + protected $db = null; + + /** @var phpbb_template */ + protected $template = null; + + /** @var phpbb_user */ + protected $user = null; + + /** @var string */ + protected $phpbb_root_path = null; + + /** @var string */ + protected $php_ext = null; + + public function __construct(dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext) + { + $this->db = $db; + $this->cache = $cache; + $this->template = $template; + $this->user = $user; + $this->auth = $auth; + $this->config = $config; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } +}
\ No newline at end of file diff --git a/phpBB/includes/db/migration/tools/config.php b/phpBB/includes/db/migration/tools/config.php new file mode 100644 index 0000000000..965ba1d136 --- /dev/null +++ b/phpBB/includes/db/migration/tools/config.php @@ -0,0 +1,106 @@ +<?php +/** +* +* @package migration +* @copyright (c) 2012 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* +*/ + +class phpbb_db_migration_tools_config extends phpbb_db_migration_tools_base +{ + /** + * Config Exists + * + * This function is to check to see if a config variable exists or if it does not. + * + * @param string $config_name The name of the config setting you wish to check for. + * + * @return bool true/false if config exists + */ + public function exists($config_name) + { + return (bool) $this->config->offsetExists($config_name); + } + + /** + * Config Add + * + * This function allows you to add a config setting. + * + * @param string $config_name The name of the config setting you would like to add + * @param mixed $config_value The value of the config setting + * @param bool $is_dynamic True if it is dynamic (changes very often) and should not be stored in the cache, false if not. + */ + public function add($config_name, $config_value = '', $is_dynamic = false) + { + if ($this->config_exists($config_name)) + { + throw new phpbb_db_migration_exception('CONFIG_ALREADY_EXISTS', $config_name); + } + + $this->config->set($config_name, $config_value, $is_dynamic); + + return false; + } + + /** + * Config Update + * + * This function allows you to update an existing config setting. + * + * @param string $config_name The name of the config setting you would like to update + * @param mixed $config_value The value of the config setting + */ + public function update($config_name, $config_value = '') + { + if (!$this->config_exists($config_name)) + { + throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name); + } + + $this->config->set($config_name, $config_value); + + return false; + } + + /** + * Config Update If Equals + * + * This function allows you to update a config setting if the first argument equal to the current config value + * + * @param bool $compare If equal to the current config value, will be updated to the new config value, otherwise not + * @param string $config_name The name of the config setting you would like to update + * @param mixed $config_value The value of the config setting + */ + public function update_if_equals($compare, $config_name, $config_value = '') + { + if (!$this->config_exists($config_name)) + { + throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name); + } + + $this->config->set_atomic($config_name, $compare, $config_value); + + return false; + } + + /** + * Config Remove + * + * This function allows you to remove an existing config setting. + * + * @param string $config_name The name of the config setting you would like to remove + */ + public function remove($config_name) + { + if (!$this->config_exists($config_name)) + { + throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name); + } + + $this->config->delete($config_name); + + return false; + } +}
\ No newline at end of file diff --git a/phpBB/includes/db/migration/tools/module.php b/phpBB/includes/db/migration/tools/module.php new file mode 100644 index 0000000000..df1912a022 --- /dev/null +++ b/phpBB/includes/db/migration/tools/module.php @@ -0,0 +1,419 @@ +<?php +/** +* +* @package migration +* @copyright (c) 2012 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* +*/ + +class phpbb_db_migration_tools_module extends phpbb_db_migration_tools_base +{ + /** + * Module Exists + * + * Check if a module exists + * + * @param string $class The module class(acp|mcp|ucp) + * @param int|string|bool $parent The parent module_id|module_langname (0 for no parent). Use false to ignore the parent check and check class wide. + * @param int|string $module The module_id|module_langname you would like to check for to see if it exists + * + * @return bool true/false if module exists + */ + public function exists($class, $parent, $module) + { + // the main root directory should return true + if (!$module) + { + return true; + } + + $class = $this->db->sql_escape($class); + $module = $this->db->sql_escape($module); + + $parent_sql = ''; + if ($parent !== false) + { + // Allows '' to be sent as 0 + $parent = (!$parent) ? 0 : $parent; + + if (!is_numeric($parent)) + { + $sql = 'SELECT module_id FROM ' . MODULES_TABLE . " + WHERE module_langname = '" . $this->db->sql_escape($parent) . "' + AND module_class = '$class'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row) + { + return false; + } + + $parent_sql = 'AND parent_id = ' . (int) $row['module_id']; + } + else + { + $parent_sql = 'AND parent_id = ' . (int) $parent; + } + } + + $sql = 'SELECT module_id FROM ' . MODULES_TABLE . " + WHERE module_class = '$class' + $parent_sql + AND " . ((is_numeric($module)) ? 'module_id = ' . (int) $module : "module_langname = '$module'"); + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($row) + { + return true; + } + + return false; + } + + /** + * Module Add + * + * Add a new module + * + * @param string $class The module class(acp|mcp|ucp) + * @param int|string $parent The parent module_id|module_langname (0 for no parent) + * @param array $data an array of the data on the new module. This can be setup in two different ways. + * 1. The "manual" way. For inserting a category or one at a time. It will be merged with the base array shown a bit below, + * but at the least requires 'module_langname' to be sent, and, if you want to create a module (instead of just a category) you must send module_basename and module_mode. + * array( + * 'module_enabled' => 1, + * 'module_display' => 1, + * 'module_basename' => '', + * 'module_class' => $class, + * 'parent_id' => (int) $parent, + * 'module_langname' => '', + * 'module_mode' => '', + * 'module_auth' => '', + * ) + * 2. The "automatic" way. For inserting multiple at a time based on the specs in the info file for the module(s). For this to work the modules must be correctly setup in the info file. + * An example follows (this would insert the settings, log, and flag modes from the includes/acp/info/acp_asacp.php file): + * array( + * 'module_basename' => 'asacp', + * 'modes' => array('settings', 'log', 'flag'), + * ) + * Optionally you may not send 'modes' and it will insert all of the modules in that info file. + * @param string|bool $include_path If you would like to use a custom include path, specify that here + */ + public function add($class, $parent = 0, $data = array(), $include_path = false) + { + // Allows '' to be sent as 0 + $parent = (!$parent) ? 0 : $parent; + + // allow sending the name as a string in $data to create a category + if (!is_array($data)) + { + $data = array('module_langname' => $data); + } + + if (!isset($data['module_langname'])) + { + // The "automatic" way + $basename = (isset($data['module_basename'])) ? $data['module_basename'] : ''; + $basename = str_replace(array('/', '\\'), '', $basename); + $class = str_replace(array('/', '\\'), '', $class); + $info_file = "$class/info/{$class}_$basename.$this->phpEx"; + + // The manual and automatic ways both failed... + if (!file_exists((($include_path === false) ? $this->phpbb_root_path . 'includes/' : $include_path) . $info_file)) + { + throw new phpbb_db_migration_exception('MODULE_ADD', $class, $info_file); + } + + $classname = "{$class}_{$basename}_info"; + + if (!class_exists($classname)) + { + include((($include_path === false) ? $this->phpbb_root_path . 'includes/' : $include_path) . $info_file); + } + + $info = new $classname; + $module = $info->module(); + unset($info); + + $result = ''; + foreach ($module['modes'] as $mode => $module_info) + { + if (!isset($data['modes']) || in_array($mode, $data['modes'])) + { + $new_module = array( + 'module_basename' => $basename, + 'module_langname' => $module_info['title'], + 'module_mode' => $mode, + 'module_auth' => $module_info['auth'], + 'module_display' => (isset($module_info['display'])) ? $module_info['display'] : true, + 'before' => (isset($module_info['before'])) ? $module_info['before'] : false, + 'after' => (isset($module_info['after'])) ? $module_info['after'] : false, + ); + + // Run the "manual" way with the data we've collected. + $result .= ((isset($data['spacer'])) ? $data['spacer'] : '<br />') . $this->add($class, $parent, $new_module); + } + } + + return $result; + } + + // The "manual" way + add_log('admin', 'LOG_MODULE_ADD', ((isset($this->user->lang[$data['module_langname']])) ? $this->user->lang[$data['module_langname']] : $data['module_langname'])); + + $class = $this->db->sql_escape($class); + + if (!is_numeric($parent)) + { + $sql = 'SELECT module_id FROM ' . MODULES_TABLE . " + WHERE module_langname = '" . $this->db->sql_escape($parent) . "' + AND module_class = '$class'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row) + { + throw new phpbb_db_migration_exception('MODULE_PARENT_NOT_EXIST', $parent); + } + + $parent = $data['parent_id'] = $row['module_id']; + } + else if (!$this->exists($class, false, $parent)) + { + throw new phpbb_db_migration_exception('MODULE_PARENT_NOT_EXIST', $parent); + } + + if ($this->exists($class, $parent, $data['module_langname'])) + { + throw new phpbb_db_migration_exception('MODULE_ALREADY_EXIST', $data['module_langname']); + } + + if (!class_exists('acp_modules')) + { + include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->phpEx); + $this->user->add_lang('acp/modules'); + } + $acp_modules = new acp_modules(); + + $module_data = array( + 'module_enabled' => (isset($data['module_enabled'])) ? $data['module_enabled'] : 1, + 'module_display' => (isset($data['module_display'])) ? $data['module_display'] : 1, + 'module_basename' => (isset($data['module_basename'])) ? $data['module_basename'] : '', + 'module_class' => $class, + 'parent_id' => (int) $parent, + 'module_langname' => (isset($data['module_langname'])) ? $data['module_langname'] : '', + 'module_mode' => (isset($data['module_mode'])) ? $data['module_mode'] : '', + 'module_auth' => (isset($data['module_auth'])) ? $data['module_auth'] : '', + ); + $result = $acp_modules->update_module_data($module_data, true); + + // update_module_data can either return a string or an empty array... + if (is_string($result)) + { + // Error + throw new phpbb_db_migration_exception('MODULE_ERROR', $result); + } + else + { + // Success + + // Move the module if requested above/below an existing one + if (isset($data['before']) && $data['before']) + { + $sql = 'SELECT left_id FROM ' . MODULES_TABLE . ' + WHERE module_class = \'' . $class . '\' + AND parent_id = ' . (int) $parent . ' + AND module_langname = \'' . $this->db->sql_escape($data['before']) . '\''; + $this->db->sql_query($sql); + $to_left = $this->db->sql_fetchfield('left_id'); + + $sql = 'UPDATE ' . MODULES_TABLE . " SET left_id = left_id + 2, right_id = right_id + 2 + WHERE module_class = '$class' + AND left_id >= $to_left + AND left_id < {$module_data['left_id']}"; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . MODULES_TABLE . " SET left_id = $to_left, right_id = " . ($to_left + 1) . " + WHERE module_class = '$class' + AND module_id = {$module_data['module_id']}"; + $this->db->sql_query($sql); + } + else if (isset($data['after']) && $data['after']) + { + $sql = 'SELECT right_id FROM ' . MODULES_TABLE . ' + WHERE module_class = \'' . $class . '\' + AND parent_id = ' . (int) $parent . ' + AND module_langname = \'' . $this->db->sql_escape($data['after']) . '\''; + $this->db->sql_query($sql); + $to_right = $this->db->sql_fetchfield('right_id'); + + $sql = 'UPDATE ' . MODULES_TABLE . " SET left_id = left_id + 2, right_id = right_id + 2 + WHERE module_class = '$class' + AND left_id >= $to_right + AND left_id < {$module_data['left_id']}"; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . MODULES_TABLE . ' SET left_id = ' . ($to_right + 1) . ', right_id = ' . ($to_right + 2) . " + WHERE module_class = '$class' + AND module_id = {$module_data['module_id']}"; + $this->db->sql_query($sql); + } + } + + // Clear the Modules Cache + $this->cache->destroy("_modules_$class"); + + return false; + } + + /** + * Module Remove + * + * Remove a module + * + * @param string $class The module class(acp|mcp|ucp) + * @param int|string|bool $parent The parent module_id|module_langname (0 for no parent). Use false to ignore the parent check and check class wide. + * @param int|string $module The module id|module_langname + * @param string|bool $include_path If you would like to use a custom include path, specify that here + */ + public function remove($class, $parent = 0, $module = '', $include_path = false) + { + // Imitation of module_add's "automatic" and "manual" method so the uninstaller works from the same set of instructions for umil_auto + if (is_array($module)) + { + if (isset($module['module_langname'])) + { + // Manual Method + return $this->remove($class, $parent, $module['module_langname'], $include_path); + } + + // Failed. + if (!isset($module['module_basename'])) + { + throw new phpbb_db_migration_exception('MODULE_NOT_EXIST'); + } + + // Automatic method + $basename = str_replace(array('/', '\\'), '', $module['module_basename']); + $class = str_replace(array('/', '\\'), '', $class); + $info_file = "$class/info/{$class}_$basename.$this->phpEx"; + + if (!file_exists((($include_path === false) ? $this->phpbb_root_path . 'includes/' : $include_path) . $info_file)) + { + throw new phpbb_db_migration_exception('MODULE_NOT_EXIST', $info_file); + } + + $classname = "{$class}_{$basename}_info"; + + if (!class_exists($classname)) + { + include((($include_path === false) ? $this->phpbb_root_path . 'includes/' : $include_path) . $info_file); + } + + $info = new $classname; + $module_info = $info->module(); + unset($info); + + foreach ($module_info['modes'] as $mode => $info) + { + if (!isset($module['modes']) || in_array($mode, $module['modes'])) + { + $this->remove($class, $parent, $info['title']) . '<br />'; + } + } + return false; + } + else + { + $class = $this->db->sql_escape($class); + + if (!$this->exists($class, $parent, $module)) + { + throw new phpbb_db_migration_exception('MODULE_NOT_EXIST', ((isset($this->user->lang[$module])) ? $this->user->lang[$module] : $module)); + } + + $parent_sql = ''; + if ($parent !== false) + { + // Allows '' to be sent as 0 + $parent = (!$parent) ? 0 : $parent; + + if (!is_numeric($parent)) + { + $sql = 'SELECT module_id FROM ' . MODULES_TABLE . " + WHERE module_langname = '" . $this->db->sql_escape($parent) . "' + AND module_class = '$class'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + // we know it exists from the module_exists check + $parent_sql = 'AND parent_id = ' . (int) $row['module_id']; + } + else + { + $parent_sql = 'AND parent_id = ' . (int) $parent; + } + } + + $module_ids = array(); + if (!is_numeric($module)) + { + $module = $this->db->sql_escape($module); + $sql = 'SELECT module_id FROM ' . MODULES_TABLE . " + WHERE module_langname = '$module' + AND module_class = '$class' + $parent_sql"; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $module_ids[] = (int) $row['module_id']; + } + $this->db->sql_freeresult($result); + + $module_name = $module; + } + else + { + $module = (int) $module; + $sql = 'SELECT module_langname FROM ' . MODULES_TABLE . " + WHERE module_id = $module + AND module_class = '$class' + $parent_sql"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $module_name = $row['module_langname']; + $module_ids[] = $module; + } + + if (!class_exists('acp_modules')) + { + include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->phpEx); + $this->user->add_lang('acp/modules'); + } + $acp_modules = new acp_modules(); + $acp_modules->module_class = $class; + + foreach ($module_ids as $module_id) + { + $result = $acp_modules->delete_module($module_id); + if (!empty($result)) + { + throw new phpbb_db_migration_exception('CANNOT_REMOVE_MODULE', $module_id); + } + } + + $cache->destroy("_modules_$class"); + + return false; + } + } +}
\ No newline at end of file diff --git a/phpBB/includes/db/migration/tools/permission.php b/phpBB/includes/db/migration/tools/permission.php new file mode 100644 index 0000000000..3fbe7c649c --- /dev/null +++ b/phpBB/includes/db/migration/tools/permission.php @@ -0,0 +1,480 @@ +<?php +/** +* +* @package migration +* @copyright (c) 2012 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 +* +*/ + +class phpbb_db_migration_tools_permission extends phpbb_db_migration_tools_base +{ + /** + * Permission Exists + * + * Check if a permission (auth) setting exists + * + * @param string $auth_option The name of the permission (auth) option + * @param bool $global True for checking a global permission setting, False for a local permission setting + * + * @return bool true if it exists, false if not + */ + public function exists($auth_option, $global = true) + { + if ($global) + { + $type_sql = ' AND is_global = 1'; + } + else + { + $type_sql = ' AND is_local = 1'; + } + + $sql = 'SELECT auth_option_id + FROM ' . ACL_OPTIONS_TABLE . " + WHERE auth_option = '" . $this->db->sql_escape($auth_option) . "'" + . $type_sql; + $result = $this->db->sql_query($sql); + + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($row) + { + return true; + } + + return false; + } + + /** + * Permission Add + * + * Add a permission (auth) option + * + * @param string $auth_option The name of the permission (auth) option + * @param bool $global True for checking a global permission setting, False for a local permission setting + * + * @return result + */ + public function add($auth_option, $global = true) + { + if ($this->exists($auth_option, $global)) + { + throw new phpbb_db_migration_exception('PERMISSION_ALREADY_EXISTS', $auth_option); + } + + // We've added permissions, so set to true to notify the user. + $this->permissions_added = true; + + if (!class_exists('auth_admin')) + { + include($this->phpbb_root_path . 'includes/acp/auth.' . $this->phpEx); + } + $auth_admin = new auth_admin(); + + // We have to add a check to see if the !$global (if global, local, and if local, global) permission already exists. If it does, acl_add_option currently has a bug which would break the ACL system, so we are having a work-around here. + if ($this->exists($auth_option, !$global)) + { + $sql_ary = array( + 'is_global' => 1, + 'is_local' => 1, + ); + $sql = 'UPDATE ' . ACL_OPTIONS_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE auth_option = \'' . $this->db->sql_escape($auth_option) . "'"; + $this->db->sql_query($sql); + } + else + { + if ($global) + { + $auth_admin->acl_add_option(array('global' => array($auth_option))); + } + else + { + $auth_admin->acl_add_option(array('local' => array($auth_option))); + } + } + + return false; + } + + /** + * Permission Remove + * + * Remove a permission (auth) option + * + * @param string $auth_option The name of the permission (auth) option + * @param bool $global True for checking a global permission setting, False for a local permission setting + * + * @return result + */ + public function remove($auth_option, $global = true) + { + if (!$this->exists($auth_option, $global)) + { + throw new phpbb_db_migration_exception('PERMISSION_NOT_EXIST', $auth_option); + } + + if ($global) + { + $type_sql = ' AND is_global = 1'; + } + else + { + $type_sql = ' AND is_local = 1'; + } + $sql = 'SELECT auth_option_id, is_global, is_local FROM ' . ACL_OPTIONS_TABLE . " + WHERE auth_option = '" . $this->db->sql_escape($auth_option) . "'" . + $type_sql; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $id = $row['auth_option_id']; + + // If it is a local and global permission, do not remove the row! :P + if ($row['is_global'] && $row['is_local']) + { + $sql = 'UPDATE ' . ACL_OPTIONS_TABLE . ' + SET ' . (($global) ? 'is_global = 0' : 'is_local = 0') . ' + WHERE auth_option_id = ' . $id; + $this->db->sql_query($sql); + } + else + { + // Delete time + $this->db->sql_query('DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_option_id = ' . $id); + $this->db->sql_query('DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' WHERE auth_option_id = ' . $id); + $this->db->sql_query('DELETE FROM ' . ACL_USERS_TABLE . ' WHERE auth_option_id = ' . $id); + $this->db->sql_query('DELETE FROM ' . ACL_OPTIONS_TABLE . ' WHERE auth_option_id = ' . $id); + } + + // Purge the auth cache + $this->cache->destroy('_acl_options'); + $this->auth->acl_clear_prefetch(); + + return false; + } + + /** + * Add a new permission role + * + * @param string $role_name The new role name + * @param sting $role_type The type (u_, m_, a_) + */ + public function role_add($role_name, $role_type = '', $role_description = '') + { + $sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . ' + WHERE role_name = \'' . $this->db->sql_escape($role_name) . '\''; + $this->db->sql_query($sql); + $role_id = $this->db->sql_fetchfield('role_id'); + + if ($role_id) + { + throw new phpbb_db_migration_exception('ROLE_ALREADY_EXISTS', $old_role_name); + } + + $sql = 'SELECT MAX(role_order) AS max FROM ' . ACL_ROLES_TABLE . ' + WHERE role_type = \'' . $this->db->sql_escape($role_type) . '\''; + $this->db->sql_query($sql); + $role_order = $this->db->sql_fetchfield('max'); + $role_order = (!$role_order) ? 1 : $role_order + 1; + + $sql_ary = array( + 'role_name' => $role_name, + 'role_description' => $role_description, + 'role_type' => $role_type, + 'role_order' => $role_order, + ); + + $sql = 'INSERT INTO ' . ACL_ROLES_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary); + $this->db->sql_query($sql); + + return false; + } + + /** + * Update the name on a permission role + * + * @param string $old_role_name The old role name + * @param string $new_role_name The new role name + */ + public function role_update($old_role_name, $new_role_name = '') + { + $sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . ' + WHERE role_name = \'' . $this->db->sql_escape($old_role_name) . '\''; + $this->db->sql_query($sql); + $role_id = $this->db->sql_fetchfield('role_id'); + + if (!$role_id) + { + throw new phpbb_db_migration_exception('ROLE_NOT_EXISTS', $old_role_name); + } + + $sql = 'UPDATE ' . ACL_ROLES_TABLE . ' + SET role_name = \'' . $this->db->sql_escape($new_role_name) . '\' + WHERE role_name = \'' . $this->db->sql_escape($old_role_name) . '\''; + $this->db->sql_query($sql); + + return false; + } + + /** + * Remove a permission role + * + * @param string $role_name The role name to remove + */ + public function role_remove($role_name) + { + $sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . ' + WHERE role_name = \'' . $this->db->sql_escape($role_name) . '\''; + $this->db->sql_query($sql); + $role_id = $this->db->sql_fetchfield('role_id'); + + if (!$role_id) + { + throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $role_name); + } + + $sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' + WHERE role_id = ' . $role_id; + $this->db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_ROLES_TABLE . ' + WHERE role_id = ' . $role_id; + $this->db->sql_query($sql); + + $this->auth->acl_clear_prefetch(); + + return false; + } + + /** + * Permission Set + * + * Allows you to set permissions for a certain group/role + * + * @param string $name The name of the role/group + * @param string|array $auth_option The auth_option or array of auth_options you would like to set + * @param string $type The type (role|group) + * @param bool $has_permission True if you want to give them permission, false if you want to deny them permission + */ + public function permission_set($name, $auth_option = array(), $type = 'role', $has_permission = true) + { + if (!is_array($auth_option)) + { + $auth_option = array($auth_option); + } + + $new_auth = array(); + $sql = 'SELECT auth_option_id FROM ' . ACL_OPTIONS_TABLE . ' + WHERE ' . $this->db->sql_in_set('auth_option', $auth_option); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $new_auth[] = $row['auth_option_id']; + } + $this->db->sql_freeresult($result); + + if (!sizeof($new_auth)) + { + return false; + } + + $current_auth = array(); + + $type = (string) $type; // Prevent PHP bug. + + switch ($type) + { + case 'role' : + $sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . ' + WHERE role_name = \'' . $this->db->sql_escape($name) . '\''; + $this->db->sql_query($sql); + $role_id = $this->db->sql_fetchfield('role_id'); + + if (!$role_id) + { + throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $name); + } + + $sql = 'SELECT auth_option_id, auth_setting FROM ' . ACL_ROLES_DATA_TABLE . ' + WHERE role_id = ' . $role_id; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $current_auth[$row['auth_option_id']] = $row['auth_setting']; + } + $this->db->sql_freeresult($result); + break; + + case 'group' : + $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . ' WHERE group_name = \'' . $this->db->sql_escape($name) . '\''; + $this->db->sql_query($sql); + $group_id = $this->db->sql_fetchfield('group_id'); + + if (!$group_id) + { + throw new phpbb_db_migration_exception('GROUP_NOT_EXIST', $name); + } + + // If the group has a role set for them we will add the requested permissions to that role. + $sql = 'SELECT auth_role_id FROM ' . ACL_GROUPS_TABLE . ' + WHERE group_id = ' . $group_id . ' + AND auth_role_id <> 0 + AND forum_id = 0'; + $this->db->sql_query($sql); + $role_id = $this->db->sql_fetchfield('auth_role_id'); + if ($role_id) + { + $sql = 'SELECT role_name FROM ' . ACL_ROLES_TABLE . ' + WHERE role_id = ' . $role_id; + $this->db->sql_query($sql); + $role_name = $this->db->sql_fetchfield('role_name'); + + return $this->set($role_name, $auth_option, 'role', $has_permission); + } + + $sql = 'SELECT auth_option_id, auth_setting FROM ' . ACL_GROUPS_TABLE . ' + WHERE group_id = ' . $group_id; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $current_auth[$row['auth_option_id']] = $row['auth_setting']; + } + $this->db->sql_freeresult($result); + break; + } + + $sql_ary = array(); + switch ($type) + { + case 'role' : + foreach ($new_auth as $auth_option_id) + { + if (!isset($current_auth[$auth_option_id])) + { + $sql_ary[] = array( + 'role_id' => $role_id, + 'auth_option_id' => $auth_option_id, + 'auth_setting' => $has_permission, + ); + } + } + + $this->db->sql_multi_insert(ACL_ROLES_DATA_TABLE, $sql_ary); + break; + + case 'group' : + foreach ($new_auth as $auth_option_id) + { + if (!isset($current_auth[$auth_option_id])) + { + $sql_ary[] = array( + 'group_id' => $group_id, + 'auth_option_id' => $auth_option_id, + 'auth_setting' => $has_permission, + ); + } + } + + $this->db->sql_multi_insert(ACL_GROUPS_TABLE, $sql_ary); + break; + } + + $this->auth->acl_clear_prefetch(); + + return false; + } + + /** + * Permission Unset + * + * Allows you to unset (remove) permissions for a certain group/role + * + * @param string $name The name of the role/group + * @param string|array $auth_option The auth_option or array of auth_options you would like to set + * @param string $type The type (role|group) + */ + public function permission_unset($name, $auth_option = array(), $type = 'role') + { + if (!is_array($auth_option)) + { + $auth_option = array($auth_option); + } + + $to_remove = array(); + $sql = 'SELECT auth_option_id FROM ' . ACL_OPTIONS_TABLE . ' + WHERE ' . $this->db->sql_in_set('auth_option', $auth_option); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $to_remove[] = $row['auth_option_id']; + } + $this->db->sql_freeresult($result); + + if (!sizeof($to_remove)) + { + return false; + } + + $type = (string) $type; // Prevent PHP bug. + + switch ($type) + { + case 'role' : + $sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . ' + WHERE role_name = \'' . $this->db->sql_escape($name) . '\''; + $this->db->sql_query($sql); + $role_id = $this->db->sql_fetchfield('role_id'); + + if (!$role_id) + { + throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $name); + } + + $sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' + WHERE ' . $this->db->sql_in_set('auth_option_id', $to_remove); + $this->db->sql_query($sql); + break; + + case 'group' : + $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . ' + WHERE group_name = \'' . $this->db->sql_escape($name) . '\''; + $this->db->sql_query($sql); + $group_id = $this->db->sql_fetchfield('group_id'); + + if (!$group_id) + { + throw new phpbb_db_migration_exception('GROUP_NOT_EXIST', $name); + } + + // If the group has a role set for them we will remove the requested permissions from that role. + $sql = 'SELECT auth_role_id FROM ' . ACL_GROUPS_TABLE . ' + WHERE group_id = ' . $group_id . ' + AND auth_role_id <> 0'; + $this->db->sql_query($sql); + $role_id = $this->db->sql_fetchfield('auth_role_id'); + if ($role_id) + { + $sql = 'SELECT role_name FROM ' . ACL_ROLES_TABLE . ' + WHERE role_id = ' . $role_id; + $this->db->sql_query($sql); + $role_name = $this->db->sql_fetchfield('role_name'); + + return $this->permission_unset($role_name, $auth_option, 'role'); + } + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' + WHERE ' . $this->db->sql_in_set('auth_option_id', $to_remove); + $this->db->sql_query($sql); + break; + } + + $this->auth->acl_clear_prefetch(); + + return false; + } +}
\ No newline at end of file diff --git a/phpBB/includes/db/migrationtools/umil.php b/phpBB/includes/db/migration/tools/umil.php index ce7b8ff3be..ce7b8ff3be 100644 --- a/phpBB/includes/db/migrationtools/umil.php +++ b/phpBB/includes/db/migration/tools/umil.php diff --git a/phpBB/includes/db/migrationtools/base.php b/phpBB/includes/db/migrationtools/base.php deleted file mode 100644 index 7fc6057e3a..0000000000 --- a/phpBB/includes/db/migrationtools/base.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -/** -* -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 -* -*/ - -class phpbb_db_migrationtools_base -{ - var $cache; - var $config; - var $db; -}
\ No newline at end of file diff --git a/phpBB/includes/db/migrationtools/config.php b/phpBB/includes/db/migrationtools/config.php deleted file mode 100644 index 5a40e39943..0000000000 --- a/phpBB/includes/db/migrationtools/config.php +++ /dev/null @@ -1,121 +0,0 @@ -<?php -/** -* -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 -* -*/ - -class phpbb_db_migrationtools_config extends phpbb_db_migration -{ - /** - * Config Exists - * - * This function is to check to see if a config variable exists or if it does not. - * - * @param string $config_name The name of the config setting you wish to check for. - * @param bool $return_result - return the config value/default if true : default false. - * - * @return bool true/false if config exists - */ - function config_exists($config_name, $return_result = false) - { - $sql = 'SELECT * - FROM ' . CONFIG_TABLE . " - WHERE config_name = '" . $this->db->sql_escape($config_name) . "'"; - $result = $this->db->sql_query($sql); - $row = $this->db->sql_fetchrow($result); - $this->db->sql_freeresult($result); - - if ($row) - { - if (!isset($this->config[$config_name])) - { - $this->config[$config_name] = $row['config_value']; - - if (!$row['is_dynamic']) - { - $this->cache->destroy('config'); - } - } - - return ($return_result) ? $row : true; - } - - // this should never happen, but if it does, we need to remove the config from the array - if (isset($this->config[$config_name])) - { - unset($this->config[$config_name]); - $this->cache->destroy('config'); - } - - return false; - } - - /** - * Config Add - * - * This function allows you to add a config setting. - * - * @param string $config_name The name of the config setting you would like to add - * @param mixed $config_value The value of the config setting - * @param bool $is_dynamic True if it is dynamic (changes very often) and should not be stored in the cache, false if not. - * - * @return result - */ - function config_add($config_name, $config_value = '', $is_dynamic = false) - { - if ($this->config_exists($config_name)) - { - return $this->umil_end('CONFIG_ALREADY_EXISTS', $config_name); - } - - set_config($config_name, $config_value, $is_dynamic); - } - - /** - * Config Update - * - * This function allows you to update an existing config setting. - * - * @param string $config_name The name of the config setting you would like to update - * @param mixed $config_value The value of the config setting - * @param bool $is_dynamic True if it is dynamic (changes very often) and should not be stored in the cache, false if not. - * - * @return result - */ - function config_update($config_name, $config_value = '') - { - if (!$this->config_exists($config_name)) - { - return $this->umil_end('CONFIG_NOT_EXIST', $config_name); - } - - set_config($config_name, $config_value); - } - - /** - * Config Remove - * - * This function allows you to remove an existing config setting. - * - * @param string $config_name The name of the config setting you would like to remove - * - * @return result - */ - function config_remove($config_name) - { - if (!$this->config_exists($config_name)) - { - return $this->umil_end('CONFIG_NOT_EXIST', $config_name); - } - - $sql = 'DELETE FROM ' . CONFIG_TABLE . " - WHERE config_name = '" . $this->db->sql_escape($config_name) . "'"; - $this->db->sql_query($sql); - - unset($this->config[$config_name]); - $this->cache->destroy('config'); - } -}
\ No newline at end of file diff --git a/phpBB/includes/db/migrator.php b/phpBB/includes/db/migrator.php index 912a7b34ba..9f94273c63 100644 --- a/phpBB/includes/db/migrator.php +++ b/phpBB/includes/db/migrator.php @@ -45,10 +45,10 @@ class phpbb_db_migrator * @param string $phpbb_root_path * @param string $php_ext */ - function phpbb_db_migrator(&$db, &$db_tools, $table_prefix, $migrations_table, $phpbb_root_path, $php_ext) + function phpbb_db_migrator($db, $db_tools, $table_prefix, $migrations_table, $phpbb_root_path, $php_ext) { - $this->db = &$db; - $this->db_tools = &$db_tools; + $this->db = $db; + $this->db_tools = $db_tools; $this->table_prefix = $table_prefix; $this->migrations_table = $migrations_table; $this->migrations = array(); @@ -131,7 +131,7 @@ class phpbb_db_migrator return false; } - $migration =& new $name($this->db, $this->db_tools, $this->table_prefix, $this->phpbb_root_path, $this->php_ext); + $migration = new $name($this->db, $this->db_tools, $this->table_prefix, $this->phpbb_root_path, $this->php_ext); $state = (isset($this->migration_state[$name])) ? $this->migration_state[$name] : array( @@ -182,7 +182,7 @@ class phpbb_db_migrator return true; } - function process_data_step(&$migration) + function process_data_step($migration) { $continue = false; $steps = $migration->update_data(); @@ -199,7 +199,7 @@ class phpbb_db_migrator return $continue; } - function run_step(&$step) + function run_step($step) { } @@ -234,7 +234,7 @@ class phpbb_db_migrator return true; } - $migration =& new $name($this->db, $this->db_tools, $this->table_prefix, $this->phpbb_root_path, $this->php_ext); + $migration = new $name($this->db, $this->db_tools, $this->table_prefix, $this->phpbb_root_path, $this->php_ext); $depends = $migration->depends_on(); foreach ($depends as $depend) |