aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/develop
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/develop')
-rw-r--r--phpBB/develop/change_smiley_ref.php2
-rw-r--r--phpBB/develop/check_flash_bbcodes.php3
-rw-r--r--phpBB/develop/create_schema_files.php3
-rw-r--r--phpBB/develop/create_search_index.php137
-rw-r--r--phpBB/develop/create_variable_overview.php2
-rw-r--r--phpBB/develop/fill.php2
-rw-r--r--phpBB/develop/generate_utf_casefold.php3
-rw-r--r--phpBB/develop/generate_utf_confusables.php3
-rw-r--r--phpBB/develop/generate_utf_tables.php3
-rw-r--r--phpBB/develop/merge_post_tables.php1
-rw-r--r--phpBB/develop/mysql_upgrader.php3
-rw-r--r--phpBB/develop/utf_normalizer_test.php3
12 files changed, 144 insertions, 21 deletions
diff --git a/phpBB/develop/change_smiley_ref.php b/phpBB/develop/change_smiley_ref.php
index db65dd52d4..3d6dd45d6f 100644
--- a/phpBB/develop/change_smiley_ref.php
+++ b/phpBB/develop/change_smiley_ref.php
@@ -5,8 +5,6 @@
* begin : Tuesday, February 25, 2003
* copyright : (C) 2003 The phpBB Group
* email : support@phpbb.com
- *
- * $Id$
*
***************************************************************************/
diff --git a/phpBB/develop/check_flash_bbcodes.php b/phpBB/develop/check_flash_bbcodes.php
index b0fa399209..2ce288ee3e 100644
--- a/phpBB/develop/check_flash_bbcodes.php
+++ b/phpBB/develop/check_flash_bbcodes.php
@@ -2,9 +2,8 @@
/**
*
* @package phpBB3
-* @version $Id$
* @copyright (c) 2009, 2010 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index 7f37b94453..d44efb8870 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -2,9 +2,8 @@
/**
*
* @package phpBB3
-* @version $Id$
* @copyright (c) 2006 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
* This file creates new schema files for every database.
* The filenames will be prefixed with an underscore to not overwrite the current schema files.
diff --git a/phpBB/develop/create_search_index.php b/phpBB/develop/create_search_index.php
new file mode 100644
index 0000000000..28001035f6
--- /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-2.0.php GNU General Public License v2
+*
+*/
+
+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/develop/create_variable_overview.php b/phpBB/develop/create_variable_overview.php
index fe7cacf0d1..a786fc6866 100644
--- a/phpBB/develop/create_variable_overview.php
+++ b/phpBB/develop/create_variable_overview.php
@@ -1,8 +1,6 @@
<?php
// -------------------------------------------------------------
//
-// $Id$
-//
// FILENAME : create_variable_overview.php
// STARTED : Fri Aug 15 2003
// COPYRIGHT : © 2003 phpBB Group
diff --git a/phpBB/develop/fill.php b/phpBB/develop/fill.php
index 336e510d06..c1e39fa4f3 100644
--- a/phpBB/develop/fill.php
+++ b/phpBB/develop/fill.php
@@ -1,8 +1,6 @@
<?php
// -------------------------------------------------------------
//
-// $Id$
-//
// FILENAME : fill.php
// STARTED : Mon Sep 15, 2003
// COPYRIGHT : © 2001, 2003 phpBB Group
diff --git a/phpBB/develop/generate_utf_casefold.php b/phpBB/develop/generate_utf_casefold.php
index 89c4aec01a..73951cb4dc 100644
--- a/phpBB/develop/generate_utf_casefold.php
+++ b/phpBB/develop/generate_utf_casefold.php
@@ -2,9 +2,8 @@
/**
*
* @package phpBB3
-* @version $Id$
* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
diff --git a/phpBB/develop/generate_utf_confusables.php b/phpBB/develop/generate_utf_confusables.php
index 0ffa9720c9..d2ffbcfc65 100644
--- a/phpBB/develop/generate_utf_confusables.php
+++ b/phpBB/develop/generate_utf_confusables.php
@@ -2,9 +2,8 @@
/**
*
* @package phpBB3
-* @version $Id$
* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
diff --git a/phpBB/develop/generate_utf_tables.php b/phpBB/develop/generate_utf_tables.php
index 3d5188163d..6fe5d68ffd 100644
--- a/phpBB/develop/generate_utf_tables.php
+++ b/phpBB/develop/generate_utf_tables.php
@@ -2,9 +2,8 @@
/**
*
* @package phpBB3
-* @version $Id$
* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
diff --git a/phpBB/develop/merge_post_tables.php b/phpBB/develop/merge_post_tables.php
index 3567a569c6..5ccfef84c3 100644
--- a/phpBB/develop/merge_post_tables.php
+++ b/phpBB/develop/merge_post_tables.php
@@ -6,7 +6,6 @@
* copyright : (C) 2003 The phpBB Group
* email : support@phpbb.com
*
- * $Id$
*
***************************************************************************/
diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php
index dec8f8c210..49daab0962 100644
--- a/phpBB/develop/mysql_upgrader.php
+++ b/phpBB/develop/mysql_upgrader.php
@@ -2,9 +2,8 @@
/**
*
* @package phpBB3
-* @version $Id$
* @copyright (c) 2006 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
* This file creates SQL statements to upgrade phpBB on MySQL 3.x/4.0.x to 4.1.x/5.x
*
diff --git a/phpBB/develop/utf_normalizer_test.php b/phpBB/develop/utf_normalizer_test.php
index 7705cd6851..71f24a716b 100644
--- a/phpBB/develop/utf_normalizer_test.php
+++ b/phpBB/develop/utf_normalizer_test.php
@@ -2,9 +2,8 @@
/**
*
* @package phpBB3
-* @version $Id$
* @copyright (c) 2005 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/