From 91a35359edc168c4a83b4ce55374c49f9754487e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 30 May 2006 21:46:12 +0000 Subject: [PATCH] - add support for min/max of numerical search backend settings - change word_text maximum length - don't update search settings if nothing was changed git-svn-id: file:///svn/phpbb/trunk@5993 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_search.php | 20 +++++++++++++++++--- phpBB/includes/search/fulltext_native.php | 2 +- phpBB/install/schemas/firebird_schema.sql | 2 +- phpBB/install/schemas/mssql_schema.sql | 2 +- phpBB/install/schemas/mysql_schema.sql | 2 +- phpBB/install/schemas/oracle_schema.sql | 2 +- phpBB/install/schemas/postgres_schema.sql | 2 +- phpBB/install/schemas/sqlite_schema.sql | 2 +- 8 files changed, 24 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index c6bbbf18f7..8a601467dd 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -99,10 +99,24 @@ class acp_search continue; } - $config_value = $cfg_array[$config_name]; - settype($config_value, $var_type); + // e.g. integer:4:12 (min 4, max 12) + $var_type = explode(':', $var_type); - if ($submit) + $config_value = $cfg_array[$config_name]; + settype($config_value, $var_type[0]); + + if (isset($var_type[1])) + { + $config_value = max($var_type[1], $config_value); + } + + if (isset($var_type[2])) + { + $config_value = min($var_type[2], $config_value); + } + + // only change config if anything was actually changed + if ($submit && ($config[$config_name] != $config_value)) { set_config($config_name, $config_value); $updated = true; diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index 34a832d6ef..cdeb1d6c0e 100755 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -1098,7 +1098,7 @@ class fulltext_native extends search_backend // These are fields required in the config table return array( 'tpl' => $tpl, - 'config' => array('fulltext_native_load_upd' => 'bool', 'fulltext_native_min_chars' => 'integer', 'fulltext_native_max_chars' => 'integer') + 'config' => array('fulltext_native_load_upd' => 'bool', 'fulltext_native_min_chars' => 'integer:0:252', 'fulltext_native_max_chars' => 'integer:0:252') ); } } diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index b2dd3aa0f2..97d5592fe7 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -911,7 +911,7 @@ ALTER TABLE phpbb_search_results ADD PRIMARY KEY (search_key);; # phpbb_search_wordlist CREATE TABLE phpbb_search_wordlist ( - word_text VARCHAR(50) DEFAULT '' NOT NULL, + word_text VARCHAR(252) DEFAULT '' NOT NULL, word_id INTEGER NOT NULL, word_common INTEGER DEFAULT 0 NOT NULL );; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index a5406b51c0..debfe8548a 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -1436,7 +1436,7 @@ GO Table: phpbb_search_wordlist */ CREATE TABLE [phpbb_search_wordlist] ( - [word_text] [nvarchar] (50) NOT NULL , + [word_text] [nvarchar] (252) NOT NULL , [word_id] [int] IDENTITY (1, 1) NOT NULL , [word_common] [int] NOT NULL ) ON [PRIMARY] diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql index 8d7318e682..b626ef39e4 100644 --- a/phpBB/install/schemas/mysql_schema.sql +++ b/phpBB/install/schemas/mysql_schema.sql @@ -586,7 +586,7 @@ CREATE TABLE phpbb_search_results ( # Table: 'phpbb_search_wordlist' CREATE TABLE phpbb_search_wordlist ( - word_text varchar(50) BINARY DEFAULT '' NOT NULL, + word_text varchar(252) BINARY DEFAULT '' NOT NULL, word_id mediumint(8) UNSIGNED NOT NULL auto_increment, word_common tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (word_text), diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 2a41231626..16daf340b5 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1213,7 +1213,7 @@ CREATE TABLE phpbb_search_results ( Table: phpbb_search_wordlist */ CREATE TABLE phpbb_search_wordlist ( - word_text varchar2(50) DEFAULT '' NOT NULL, + word_text varchar2(252) DEFAULT '' NOT NULL, word_id number(8) NOT NULL, word_common number(1) DEFAULT '0' NOT NULL, CONSTRAINT pk_phpbb_search_wordlist PRIMARY KEY (word_text) diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index e0157b7efd..c979573ca9 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -915,7 +915,7 @@ CREATE SEQUENCE phpbb_search_wordlist_seq; CREATE TABLE phpbb_search_wordlist ( word_id INT4 DEFAULT nextval('phpbb_search_wordlist_seq'), - word_text varchar(50) DEFAULT '' NOT NULL, + word_text varchar(252) DEFAULT '' NOT NULL, word_common INT2 DEFAULT '0' NOT NULL, PRIMARY KEY (word_text), CHECK (word_common>=0) diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 5cba79713f..f9f458ad13 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -628,7 +628,7 @@ CREATE TABLE phpbb_search_results ( # Table: phpbb_search_wordlist CREATE TABLE phpbb_search_wordlist ( - word_text varchar(50) NOT NULL DEFAULT '', + word_text varchar(252) NOT NULL DEFAULT '', word_id mediumint(8) NOT NULL, word_common tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (word_text)