aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/develop/create_search_index.php137
-rw-r--r--phpBB/includes/acp/acp_board.php26
-rw-r--r--phpBB/includes/constants.php2
-rw-r--r--phpBB/includes/functions_admin.php35
-rw-r--r--phpBB/includes/functions_install.php19
-rw-r--r--phpBB/install/database_update.php2
-rw-r--r--phpBB/install/install_install.php6
-rw-r--r--phpBB/install/schemas/schema_data.sql2
-rw-r--r--phpBB/language/en/acp/permissions.php6
9 files changed, 168 insertions, 67 deletions
diff --git a/phpBB/develop/create_search_index.php b/phpBB/develop/create_search_index.php
new file mode 100644
index 0000000000..374a4cf0a1
--- /dev/null
+++ b/phpBB/develop/create_search_index.php
@@ -0,0 +1,137 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+if (php_sapi_name() != 'cli')
+{
+ die("This program must be run from the command line.\n");
+}
+
+if ($argc < 2)
+{
+ echo 'Usage: php ' . basename(__FILE__) . " index_type [batch_size]\n";
+ exit(1);
+}
+
+$class_name = basename($argv[1]);
+
+define('IN_PHPBB', true);
+$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
+$phpEx = substr(strrchr(__FILE__, '.'), 1);
+require($phpbb_root_path . 'common.' . $phpEx);
+require($phpbb_root_path . 'includes/acp/acp_search.' . $phpEx);
+require($phpbb_root_path . 'includes/search/' . $class_name . '.' . $phpEx);
+
+$user->session_begin();
+$auth->acl($user->data);
+$user->setup('acp/search');
+
+$search_name = ucfirst(strtolower(str_replace('_', ' ', $class_name)));
+$search_errors = array();
+$search = new $class_name($search_errors);
+
+$batch_size = isset($argv[2]) ? $argv[2] : 2000;
+$time = time();
+
+if (method_exists($search, 'create_index'))
+{
+ if ($error = $search->create_index(null, ''))
+ {
+ var_dump($error);
+ exit(1);
+ }
+}
+else
+{
+ $sql = 'SELECT forum_id, enable_indexing
+ FROM ' . FORUMS_TABLE;
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $forums[$row['forum_id']] = (bool) $row['enable_indexing'];
+ }
+ $db->sql_freeresult($result);
+
+ $sql = 'SELECT post_id
+ FROM ' . POSTS_TABLE . '
+ ORDER BY post_id DESC';
+ $result = $db->sql_query_limit($sql, 1);
+ $max_post_id = (int) $db->sql_fetchfield('post_id');
+
+ $post_counter = 0;
+ while ($post_counter <= $max_post_id)
+ {
+ $row_count = 0;
+
+ printf("Processing posts with %d <= post_id <= %d\n",
+ $post_counter + 1,
+ $post_counter + $batch_size
+ );
+
+ $sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id
+ FROM ' . POSTS_TABLE . '
+ WHERE post_id >= ' . (int) ($post_counter + 1) . '
+ AND post_id <= ' . (int) ($post_counter + $batch_size);
+ $result = $db->sql_query($sql);
+
+ $buffer = $db->sql_buffer_nested_transactions();
+
+ if ($buffer)
+ {
+ $rows = $db->sql_fetchrowset($result);
+ $rows[] = false; // indicate end of array for while loop below
+
+ $db->sql_freeresult($result);
+ }
+
+ $i = 0;
+ while ($row = ($buffer ? $rows[$i++] : $db->sql_fetchrow($result)))
+ {
+ // Indexing enabled for this forum or global announcement?
+ // Global announcements get indexed by default.
+ if (!$row['forum_id'] || !empty($forums[$row['forum_id']]))
+ {
+ ++$row_count;
+
+ $search->index('post',
+ $row['post_id'],
+ $row['post_text'],
+ $row['post_subject'],
+ $row['poster_id'],
+ $row['forum_id']
+ );
+
+ if ($row_count % 10 == 0)
+ {
+ echo '.';
+ }
+ }
+ }
+
+ $delta = (time() - $time);
+ $delta = $delta <= 0 ? 1 : $delta;
+ printf(" %d posts/sec\n", $row_count / $delta);
+
+ if (!$buffer)
+ {
+ $db->sql_freeresult($result);
+ }
+
+ $post_counter += $batch_size;
+ }
+}
+
+$search->tidy();
+
+add_log('admin', 'LOG_SEARCH_INDEX_CREATED', $search_name);
+
+echo $user->lang['SEARCH_INDEX_CREATED'] . "\n";
+echo 'Peak Memory Usage: ' . get_formatted_filesize(memory_get_peak_usage()) . "\n";
+
+exit(0);
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 3ed5f40368..8c761e51fe 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -234,7 +234,7 @@ class acp_board
'max_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:8:180', 'type' => false, 'method' => false, 'explain' => false,),
'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,),
- 'require_activation' => array('lang' => 'ACC_ACTIVATION', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_acc_activation', 'explain' => true),
+ 'require_activation' => array('lang' => 'ACC_ACTIVATION', 'validate' => 'int', 'type' => 'select', 'method' => 'select_acc_activation', 'explain' => true),
'new_member_post_limit' => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'text:4:4', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']),
'new_member_group_default'=> array('lang' => 'NEW_MEMBER_GROUP_DEFAULT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:1', 'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true),
@@ -768,24 +768,28 @@ class acp_board
/**
* Select account activation method
*/
- function select_acc_activation($value, $key = '')
+ function select_acc_activation($selected_value, $value)
{
global $user, $config;
- $radio_ary = array(
- USER_ACTIVATION_DISABLE => 'ACC_DISABLE',
- USER_ACTIVATION_NONE => 'ACC_NONE',
+ $act_ary = array(
+ 'ACC_DISABLE' => USER_ACTIVATION_DISABLE,
+ 'ACC_NONE' => USER_ACTIVATION_NONE,
);
-
if ($config['email_enable'])
{
- $radio_ary[USER_ACTIVATION_SELF] = 'ACC_USER';
- $radio_ary[USER_ACTIVATION_ADMIN] = 'ACC_ADMIN';
- }
+ $act_ary['ACC_USER'] = USER_ACTIVATION_SELF;
+ $act_ary['ACC_ADMIN'] = USER_ACTIVATION_ADMIN;
+ }
+ $act_options = '';
- $radio_text = h_radio('config[require_activation]', $radio_ary, $value, 'require_activation', $key, '<br />');
+ foreach ($act_ary as $key => $value)
+ {
+ $selected = ($selected_value == $value) ? ' selected="selected"' : '';
+ $act_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$key] . '</option>';
+ }
- return $radio_text;
+ return $act_options;
}
/**
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index 3a798fc1ce..a0444ea594 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -25,7 +25,7 @@ if (!defined('IN_PHPBB'))
*/
// phpBB Version
-define('PHPBB_VERSION', '3.0.10-RC3');
+define('PHPBB_VERSION', '3.0.11-dev');
// QA-related
// define('PHPBB_QA', 1);
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 526bc16ff0..0e1a11b4aa 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2294,41 +2294,6 @@ function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_fr
}
/**
-* remove_comments will strip the sql comment lines out of an uploaded sql file
-* specifically for mssql and postgres type files in the install....
-*/
-function remove_comments(&$output)
-{
- $lines = explode("\n", $output);
- $output = '';
-
- // try to keep mem. use down
- $linecount = sizeof($lines);
-
- $in_comment = false;
- for ($i = 0; $i < $linecount; $i++)
- {
- if (trim($lines[$i]) == '/*')
- {
- $in_comment = true;
- }
-
- if (!$in_comment)
- {
- $output .= $lines[$i] . "\n";
- }
-
- if (trim($lines[$i]) == '*/')
- {
- $in_comment = false;
- }
- }
-
- unset($lines);
- return $output;
-}
-
-/**
* Cache moderators, called whenever permissions are changed via admin_permissions. Changes of username
* and group names must be carried through for the moderators table
*/
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
index 2c640e0999..6caa5c943f 100644
--- a/phpBB/includes/functions_install.php
+++ b/phpBB/includes/functions_install.php
@@ -50,7 +50,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'firebird',
'MODULE' => 'interbase',
'DELIM' => ';;',
- 'COMMENTS' => 'remove_remarks',
'DRIVER' => 'firebird',
'AVAILABLE' => true,
'2.0.x' => false,
@@ -60,7 +59,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mysql_41',
'MODULE' => 'mysqli',
'DELIM' => ';',
- 'COMMENTS' => 'remove_remarks',
'DRIVER' => 'mysqli',
'AVAILABLE' => true,
'2.0.x' => true,
@@ -70,7 +68,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mysql',
'MODULE' => 'mysql',
'DELIM' => ';',
- 'COMMENTS' => 'remove_remarks',
'DRIVER' => 'mysql',
'AVAILABLE' => true,
'2.0.x' => true,
@@ -80,7 +77,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mssql',
'MODULE' => 'mssql',
'DELIM' => 'GO',
- 'COMMENTS' => 'remove_comments',
'DRIVER' => 'mssql',
'AVAILABLE' => true,
'2.0.x' => true,
@@ -90,7 +86,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mssql',
'MODULE' => 'odbc',
'DELIM' => 'GO',
- 'COMMENTS' => 'remove_comments',
'DRIVER' => 'mssql_odbc',
'AVAILABLE' => true,
'2.0.x' => true,
@@ -100,7 +95,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mssql',
'MODULE' => 'sqlsrv',
'DELIM' => 'GO',
- 'COMMENTS' => 'remove_comments',
'DRIVER' => 'mssqlnative',
'AVAILABLE' => true,
'2.0.x' => false,
@@ -110,7 +104,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'oracle',
'MODULE' => 'oci8',
'DELIM' => '/',
- 'COMMENTS' => 'remove_comments',
'DRIVER' => 'oracle',
'AVAILABLE' => true,
'2.0.x' => false,
@@ -120,7 +113,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'postgres',
'MODULE' => 'pgsql',
'DELIM' => ';',
- 'COMMENTS' => 'remove_comments',
'DRIVER' => 'postgres',
'AVAILABLE' => true,
'2.0.x' => true,
@@ -130,7 +122,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'sqlite',
'MODULE' => 'sqlite',
'DELIM' => ';',
- 'COMMENTS' => 'remove_remarks',
'DRIVER' => 'sqlite',
'AVAILABLE' => true,
'2.0.x' => false,
@@ -473,11 +464,17 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
}
/**
-* remove_remarks will strip the sql comment lines out of an uploaded sql file
+* Removes comments from schema files
*/
-function remove_remarks(&$sql)
+function remove_comments($sql)
{
+ // Remove /* */ comments (http://ostermiller.org/findcomment.html)
+ $sql = preg_replace('#/\*(.|[\r\n])*?\*/#', "\n", $sql);
+
+ // Remove # style comments
$sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql));
+
+ return $sql;
}
/**
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index eeadc9f862..9c44350955 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -8,7 +8,7 @@
*
*/
-define('UPDATES_TO_VERSION', '3.0.10-RC3');
+define('UPDATES_TO_VERSION', '3.0.11-dev');
// Enter any version to update from to test updates. The version within the db will not be updated.
define('DEBUG_FROM_VERSION', false);
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index 8b073df44c..026fc0d404 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -1178,14 +1178,13 @@ class install_install extends module
$dbms_schema = 'schemas/' . $available_dbms[$data['dbms']]['SCHEMA'] . '_schema.sql';
// How should we treat this schema?
- $remove_remarks = $available_dbms[$data['dbms']]['COMMENTS'];
$delimiter = $available_dbms[$data['dbms']]['DELIM'];
$sql_query = @file_get_contents($dbms_schema);
$sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query);
- $remove_remarks($sql_query);
+ $sql_query = remove_comments($sql_query);
$sql_query = split_sql_file($sql_query, $delimiter);
@@ -1223,8 +1222,7 @@ class install_install extends module
// Change language strings...
$sql_query = preg_replace_callback('#\{L_([A-Z0-9\-_]*)\}#s', 'adjust_language_keys_callback', $sql_query);
- // Since there is only one schema file we know the comment style and are able to remove it directly with remove_remarks
- remove_remarks($sql_query);
+ $sql_query = remove_comments($sql_query);
$sql_query = split_sql_file($sql_query, ';');
foreach ($sql_query as $sql)
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index eb90d3a06d..fcc372ae93 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -246,7 +246,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page',
INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files');
-INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.10-RC3');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.11-dev');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400');
diff --git a/phpBB/language/en/acp/permissions.php b/phpBB/language/en/acp/permissions.php
index cf248cffdb..016be51282 100644
--- a/phpBB/language/en/acp/permissions.php
+++ b/phpBB/language/en/acp/permissions.php
@@ -171,7 +171,7 @@ $lang = array_merge($lang, array(
'ROLE_FORUM_POLLS' => 'Standard Access + Polls',
'ROLE_FORUM_READONLY' => 'Read Only Access',
'ROLE_FORUM_STANDARD' => 'Standard Access',
- 'ROLE_FORUM_NEW_MEMBER' => 'Newly registered User',
+ 'ROLE_FORUM_NEW_MEMBER' => 'Newly Registered User Access',
'ROLE_MOD_FULL' => 'Full Moderator',
'ROLE_MOD_QUEUE' => 'Queue Moderator',
'ROLE_MOD_SIMPLE' => 'Simple Moderator',
@@ -181,7 +181,7 @@ $lang = array_merge($lang, array(
'ROLE_USER_NOAVATAR' => 'No Avatar',
'ROLE_USER_NOPM' => 'No Private Messages',
'ROLE_USER_STANDARD' => 'Standard Features',
- 'ROLE_USER_NEW_MEMBER' => 'Newly registered User',
+ 'ROLE_USER_NEW_MEMBER' => 'Newly Registered User Features',
'ROLE_DESCRIPTION_ADMIN_FORUM' => 'Can access the forum management and forum permission settings.',
@@ -273,7 +273,7 @@ $lang = array_merge($lang, array(
'TRACE_WHO' => 'Who',
'TRACE_TOTAL' => 'Total',
- 'USERS_NOT_ASSIGNED' => 'No user assigned to this role',
+ 'USERS_NOT_ASSIGNED' => 'No users are assigned to this role',
'USER_IS_MEMBER_OF_DEFAULT' => 'is a member of the following pre-defined groups',
'USER_IS_MEMBER_OF_CUSTOM' => 'is a member of the following user defined groups',