From a7f61b91b7feec80cd9d544502aef937f036ae7c Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 31 Mar 2012 20:45:58 +0200 Subject: [feature/dic] Use DIC in download/file and install/index PHPBB3-10739 --- phpBB/install/index.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 13ab30a9fa..36c10c3ca6 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -79,19 +79,27 @@ include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); require($phpbb_root_path . 'includes/functions_install.' . $phpEx); -$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".$phpEx"); +$container = new ContainerBuilder(); +$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../config')); +$loader->load('parameters.yml'); +$loader->load('services.yml'); + +$container->setParameter('core.root_path', $phpbb_root_path); +$container->setParameter('core.php_ext', $phpEx); +$container->setAlias('cache.driver.install', 'cache.driver'); + +$phpbb_class_loader_ext = $container->get('class_loader.ext'); $phpbb_class_loader_ext->register(); -$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".$phpEx"); +$phpbb_class_loader = $container->get('class_loader'); $phpbb_class_loader->register(); // set up caching -$cache_factory = new phpbb_cache_factory('file'); -$cache = $cache_factory->get_service(); -$phpbb_class_loader_ext->set_cache($cache->get_driver()); -$phpbb_class_loader->set_cache($cache->get_driver()); +$cache = $container->get('cache'); +$phpbb_class_loader_ext->set_cache($container->get('cache.driver')); +$phpbb_class_loader->set_cache($container->get('cache.driver')); -$phpbb_dispatcher = new phpbb_event_dispatcher(); -$request = new phpbb_request(); +$phpbb_dispatcher = $container->get('dispatcher'); +$request = $container->get('request'); // make sure request_var uses this request instance request_var('', 0, false, false, $request); // "dependency injection" for a function -- cgit v1.2.1 From dc9ccc432cd0b24cf762f8285d8a90f52b8efe5b Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 31 Mar 2012 21:20:58 +0200 Subject: [feature/dic] Make use of calls to cut down on boilerplate PHPBB3-10739 --- phpBB/install/index.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 36c10c3ca6..0d7a0a288c 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -88,15 +88,11 @@ $container->setParameter('core.root_path', $phpbb_root_path); $container->setParameter('core.php_ext', $phpEx); $container->setAlias('cache.driver.install', 'cache.driver'); -$phpbb_class_loader_ext = $container->get('class_loader.ext'); -$phpbb_class_loader_ext->register(); $phpbb_class_loader = $container->get('class_loader'); -$phpbb_class_loader->register(); +$phpbb_class_loader_ext = $container->get('class_loader.ext'); // set up caching $cache = $container->get('cache'); -$phpbb_class_loader_ext->set_cache($container->get('cache.driver')); -$phpbb_class_loader->set_cache($container->get('cache.driver')); $phpbb_dispatcher = $container->get('dispatcher'); $request = $container->get('request'); -- cgit v1.2.1 From 2e76620c8824da62f97cfdaee8f9b1014159fd7c Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 9 Apr 2012 00:22:55 +0200 Subject: [feature/dic] Rewrite cron system to use DIC PHPBB3-10739 --- phpBB/install/index.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 0d7a0a288c..dd84e2d519 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -79,23 +79,24 @@ include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); require($phpbb_root_path . 'includes/functions_install.' . $phpEx); -$container = new ContainerBuilder(); -$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../config')); +$phpbb_container = new ContainerBuilder(); +$loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/../config')); $loader->load('parameters.yml'); $loader->load('services.yml'); -$container->setParameter('core.root_path', $phpbb_root_path); -$container->setParameter('core.php_ext', $phpEx); -$container->setAlias('cache.driver.install', 'cache.driver'); +$phpbb_container->setParameter('core.root_path', $phpbb_root_path); +$phpbb_container->setParameter('core.php_ext', $phpEx); +$phpbb_container->setAlias('cache.driver.install', 'cache.driver'); +$phpbb_container->set('container', $phpbb_container); -$phpbb_class_loader = $container->get('class_loader'); -$phpbb_class_loader_ext = $container->get('class_loader.ext'); +$phpbb_class_loader = $phpbb_container->get('class_loader'); +$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext'); // set up caching -$cache = $container->get('cache'); +$cache = $phpbb_container->get('cache'); -$phpbb_dispatcher = $container->get('dispatcher'); -$request = $container->get('request'); +$phpbb_dispatcher = $phpbb_container->get('dispatcher'); +$request = $phpbb_container->get('request'); // make sure request_var uses this request instance request_var('', 0, false, false, $request); // "dependency injection" for a function -- cgit v1.2.1 From f3e5acf3776083ec39052a3b8bf179638703d47e Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Thu, 26 Apr 2012 10:37:37 +0100 Subject: [ticket/10845] Changed the report system. Now it saves posts with the bbcode Now the bitfield and uid of the bbcode is saved in the reports table. This will allow parsing the BBCode while loading the post to show PHPBB3-10845 --- phpBB/install/schemas/firebird_schema.sql | 4 +++- phpBB/install/schemas/mssql_schema.sql | 4 +++- phpBB/install/schemas/mysql_40_schema.sql | 2 ++ phpBB/install/schemas/mysql_41_schema.sql | 2 ++ phpBB/install/schemas/oracle_schema.sql | 2 ++ phpBB/install/schemas/postgres_schema.sql | 2 ++ phpBB/install/schemas/sqlite_schema.sql | 4 +++- 7 files changed, 17 insertions(+), 3 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 51565ef2d4..de8d05c1a3 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -910,7 +910,9 @@ CREATE TABLE phpbb_reports ( report_closed INTEGER DEFAULT 0 NOT NULL, report_time INTEGER DEFAULT 0 NOT NULL, report_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, - reported_post_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL + reported_post_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL, + reported_post_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, + reported_post_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL );; ALTER TABLE phpbb_reports ADD PRIMARY KEY (report_id);; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 2c78dd009f..a9ddda646e 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -1109,7 +1109,9 @@ CREATE TABLE [phpbb_reports] ( [report_closed] [int] DEFAULT (0) NOT NULL , [report_time] [int] DEFAULT (0) NOT NULL , [report_text] [text] DEFAULT ('') NOT NULL , - [reported_post_text] [text] DEFAULT ('') NOT NULL + [reported_post_text] [text] DEFAULT ('') NOT NULL , + [reported_post_bitfield] [varchar] (255) DEFAULT ('') NOT NULL , + [reported_post_uid] [varchar] (8) DEFAULT ('') NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index d19f1930d0..0e4db1597d 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -648,6 +648,8 @@ CREATE TABLE phpbb_reports ( report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, report_text mediumblob NOT NULL, reported_post_text mediumblob NOT NULL, + reported_post_bitfield varbinary(255) DEFAULT '' NOT NULL, + reported_post_uid varbinary(8) DEFAULT '' NOT NULL, PRIMARY KEY (report_id), KEY post_id (post_id), KEY pm_id (pm_id) diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 3fd8d4f1d1..606a77c6d8 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -648,6 +648,8 @@ CREATE TABLE phpbb_reports ( report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, report_text mediumtext NOT NULL, reported_post_text mediumtext NOT NULL, + reported_post_bitfield varchar(255) DEFAULT '' NOT NULL, + reported_post_uid varchar(8) DEFAULT '' NOT NULL, PRIMARY KEY (report_id), KEY post_id (post_id), KEY pm_id (pm_id) diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 8a0f3e56b1..892db76519 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1215,6 +1215,8 @@ CREATE TABLE phpbb_reports ( report_time number(11) DEFAULT '0' NOT NULL, report_text clob DEFAULT '' , reported_post_text clob DEFAULT '' , + reported_post_bitfield varchar2(255) DEFAULT '' , + reported_post_uid varchar2(8) DEFAULT '' , CONSTRAINT pk_phpbb_reports PRIMARY KEY (report_id) ) / diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index c624024362..bb381b75fa 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -854,6 +854,8 @@ CREATE TABLE phpbb_reports ( report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0), report_text TEXT DEFAULT '' NOT NULL, reported_post_text TEXT DEFAULT '' NOT NULL, + reported_post_bitfield varchar(255) DEFAULT '' NOT NULL, + reported_post_uid varchar(8) DEFAULT '' NOT NULL, PRIMARY KEY (report_id) ); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index bd002c93ed..de9da85a77 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -628,7 +628,9 @@ CREATE TABLE phpbb_reports ( report_closed INTEGER UNSIGNED NOT NULL DEFAULT '0', report_time INTEGER UNSIGNED NOT NULL DEFAULT '0', report_text mediumtext(16777215) NOT NULL DEFAULT '', - reported_post_text mediumtext(16777215) NOT NULL DEFAULT '' + reported_post_text mediumtext(16777215) NOT NULL DEFAULT '', + reported_post_bitfield varchar(255) NOT NULL DEFAULT '', + reported_post_uid varchar(8) NOT NULL DEFAULT '' ); CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); -- cgit v1.2.1 From 6069d9a3d7479f1fe0e7e7072aee0f3ea394519b Mon Sep 17 00:00:00 2001 From: Bruno Ais Date: Sun, 6 May 2012 15:28:55 +0100 Subject: [ticket/10845] Two of the three colouns were missing in the DB update file Added the two colouns that were missing in the DB update file PHPBB3-10845 --- phpBB/install/database_update.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index a0892005d2..3c4a7f7027 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1102,7 +1102,9 @@ function database_update_info() 'style_parent_tree' => array('TEXT', ''), ), REPORTS_TABLE => array( - 'reported_post_text' => array('MTEXT_UNI', ''), + 'reported_post_text' => array('MTEXT_UNI', ''), + 'reported_post_uid' => array('VCHAR:8', ''), + 'reported_post_bitfield' => array('VCHAR:255', ''), ), ), 'change_columns' => array( -- cgit v1.2.1 From 32d2ee61f78e3aeaac5f4f1bcb672c67aa10b10e Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 21 Jul 2012 16:14:21 +0200 Subject: [feature/dic] Configure container via config.php, use compiler pass PHPBB3-10739 --- phpBB/install/index.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 88745b8bb9..3e14b719e8 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -7,6 +7,11 @@ * */ +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\Compiler\Compiler; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; + /**#@+ * @ignore */ @@ -71,6 +76,8 @@ else // Include essential scripts require($phpbb_root_path . 'includes/class_loader.' . $phpEx); +require($phpbb_root_path . 'includes/di/compiler/config_pass.' . $phpEx); + require($phpbb_root_path . 'includes/functions.' . $phpEx); phpbb_require_updated('includes/functions_content.' . $phpEx, true); @@ -81,13 +88,13 @@ require($phpbb_root_path . 'includes/functions_install.' . $phpEx); $phpbb_container = new ContainerBuilder(); $loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/../config')); -$loader->load('parameters.yml'); $loader->load('services.yml'); -$phpbb_container->setParameter('core.root_path', $phpbb_root_path); -$phpbb_container->setParameter('core.php_ext', $phpEx); +$phpbb_compiler = new Compiler(); +$phpbb_compiler->addPass(new phpbb_di_compiler_config_pass($phpbb_root_path . 'config.' . $phpEx, $phpbb_root_path, $phpEx)); +$phpbb_compiler->compile($phpbb_container); + $phpbb_container->setAlias('cache.driver.install', 'cache.driver'); -$phpbb_container->set('container', $phpbb_container); $phpbb_class_loader = $phpbb_container->get('class_loader'); $phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext'); -- cgit v1.2.1 From 967cc550ed9bb74480f46212768502627f26d62d Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 21 Jul 2012 20:42:07 +0200 Subject: [feature/dic] Introduce DI processors instead of abusing compiler passes PHPBB3-10739 --- phpBB/install/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 3e14b719e8..0e298c8cdc 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -76,7 +76,8 @@ else // Include essential scripts require($phpbb_root_path . 'includes/class_loader.' . $phpEx); -require($phpbb_root_path . 'includes/di/compiler/config_pass.' . $phpEx); +require($phpbb_root_path . 'includes/di/processor/interface.' . $phpEx); +require($phpbb_root_path . 'includes/di/processor/config.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); @@ -90,9 +91,8 @@ $phpbb_container = new ContainerBuilder(); $loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/../config')); $loader->load('services.yml'); -$phpbb_compiler = new Compiler(); -$phpbb_compiler->addPass(new phpbb_di_compiler_config_pass($phpbb_root_path . 'config.' . $phpEx, $phpbb_root_path, $phpEx)); -$phpbb_compiler->compile($phpbb_container); +$processor = new phpbb_di_processor_config($phpbb_root_path . 'config.' . $phpEx, $phpbb_root_path, $phpEx); +$processor->process($phpbb_container); $phpbb_container->setAlias('cache.driver.install', 'cache.driver'); -- cgit v1.2.1 From 50bc453aa6c91ae9c9df5cb633615825c9df7b6d Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 21 Jul 2012 21:02:55 +0200 Subject: [feature/dic] Load services from extensions PHPBB3-10739 --- phpBB/install/index.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'phpBB/install') diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 0e298c8cdc..1ba0798abc 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -8,7 +8,6 @@ */ use Symfony\Component\Config\FileLocator; -use Symfony\Component\DependencyInjection\Compiler\Compiler; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; @@ -99,6 +98,12 @@ $phpbb_container->setAlias('cache.driver.install', 'cache.driver'); $phpbb_class_loader = $phpbb_container->get('class_loader'); $phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext'); +$ids = array_keys($phpbb_container->findTaggedServiceIds('container.processor')); +foreach ($ids as $id) { + $processor = $phpbb_container->get($id); + $processor->process($phpbb_container); +} + // set up caching $cache = $phpbb_container->get('cache'); -- cgit v1.2.1 From a5dd64195a3a88db3fec38ac74dfb5d118ab5622 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sun, 22 Jul 2012 22:26:38 -0500 Subject: [ticket/11021] Add the option to specify a Site home URL and text PHPBB3-11021 --- phpBB/install/database_update.php | 6 ++++++ phpBB/install/schemas/schema_data.sql | 2 ++ 2 files changed, 8 insertions(+) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 6e99fd56a0..18efee72b5 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2637,6 +2637,12 @@ function change_database_data(&$no_updates, $version) // After we have calculated the timezones we can delete user_dst column from user table. $db_tools->sql_column_remove(USERS_TABLE, 'user_dst'); } + + if (!isset($config['site_home_url'])) + { + $config->set('site_home_url', ''); + $config->set('site_home_text', ''); + } break; } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 0bb1858c11..6b95d81713 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -240,6 +240,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_protocol', INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_gc', '3600'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_length', '3600'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('site_desc', '{L_CONFIG_SITE_DESC}'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('site_home_url', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('site_home_text', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('sitename', '{L_CONFIG_SITENAME}'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_path', 'images/smilies'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_per_page', '50'); -- cgit v1.2.1 From ed34451d5b84f2e34004f2ddbceb6b0ca5cae025 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 26 Jul 2012 17:01:55 +0200 Subject: [feature/dic] Adjust installer script to work with partially configured container PHPBB3-10739 --- phpBB/install/index.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 1ba0798abc..3c1d60f554 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -90,20 +90,14 @@ $phpbb_container = new ContainerBuilder(); $loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/../config')); $loader->load('services.yml'); -$processor = new phpbb_di_processor_config($phpbb_root_path . 'config.' . $phpEx, $phpbb_root_path, $phpEx); -$processor->process($phpbb_container); +$phpbb_container->setParameter('core.root_path', $phpbb_root_path); +$phpbb_container->setParameter('core.php_ext', $phpEx); -$phpbb_container->setAlias('cache.driver.install', 'cache.driver'); +$phpbb_container->setAlias('cache.driver', 'cache.driver.install'); $phpbb_class_loader = $phpbb_container->get('class_loader'); $phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext'); -$ids = array_keys($phpbb_container->findTaggedServiceIds('container.processor')); -foreach ($ids as $id) { - $processor = $phpbb_container->get($id); - $processor->process($phpbb_container); -} - // set up caching $cache = $phpbb_container->get('cache'); -- cgit v1.2.1 From 5e6b4c7192a80dc29382ad06976e9ce6d5c16efd Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Wed, 29 Feb 2012 21:23:50 +0000 Subject: [ticket/10631] Adding an extensions admin PHPBB3-10631 --- phpBB/install/schemas/schema_data.sql | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/install') diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index ea7864bd4c..ae7b9fcba3 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -345,6 +345,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_board', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_bots', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_clearlogs', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_email', 1); +INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_extensions', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_fauth', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_forum', 1); INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_forumadd', 1); -- cgit v1.2.1 From 8bbab088dd5830d8dd1151a3684dde5c197ba268 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 23 Jul 2012 15:17:42 -0500 Subject: [ticket/10631] Validation for extensions PHPBB3-10631 --- phpBB/install/database_update.php | 4 ++-- phpBB/install/install_install.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 502b3bb1a4..0b470ced26 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -683,12 +683,12 @@ function _write_result($no_updates, $errored, $error_ary) function _add_modules($modules_to_install) { - global $phpbb_root_path, $phpEx, $db, $phpbb_extension_manager; + global $phpbb_root_path, $phpEx, $db, $phpbb_extension_manager, $config; // modules require an extension manager if (empty($phpbb_extension_manager)) { - $phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx"); + $phpbb_extension_manager = new phpbb_extension_manager($db, $config, EXT_TABLE, $phpbb_root_path, ".$phpEx"); } include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx); diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 23593ee51f..9162d5ab60 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -250,7 +250,7 @@ class install_install extends module 'S_EXPLAIN' => true, 'S_LEGEND' => false, )); - + // Check for php json support if (@extension_loaded('json')) { @@ -1481,12 +1481,12 @@ class install_install extends module */ function add_modules($mode, $sub) { - global $db, $lang, $phpbb_root_path, $phpEx, $phpbb_extension_manager; + global $db, $lang, $phpbb_root_path, $phpEx, $phpbb_extension_manager, $config; // modules require an extension manager if (empty($phpbb_extension_manager)) { - $phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx"); + $phpbb_extension_manager = new phpbb_extension_manager($db, $config, EXT_TABLE, $phpbb_root_path, ".$phpEx"); } include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx); -- cgit v1.2.1 From b3cd5a649be62f175de651a16ae02c5f709ca2f4 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 3 Sep 2012 13:32:33 -0500 Subject: [ticket/8713] Do not trim login inputs Create a function to request variables which are not trimmed. All requests for passwords (except forum passwords) now use the untrimmed request function. PHPBB3-8713 --- phpBB/install/install_update.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 88b00f1cf1..4b5a23e497 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -862,7 +862,7 @@ class install_update extends module $test_connection = false; if ($test_ftp_connection || $submit) { - $transfer = new $method(request_var('host', ''), request_var('username', ''), request_var('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', '')); + $transfer = new $method(request_var('host', ''), request_var('username', ''), $request->untrimed_variable('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', '')); $test_connection = $transfer->open_session(); // Make sure that the directory is correct by checking for the existence of common.php @@ -948,7 +948,7 @@ class install_update extends module } else { - $transfer = new $method(request_var('host', ''), request_var('username', ''), request_var('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', '')); + $transfer = new $method(request_var('host', ''), request_var('username', ''), $request->untrimed_variable('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', '')); $transfer->open_session(); } -- cgit v1.2.1 From f2607fc9e80c6f9ad7543b7be5ea6f294aa6c40a Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 8 Sep 2012 14:15:56 +0200 Subject: [ticket/8713] Rename untrimed_variable() to untrimmed_variable(). PHPBB3-8713 --- phpBB/install/install_update.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 4b5a23e497..1ecedecce6 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -862,7 +862,7 @@ class install_update extends module $test_connection = false; if ($test_ftp_connection || $submit) { - $transfer = new $method(request_var('host', ''), request_var('username', ''), $request->untrimed_variable('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', '')); + $transfer = new $method(request_var('host', ''), request_var('username', ''), $request->untrimmed_variable('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', '')); $test_connection = $transfer->open_session(); // Make sure that the directory is correct by checking for the existence of common.php @@ -948,7 +948,7 @@ class install_update extends module } else { - $transfer = new $method(request_var('host', ''), request_var('username', ''), $request->untrimed_variable('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', '')); + $transfer = new $method(request_var('host', ''), request_var('username', ''), $request->untrimmed_variable('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', '')); $transfer->open_session(); } -- cgit v1.2.1 From cc0c378caf9bfc480391a9d11d5a4d78c0df097c Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 8 Sep 2012 14:40:35 +0200 Subject: [ticket/8713] Call htmlspecialchars_decode() on transfer (e.g. ftp) passwords. PHPBB3-8713 --- phpBB/install/install_update.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 1ecedecce6..8c044550f3 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -862,7 +862,14 @@ class install_update extends module $test_connection = false; if ($test_ftp_connection || $submit) { - $transfer = new $method(request_var('host', ''), request_var('username', ''), $request->untrimmed_variable('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', '')); + $transfer = new $method( + request_var('host', ''), + request_var('username', ''), + htmlspecialchars_decode($request->untrimmed_variable('password', '')), + request_var('root_path', ''), + request_var('port', ''), + request_var('timeout', '') + ); $test_connection = $transfer->open_session(); // Make sure that the directory is correct by checking for the existence of common.php @@ -948,7 +955,14 @@ class install_update extends module } else { - $transfer = new $method(request_var('host', ''), request_var('username', ''), $request->untrimmed_variable('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', '')); + $transfer = new $method( + request_var('host', ''), + request_var('username', ''), + htmlspecialchars_decode($request->untrimmed_variable('password', '')), + request_var('root_path', ''), + request_var('port', ''), + request_var('timeout', '') + ); $transfer->open_session(); } -- cgit v1.2.1 From 503989979a2e6a7fb9d64ed249b09a0bef2b2f95 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 13 Sep 2012 16:44:26 -0400 Subject: [ticket/11086] Fix database_update.php to use Dependency Injection Container PHPBB3-11086 --- phpBB/install/database_update.php | 47 ++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 13 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 0b470ced26..323ba0c876 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -7,6 +7,10 @@ * */ +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; + define('UPDATES_TO_VERSION', '3.1.0-dev'); // Enter any version to update from to test updates. The version within the db will not be updated. @@ -107,21 +111,38 @@ if (!defined('EXT_TABLE')) define('EXT_TABLE', $table_prefix . 'ext'); } -$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".$phpEx"); -$phpbb_class_loader_ext->register(); -$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".$phpEx"); -$phpbb_class_loader->register(); +$phpbb_container = new ContainerBuilder(); +$loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/../config')); +$loader->load('services.yml'); + +// We must include the DI processor class files because the class loader +// is not yet set up +require($phpbb_root_path . 'includes/di/processor/interface.' . $phpEx); +require($phpbb_root_path . 'includes/di/processor/config.' . $phpEx); + +$processor = new phpbb_di_processor_config($phpbb_root_path . 'config.' . $phpEx, $phpbb_root_path, $phpEx); +$processor->process($phpbb_container); + +// Setup class loader first +$phpbb_class_loader = $phpbb_container->get('class_loader'); +$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext'); + +$ids = array_keys($phpbb_container->findTaggedServiceIds('container.processor')); +foreach ($ids as $id) +{ + $processor = $phpbb_container->get($id); + $processor->process($phpbb_container); +} // set up caching -$cache_factory = new phpbb_cache_factory($acm_type); -$cache = $cache_factory->get_service(); -$phpbb_class_loader_ext->set_cache($cache->get_driver()); -$phpbb_class_loader->set_cache($cache->get_driver()); - -$phpbb_dispatcher = new phpbb_event_dispatcher(); -$request = new phpbb_request(); -$user = new phpbb_user(); -$db = new $sql_db(); +$cache = $phpbb_container->get('cache'); + +// Instantiate some basic classes +$phpbb_dispatcher = $phpbb_container->get('dispatcher'); +$request = $phpbb_container->get('request'); +$user = $phpbb_container->get('user'); +$auth = $phpbb_container->get('auth'); +$db = $phpbb_container->get('dbal.conn'); // make sure request_var uses this request instance request_var('', 0, false, false, $request); // "dependency injection" for a function -- cgit v1.2.1 From 298fa894e7ea0807a295cd0ed55cabef8a27a3f3 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 13 Sep 2012 16:56:09 -0400 Subject: [ticket/11086] Move DI processing below $request definition As per PR #991 (ticket/11101). PHPBB3-11086 --- phpBB/install/database_update.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 323ba0c876..5fa6166913 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -119,7 +119,6 @@ $loader->load('services.yml'); // is not yet set up require($phpbb_root_path . 'includes/di/processor/interface.' . $phpEx); require($phpbb_root_path . 'includes/di/processor/config.' . $phpEx); - $processor = new phpbb_di_processor_config($phpbb_root_path . 'config.' . $phpEx, $phpbb_root_path, $phpEx); $processor->process($phpbb_container); @@ -127,13 +126,6 @@ $processor->process($phpbb_container); $phpbb_class_loader = $phpbb_container->get('class_loader'); $phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext'); -$ids = array_keys($phpbb_container->findTaggedServiceIds('container.processor')); -foreach ($ids as $id) -{ - $processor = $phpbb_container->get($id); - $processor->process($phpbb_container); -} - // set up caching $cache = $phpbb_container->get('cache'); @@ -144,6 +136,13 @@ $user = $phpbb_container->get('user'); $auth = $phpbb_container->get('auth'); $db = $phpbb_container->get('dbal.conn'); +$ids = array_keys($phpbb_container->findTaggedServiceIds('container.processor')); +foreach ($ids as $id) +{ + $processor = $phpbb_container->get($id); + $processor->process($phpbb_container); +} + // make sure request_var uses this request instance request_var('', 0, false, false, $request); // "dependency injection" for a function -- cgit v1.2.1 From 95d02d74ac6d71578a98e8850140d9a6cad7e852 Mon Sep 17 00:00:00 2001 From: Vinny Date: Fri, 5 Oct 2012 21:18:59 -0300 Subject: [ticket/11135] Full replacement of credit link to https PHPBB3-11135 --- phpBB/install/convertors/convert_phpbb20.php | 2 +- phpBB/install/database_update.php | 2 +- phpBB/install/index.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 7d6fed6164..960cc5b335 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -33,7 +33,7 @@ $convertor_data = array( 'forum_name' => 'phpBB 2.0.x', 'version' => '1.0.3', 'phpbb_version' => '3.0.11', - 'author' => 'phpBB Group', + 'author' => 'phpBB Group', 'dbms' => $dbms, 'dbhost' => $dbhost, 'dbport' => $dbport, diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 5a186d0eeb..40837145ba 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -527,7 +527,7 @@ function _print_footer() diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 5135e2dbd8..ad46e273c2 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -569,7 +569,7 @@ class module echo ' '; echo ' '; echo ' '; echo ''; echo ''; -- cgit v1.2.1 From 5f5d395c625fe0257e7bca5d787424808f7649cc Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Mon, 29 Oct 2012 13:58:24 -0400 Subject: [ticket/11158] Require acl_u_sig for ucp signature module. PHPBB3-11158 --- phpBB/install/database_update.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 40837145ba..099ab6aeb5 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1005,6 +1005,8 @@ function database_update_info() ), // No changes from 3.0.11-RC2 to 3.0.11 '3.0.11-RC2' => array(), + // No changes from 3.0.11 to 3.0.12-RC1 + '3.0.11' => array(), /** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.12-RC1 */ ); @@ -2108,6 +2110,16 @@ function change_database_data(&$no_updates, $version) // No changes from 3.0.11-RC2 to 3.0.11 case '3.0.11-RC2': break; + + // Changes from 3.0.11 to 3.0.12-RC1 + case '3.0.11': + $sql = 'UPDATE ' . MODULES_TABLE . ' + SET module_auth = \'acl_u_sig\' + WHERE module_class = \'ucp\' + AND module_basename = \'profile\' + AND module_mode = \'signature\''; + _sql($sql, $errored, $error_ary); + break; } } -- cgit v1.2.1 From 767d09227bd848da21dc3e255b1dacd20cbad1f7 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Fri, 2 Nov 2012 18:51:35 -0400 Subject: [ticket/10933] Dependency inject template context. PHPBB3-10933 --- phpBB/install/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/install') diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 4f1fbee7ad..f71e5ada54 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -213,7 +213,7 @@ $config = new phpbb_config(array( $phpbb_style_resource_locator = new phpbb_style_resource_locator(); $phpbb_style_path_provider = new phpbb_style_path_provider(); -$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator); +$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, new phpbb_template_context()); $phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template); $phpbb_style->set_ext_dir_prefix('adm/'); $phpbb_style->set_custom_style('admin', '../adm/style', ''); -- cgit v1.2.1 From 399662d2afa58dfd631128e3eac033d90464f794 Mon Sep 17 00:00:00 2001 From: Carlo Date: Tue, 28 Aug 2012 09:56:59 +0200 Subject: [ticket/10897] Bot list updated 'Baidu [Spider]' updated. 'Bing [Bot]' fixed only identation. 'Exabot [Bot]' changed because there is used also 'Exabot-Thumbnails' user agent. 'NG-Search [Bot]' no longer exists. 'Nutch/CVS [Bot]' is the same of 'Nutch [Bot]'. 'OmniExplorer [Bot]' no longer exists. 'Seekport [Bot]' no longer exists. 'Synoo [Bot]' no longer exists. 'Voyager [Bot]' updated. 'W3C [Validator]' corrected (there was a *). 'WiseNut [Bot]' no longer exists. PHPBB3-10897 --- phpBB/install/install_install.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index f1003b07d7..67ebb8b1c5 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -2103,9 +2103,9 @@ class install_install extends module 'Alexa [Bot]' => array('ia_archiver', ''), 'Alta Vista [Bot]' => array('Scooter/', ''), 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''), - 'Baidu [Spider]' => array('Baiduspider+(', ''), - 'Bing [Bot]' => array('bingbot/', ''), - 'Exabot [Bot]' => array('Exabot/', ''), + 'Baidu [Spider]' => array('Baiduspider', ''), + 'Bing [Bot]' => array('bingbot/', ''), + 'Exabot [Bot]' => array('Exabot', ''), 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''), 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''), 'Francis [Bot]' => array('http://www.neomo.de/', ''), @@ -2124,27 +2124,21 @@ class install_install extends module 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''), 'MSN [Bot]' => array('msnbot/', ''), 'MSNbot Media' => array('msnbot-media/', ''), - 'NG-Search [Bot]' => array('NG-Search/', ''), 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''), - 'Nutch/CVS [Bot]' => array('NutchCVS/', ''), - 'OmniExplorer [Bot]' => array('OmniExplorer_Bot/', ''), 'Online link [Validator]' => array('online link validator', ''), 'psbot [Picsearch]' => array('psbot/0', ''), - 'Seekport [Bot]' => array('Seekbot/', ''), 'Sensis [Crawler]' => array('Sensis Web Crawler', ''), 'SEO Crawler' => array('SEO search Crawler/', ''), 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''), 'SEOSearch [Crawler]' => array('SEOsearch/', ''), 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''), 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''), - 'Synoo [Bot]' => array('SynooBot/', ''), 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''), 'TurnitinBot [Bot]' => array('TurnitinBot/', ''), - 'Voyager [Bot]' => array('voyager/1.0', ''), + 'Voyager [Bot]' => array('voyager/', ''), 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''), 'W3C [Linkcheck]' => array('W3C-checklink/', ''), - 'W3C [Validator]' => array('W3C_*Validator', ''), - 'WiseNut [Bot]' => array('http://www.WISEnutbot.com', ''), + 'W3C [Validator]' => array('W3C_Validator', ''), 'YaCy [Bot]' => array('yacybot', ''), 'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''), 'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''), -- cgit v1.2.1 From 53e9bab237470e827243fcf3743eb7ca3d9ee346 Mon Sep 17 00:00:00 2001 From: Carlo Date: Tue, 28 Aug 2012 10:02:27 +0200 Subject: [ticket/10897] Update bots during phpBB update PHPBB3-10897 --- phpBB/install/database_update.php | 70 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 099ab6aeb5..0343e0dc86 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2119,6 +2119,76 @@ function change_database_data(&$no_updates, $version) AND module_basename = \'profile\' AND module_mode = \'signature\''; _sql($sql, $errored, $error_ary); + + $bots_to_update = array( + 'Baidu [Spider]' => array('Baiduspider', ''), + 'Exabot [Bot]' => array('Exabot', ''), + 'Voyager [Bot]' => array('voyager/', ''), + 'W3C [Validator]' => array('W3C_Validator', ''), + ); + + $bots_to_delete = array( + 'NG-Search [Bot]', + 'Nutch/CVS [Bot]', + 'OmniExplorer [Bot]', + 'Seekport [Bot]', + 'Synoo [Bot]', + 'WiseNut [Bot]', + ); + + foreach($bots_to_update as $bot_name => $bot_array) + { + list($bot_agent, $bot_ip) = $bot_array; + + $bot_name_clean = utf8_clean_string($bot_name); + + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $db->sql_escape($bot_name_clean) . "'"; + $result = $db->sql_query($sql); + $is_user = (bool) $db->sql_fetchfield('user_id'); + $db->sql_freeresult($result); + + if ($is_user) + { + $sql = 'UPDATE ' . BOTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( + 'bot_agent' => (string) $bot_agent, + 'bot_ip' => (string) $bot_ip, + )) . " WHERE bot_name = '" . $db->sql_escape($bot_name) . "'"; + + _sql($sql, $errored, $error_ary); + } + } + + if (!function_exists('user_delete')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + foreach($bots_to_delete as $bot_name) + { + $bot_name_clean = utf8_clean_string($bot_name); + + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $db->sql_escape($bot_name_clean) . "'"; + $result = $db->sql_query($sql); + $bot_user_id = $db->sql_fetchfield('user_id'); + $is_user = (bool) $bot_user_id; + $db->sql_freeresult($result); + + if ($is_user) + { + $sql = 'DELETE FROM ' . BOTS_TABLE . " + WHERE bot_name = '" . $db->sql_escape($bot_name) . "'"; + + _sql($sql, $errored, $error_ary); + + user_delete('remove', $bot_user_id); + } + } + + $no_updates = false; break; } } -- cgit v1.2.1 From 07e7c475d510a221c9080529647ec432cca038c6 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 9 Nov 2012 12:12:12 +0100 Subject: [ticket/10897] Add space after foreach. PHPBB3-10897 --- phpBB/install/database_update.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 0343e0dc86..4c94cdf5bd 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2136,7 +2136,7 @@ function change_database_data(&$no_updates, $version) 'WiseNut [Bot]', ); - foreach($bots_to_update as $bot_name => $bot_array) + foreach ($bots_to_update as $bot_name => $bot_array) { list($bot_agent, $bot_ip) = $bot_array; @@ -2165,7 +2165,7 @@ function change_database_data(&$no_updates, $version) include($phpbb_root_path . 'includes/functions_user.' . $phpEx); } - foreach($bots_to_delete as $bot_name) + foreach ($bots_to_delete as $bot_name) { $bot_name_clean = utf8_clean_string($bot_name); -- cgit v1.2.1 From b2183c9b705dc5283f3a1c3abbc80331f74e4b72 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 9 Nov 2012 12:12:27 +0100 Subject: [ticket/10897] Remove unnecessary string casting. PHPBB3-10897 --- phpBB/install/database_update.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 4c94cdf5bd..bbb05e67ec 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2152,8 +2152,8 @@ function change_database_data(&$no_updates, $version) if ($is_user) { $sql = 'UPDATE ' . BOTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( - 'bot_agent' => (string) $bot_agent, - 'bot_ip' => (string) $bot_ip, + 'bot_agent' => $bot_agent, + 'bot_ip' => $bot_ip, )) . " WHERE bot_name = '" . $db->sql_escape($bot_name) . "'"; _sql($sql, $errored, $error_ary); -- cgit v1.2.1 From de6d741d96e57a704e7653e8c73a20b3c196a0d9 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 9 Nov 2012 12:19:18 +0100 Subject: [ticket/10897] Add comment about what's going on. PHPBB3-10897 --- phpBB/install/database_update.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index bbb05e67ec..c8675fa95a 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2120,6 +2120,7 @@ function change_database_data(&$no_updates, $version) AND module_mode = \'signature\''; _sql($sql, $errored, $error_ary); + // Update bot list $bots_to_update = array( 'Baidu [Spider]' => array('Baiduspider', ''), 'Exabot [Bot]' => array('Exabot', ''), -- cgit v1.2.1 From 935bc33268bb062158d6421242335483fcd955bd Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 9 Nov 2012 12:19:58 +0100 Subject: [ticket/10897] Move bot delete data to the relevant foreach loop. PHPBB3-10897 --- phpBB/install/database_update.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index c8675fa95a..0372b6e608 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2128,15 +2128,6 @@ function change_database_data(&$no_updates, $version) 'W3C [Validator]' => array('W3C_Validator', ''), ); - $bots_to_delete = array( - 'NG-Search [Bot]', - 'Nutch/CVS [Bot]', - 'OmniExplorer [Bot]', - 'Seekport [Bot]', - 'Synoo [Bot]', - 'WiseNut [Bot]', - ); - foreach ($bots_to_update as $bot_name => $bot_array) { list($bot_agent, $bot_ip) = $bot_array; @@ -2166,6 +2157,15 @@ function change_database_data(&$no_updates, $version) include($phpbb_root_path . 'includes/functions_user.' . $phpEx); } + $bots_to_delete = array( + 'NG-Search [Bot]', + 'Nutch/CVS [Bot]', + 'OmniExplorer [Bot]', + 'Seekport [Bot]', + 'Synoo [Bot]', + 'WiseNut [Bot]', + ); + foreach ($bots_to_delete as $bot_name) { $bot_name_clean = utf8_clean_string($bot_name); -- cgit v1.2.1 From 63c64694bc253358a50dce7dce99a7551b5e2b17 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 9 Nov 2012 12:41:59 +0100 Subject: [ticket/10897] Update by user_id instead of bot_name. PHPBB3-10897 --- phpBB/install/database_update.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 0372b6e608..6496069658 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2132,22 +2132,23 @@ function change_database_data(&$no_updates, $version) { list($bot_agent, $bot_ip) = $bot_array; - $bot_name_clean = utf8_clean_string($bot_name); - $sql = 'SELECT user_id FROM ' . USERS_TABLE . " - WHERE username_clean = '" . $db->sql_escape($bot_name_clean) . "'"; + WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($bot_name)) . "'"; $result = $db->sql_query($sql); - $is_user = (bool) $db->sql_fetchfield('user_id'); + $bot_user_id = (int) $db->sql_fetchfield('user_id'); $db->sql_freeresult($result); - if ($is_user) + if ($bot_user_id) { - $sql = 'UPDATE ' . BOTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( + $update_array = array( 'bot_agent' => $bot_agent, 'bot_ip' => $bot_ip, - )) . " WHERE bot_name = '" . $db->sql_escape($bot_name) . "'"; + ); + $sql = 'UPDATE ' . BOTS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $update_array) . " + WHERE user_id = $bot_user_id"; _sql($sql, $errored, $error_ary); } } -- cgit v1.2.1 From c054757f3caad66152eaafe09f2c98abcb9ef0e2 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 9 Nov 2012 12:45:20 +0100 Subject: [ticket/10897] Do not handle IP address. There is no need. PHPBB3-10897 --- phpBB/install/database_update.php | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 6496069658..154fc313a0 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2121,17 +2121,16 @@ function change_database_data(&$no_updates, $version) _sql($sql, $errored, $error_ary); // Update bot list + // Bot name to bot user agent map $bots_to_update = array( - 'Baidu [Spider]' => array('Baiduspider', ''), - 'Exabot [Bot]' => array('Exabot', ''), - 'Voyager [Bot]' => array('voyager/', ''), - 'W3C [Validator]' => array('W3C_Validator', ''), + 'Baidu [Spider]' => 'Baiduspider', + 'Exabot [Bot]' => 'Exabot', + 'Voyager [Bot]' => 'voyager/', + 'W3C [Validator]' => 'W3C_Validator', ); - foreach ($bots_to_update as $bot_name => $bot_array) + foreach ($bots_to_update as $bot_name => $bot_agent) { - list($bot_agent, $bot_ip) = $bot_array; - $sql = 'SELECT user_id FROM ' . USERS_TABLE . " WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($bot_name)) . "'"; @@ -2141,13 +2140,8 @@ function change_database_data(&$no_updates, $version) if ($bot_user_id) { - $update_array = array( - 'bot_agent' => $bot_agent, - 'bot_ip' => $bot_ip, - ); - $sql = 'UPDATE ' . BOTS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $update_array) . " + SET bot_agent = ' . $db->sql_escape($bot_agent) . " WHERE user_id = $bot_user_id"; _sql($sql, $errored, $error_ary); } -- cgit v1.2.1 From 520ffdf368bee84549a0b284bd2df4da1d633a8f Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 9 Nov 2012 12:47:50 +0100 Subject: [ticket/10897] Make sure the user we're fetching is a bot. PHPBB3-10897 --- phpBB/install/database_update.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 154fc313a0..bd12a90288 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2132,8 +2132,9 @@ function change_database_data(&$no_updates, $version) foreach ($bots_to_update as $bot_name => $bot_agent) { $sql = 'SELECT user_id - FROM ' . USERS_TABLE . " - WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($bot_name)) . "'"; + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_IGNORE . " + AND username_clean = '" . $db->sql_escape(utf8_clean_string($bot_name)) . "'"; $result = $db->sql_query($sql); $bot_user_id = (int) $db->sql_fetchfield('user_id'); $db->sql_freeresult($result); -- cgit v1.2.1 From 54700f5ba24fe944616e017c3c2ff9c09c312445 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 9 Nov 2012 12:53:33 +0100 Subject: [ticket/10897] Use same code/query for deleting. PHPBB3-10897 --- phpBB/install/database_update.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index bd12a90288..b8bf85e283 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2164,21 +2164,18 @@ function change_database_data(&$no_updates, $version) foreach ($bots_to_delete as $bot_name) { - $bot_name_clean = utf8_clean_string($bot_name); - $sql = 'SELECT user_id - FROM ' . USERS_TABLE . " - WHERE username_clean = '" . $db->sql_escape($bot_name_clean) . "'"; + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_IGNORE . " + AND username_clean = '" . $db->sql_escape(utf8_clean_string($bot_name)) . "'"; $result = $db->sql_query($sql); - $bot_user_id = $db->sql_fetchfield('user_id'); - $is_user = (bool) $bot_user_id; + $bot_user_id = (int) $db->sql_fetchfield('user_id'); $db->sql_freeresult($result); - if ($is_user) + if ($bot_user_id) { $sql = 'DELETE FROM ' . BOTS_TABLE . " - WHERE bot_name = '" . $db->sql_escape($bot_name) . "'"; - + WHERE user_id = $bot_user_id"; _sql($sql, $errored, $error_ary); user_delete('remove', $bot_user_id); -- cgit v1.2.1 From 60ea1c10ef0038fdb00fd38253d4b7407215e699 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 9 Nov 2012 12:59:05 +0100 Subject: [ticket/10897] Combine bot updates and bot delete. PHPBB3-10897 --- phpBB/install/database_update.php | 71 +++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 40 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index b8bf85e283..f7980ab1be 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2120,49 +2120,30 @@ function change_database_data(&$no_updates, $version) AND module_mode = \'signature\''; _sql($sql, $errored, $error_ary); - // Update bot list - // Bot name to bot user agent map - $bots_to_update = array( - 'Baidu [Spider]' => 'Baiduspider', - 'Exabot [Bot]' => 'Exabot', - 'Voyager [Bot]' => 'voyager/', - 'W3C [Validator]' => 'W3C_Validator', - ); - - foreach ($bots_to_update as $bot_name => $bot_agent) - { - $sql = 'SELECT user_id - FROM ' . USERS_TABLE . ' - WHERE user_type = ' . USER_IGNORE . " - AND username_clean = '" . $db->sql_escape(utf8_clean_string($bot_name)) . "'"; - $result = $db->sql_query($sql); - $bot_user_id = (int) $db->sql_fetchfield('user_id'); - $db->sql_freeresult($result); - - if ($bot_user_id) - { - $sql = 'UPDATE ' . BOTS_TABLE . ' - SET bot_agent = ' . $db->sql_escape($bot_agent) . " - WHERE user_id = $bot_user_id"; - _sql($sql, $errored, $error_ary); - } - } - + // Update bots if (!function_exists('user_delete')) { include($phpbb_root_path . 'includes/functions_user.' . $phpEx); } - $bots_to_delete = array( - 'NG-Search [Bot]', - 'Nutch/CVS [Bot]', - 'OmniExplorer [Bot]', - 'Seekport [Bot]', - 'Synoo [Bot]', - 'WiseNut [Bot]', + $bots_updates = array( + // Bot Deletions + 'NG-Search [Bot]' => false, + 'Nutch/CVS [Bot]' => false, + 'OmniExplorer [Bot]' => false, + 'Seekport [Bot]' => false, + 'Synoo [Bot]' => false, + 'WiseNut [Bot]' => false, + + // Bot Updates + // Bot name to bot user agent map + 'Baidu [Spider]' => 'Baiduspider', + 'Exabot [Bot]' => 'Exabot', + 'Voyager [Bot]' => 'voyager/', + 'W3C [Validator]' => 'W3C_Validator', ); - foreach ($bots_to_delete as $bot_name) + foreach ($bots_updates as $bot_name => $bot_agent) { $sql = 'SELECT user_id FROM ' . USERS_TABLE . ' @@ -2174,11 +2155,21 @@ function change_database_data(&$no_updates, $version) if ($bot_user_id) { - $sql = 'DELETE FROM ' . BOTS_TABLE . " - WHERE user_id = $bot_user_id"; - _sql($sql, $errored, $error_ary); + if ($bot_agent === false) + { + $sql = 'DELETE FROM ' . BOTS_TABLE . " + WHERE user_id = $bot_user_id"; + _sql($sql, $errored, $error_ary); - user_delete('remove', $bot_user_id); + user_delete('remove', $bot_user_id); + } + else + { + $sql = 'UPDATE ' . BOTS_TABLE . " + SET bot_agent = '" . $db->sql_escape($bot_agent) . "' + WHERE user_id = $bot_user_id"; + _sql($sql, $errored, $error_ary); + } } } -- cgit v1.2.1 From ed74c9c4870885cc3f1e04a2f68efb600012f529 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 9 Nov 2012 14:26:45 +0100 Subject: [ticket/11178] Do not set error_reporting to E_ALL in database_updater.php Take whatever startup.php sets instead. This especially takes care of E_STRICT messages that are generated because of PHP4 compatibility. PHPBB3-11178 --- phpBB/install/database_update.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 099ab6aeb5..b6299dbf7c 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -60,8 +60,6 @@ $updates_to_version = UPDATES_TO_VERSION; $debug_from_version = DEBUG_FROM_VERSION; $oldest_from_version = OLDEST_FROM_VERSION; -error_reporting(E_ALL); - @set_time_limit(0); // Include essential scripts -- cgit v1.2.1 From 7d7dc98b10b586635fdee5c420e1ae9fa8d2b752 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Fri, 9 Nov 2012 23:16:42 +0100 Subject: [ticket/11181] Bump PHP requirement to 5.3.3 (from 5.3.2) PHPBB3-11181 --- phpBB/install/index.php | 4 ++-- phpBB/install/install_install.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/index.php b/phpBB/install/index.php index f71e5ada54..c6d0b4cef7 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -21,9 +21,9 @@ define('IN_INSTALL', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); -if (version_compare(PHP_VERSION, '5.3.2') < 0) +if (version_compare(PHP_VERSION, '5.3.3') < 0) { - die('You are running an unsupported PHP version. Please upgrade to PHP 5.3.2 or higher before trying to install phpBB 3.1'); + die('You are running an unsupported PHP version. Please upgrade to PHP 5.3.3 or higher before trying to install phpBB 3.1'); } function phpbb_require_updated($path, $optional = false) diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index eb9a92f4d1..f922d50416 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -143,7 +143,7 @@ class install_install extends module // Test the minimum PHP version $php_version = PHP_VERSION; - if (version_compare($php_version, '5.3.2') < 0) + if (version_compare($php_version, '5.3.3') < 0) { $result = '' . $lang['NO'] . ''; } -- cgit v1.2.1