diff options
author | Igor Wiedler <igor@wiedler.ch> | 2012-02-17 13:48:48 +0100 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-02-17 13:48:48 +0100 |
commit | d70c3f1eb8c0ddc68d8eda1bd8708c4957c21182 (patch) | |
tree | c0081f9deac588982d2e00cf935daabb03af6605 /phpBB/develop | |
parent | 7295e5824aed6f5ec32cfab0ad17cfa2c24855ac (diff) | |
parent | 9611b5ff83582d7bda22ab991e8d69786dab5b93 (diff) | |
download | forums-d70c3f1eb8c0ddc68d8eda1bd8708c4957c21182.tar forums-d70c3f1eb8c0ddc68d8eda1bd8708c4957c21182.tar.gz forums-d70c3f1eb8c0ddc68d8eda1bd8708c4957c21182.tar.bz2 forums-d70c3f1eb8c0ddc68d8eda1bd8708c4957c21182.tar.xz forums-d70c3f1eb8c0ddc68d8eda1bd8708c4957c21182.zip |
Merge branch 'develop' into ticket/10380
* develop: (325 commits)
[ticket/10641] Update MCP template with new plurality forms
[ticket/10637] Leftovers from implementation of extensions in convertor
[ticket/10637] Leftovers from implementation of extensions in develop tools
[ticket/10637] Leftovers from implementation of extensions in mcp_post
[ticket/10637] Leftovers from implementation of extensions in mcp_main
[ticket/10637] Leftovers from implementation of extensions
[ticket/10606] Also correctly use $s_search_hidden_fields in view(forum|topic).
[ticket/10606] Fix incorrect hidden fields array name in page_header().
[ticket/10633] Stop leaking filename of attachments when thumbnail is requested
[ticket/10636] Resolve variable name ($sql_ary) conflict in cache_moderators().
[ticket/10634] Specify module type when viewing profile
[ticket/10634] Changing p_master::is_full_class
[ticket/10569] Invalid string comparison in prosilver
[ticket/10495] Update request/type_cast_helper for PHP 5.4 magic_quotes_gpc drop
[ticket/10512] Call startup.php from tests/bootstrap.php
[ticket/10535] Delete no longer needed email confirm language entries.
[ticket/9914] Add backup warning to updater.
[ticket/10616] Add template inheritance to exported template
[ticket/10616] Ignore template inheritance that points to self
[ticket/10616] Add template inheritance to default styles
...
Diffstat (limited to 'phpBB/develop')
-rw-r--r-- | phpBB/develop/change_smiley_ref.php | 2 | ||||
-rw-r--r-- | phpBB/develop/check_flash_bbcodes.php | 3 | ||||
-rw-r--r-- | phpBB/develop/create_schema_files.php | 86 | ||||
-rw-r--r-- | phpBB/develop/create_search_index.php | 136 | ||||
-rw-r--r-- | phpBB/develop/create_variable_overview.php | 2 | ||||
-rw-r--r-- | phpBB/develop/fill.php | 2 | ||||
-rw-r--r-- | phpBB/develop/generate_utf_casefold.php | 3 | ||||
-rw-r--r-- | phpBB/develop/generate_utf_confusables.php | 3 | ||||
-rw-r--r-- | phpBB/develop/generate_utf_tables.php | 3 | ||||
-rw-r--r-- | phpBB/develop/lang_duplicates.php | 4 | ||||
-rw-r--r-- | phpBB/develop/merge_post_tables.php | 1 | ||||
-rw-r--r-- | phpBB/develop/mysql_upgrader.php | 3 | ||||
-rwxr-xr-x | phpBB/develop/remove-php-end-tags.py | 2 | ||||
-rw-r--r-- | phpBB/develop/search_fill.php | 4 | ||||
-rw-r--r-- | phpBB/develop/utf_normalizer_test.php | 3 |
15 files changed, 181 insertions, 76 deletions
diff --git a/phpBB/develop/change_smiley_ref.php b/phpBB/develop/change_smiley_ref.php index 23a26951bf..75028d86f0 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 2057d292b7..80d6e05d09 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. @@ -12,11 +11,7 @@ * If you overwrite the original schema files please make sure you save the file with UNIX linefeeds. */ -die("Please read the first lines of this script for instructions on how to enable it"); - -@set_time_limit(0); - -$schema_path = './../install/schemas/'; +$schema_path = dirname(__FILE__) . '/../install/schemas/'; if (!is_writable($schema_path)) { @@ -242,7 +237,7 @@ $supported_dbms = array('firebird', 'mssql', 'mysql_40', 'mysql_41', 'oracle', ' foreach ($supported_dbms as $dbms) { - $fp = fopen($schema_path . '_' . $dbms . '_schema.sql', 'wt'); + $fp = fopen($schema_path . $dbms . '_schema.sql', 'wt'); $line = ''; @@ -251,32 +246,43 @@ foreach ($supported_dbms as $dbms) { case 'mysql_40': case 'mysql_41': - $line = "#\n# \$I" . "d: $\n#\n\n"; + case 'firebird': + case 'sqlite': + fwrite($fp, "# DO NOT EDIT THIS FILE, IT IS GENERATED\n"); + fwrite($fp, "#\n"); + fwrite($fp, "# To change the contents of this file, edit\n"); + fwrite($fp, "# phpBB/develop/create_schema_files.php and\n"); + fwrite($fp, "# run it.\n"); break; + case 'mssql': + case 'oracle': + case 'postgres': + fwrite($fp, "/*\n"); + fwrite($fp, " * DO NOT EDIT THIS FILE, IT IS GENERATED\n"); + fwrite($fp, " *\n"); + fwrite($fp, " * To change the contents of this file, edit\n"); + fwrite($fp, " * phpBB/develop/create_schema_files.php and\n"); + fwrite($fp, " * run it.\n"); + fwrite($fp, " */\n\n"); + break; + } + + switch ($dbms) + { case 'firebird': - $line = "#\n# \$I" . "d: $\n#\n\n"; $line .= custom_data('firebird') . "\n"; break; case 'sqlite': - $line = "#\n# \$I" . "d: $\n#\n\n"; $line .= "BEGIN TRANSACTION;\n\n"; break; - case 'mssql': - $line = "/*\n\n \$I" . "d: $\n\n*/\n\n"; - // no need to do this, no transaction support for schema changes - //$line .= "BEGIN TRANSACTION\nGO\n\n"; - break; - case 'oracle': - $line = "/*\n\n \$I" . "d: $\n\n*/\n\n"; $line .= custom_data('oracle') . "\n"; break; case 'postgres': - $line = "/*\n\n \$I" . "d: $\n\n*/\n\n"; $line .= "BEGIN;\n\n"; $line .= custom_data('postgres') . "\n"; break; @@ -1031,6 +1037,17 @@ function get_schema_struct() ), ); + $schema_data['phpbb_ext'] = array( + 'COLUMNS' => array( + 'ext_name' => array('VCHAR', ''), + 'ext_active' => array('BOOL', 0), + 'ext_state' => array('TEXT', ''), + ), + 'KEYS' => array( + 'ext_name' => array('UNIQUE', 'ext_name'), + ), + ); + $schema_data['phpbb_extensions'] = array( 'COLUMNS' => array( 'extension_id' => array('UINT', NULL, 'auto_increment'), @@ -1639,14 +1656,12 @@ function get_schema_struct() 'style_active' => array('BOOL', 1), 'template_id' => array('UINT', 0), 'theme_id' => array('UINT', 0), - 'imageset_id' => array('UINT', 0), ), 'PRIMARY_KEY' => 'style_id', 'KEYS' => array( 'style_name' => array('UNIQUE', 'style_name'), 'template_id' => array('INDEX', 'template_id'), 'theme_id' => array('INDEX', 'theme_id'), - 'imageset_id' => array('INDEX', 'imageset_id'), ), ); @@ -1679,35 +1694,6 @@ function get_schema_struct() ), ); - $schema_data['phpbb_styles_imageset'] = array( - 'COLUMNS' => array( - 'imageset_id' => array('UINT', NULL, 'auto_increment'), - 'imageset_name' => array('VCHAR_UNI:255', ''), - 'imageset_copyright' => array('VCHAR_UNI', ''), - 'imageset_path' => array('VCHAR:100', ''), - ), - 'PRIMARY_KEY' => 'imageset_id', - 'KEYS' => array( - 'imgset_nm' => array('UNIQUE', 'imageset_name'), - ), - ); - - $schema_data['phpbb_styles_imageset_data'] = array( - 'COLUMNS' => array( - 'image_id' => array('UINT', NULL, 'auto_increment'), - 'image_name' => array('VCHAR:200', ''), - 'image_filename' => array('VCHAR:200', ''), - 'image_lang' => array('VCHAR:30', ''), - 'image_height' => array('USINT', 0), - 'image_width' => array('USINT', 0), - 'imageset_id' => array('UINT', 0), - ), - 'PRIMARY_KEY' => 'image_id', - 'KEYS' => array( - 'i_d' => array('INDEX', 'imageset_id'), - ), - ); - $schema_data['phpbb_topics'] = array( 'COLUMNS' => array( 'topic_id' => array('UINT', NULL, 'auto_increment'), diff --git a/phpBB/develop/create_search_index.php b/phpBB/develop/create_search_index.php new file mode 100644 index 0000000000..1de20f3099 --- /dev/null +++ b/phpBB/develop/create_search_index.php @@ -0,0 +1,136 @@ +<?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); + +$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 b42d1aebe2..632930bfff 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 c9824e88e5..a4cd90bfca 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 4f764ca471..5b99f3e55e 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 bc88e67ba9..027d75b661 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 dbef125803..71a5bea851 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/lang_duplicates.php b/phpBB/develop/lang_duplicates.php index 3ea841b6d6..02852798b6 100644 --- a/phpBB/develop/lang_duplicates.php +++ b/phpBB/develop/lang_duplicates.php @@ -15,10 +15,8 @@ die("Please read the first lines of this script for instructions on how to enabl // ------------------------------------------------------------- // -// $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 // // ------------------------------------------------------------- // Thanks to arod-1 diff --git a/phpBB/develop/merge_post_tables.php b/phpBB/develop/merge_post_tables.php index e7e22409a5..d13ae287b5 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 c54a7155c2..69fcd690b7 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/remove-php-end-tags.py b/phpBB/develop/remove-php-end-tags.py index 1707c6d519..89b9ee5032 100755 --- a/phpBB/develop/remove-php-end-tags.py +++ b/phpBB/develop/remove-php-end-tags.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # Remove ending PHP tags '?>' # @author Oleg Pudeyev -# @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 import sys, os, os.path, optparse diff --git a/phpBB/develop/search_fill.php b/phpBB/develop/search_fill.php index 371c8c74cc..4c0b607778 100644 --- a/phpBB/develop/search_fill.php +++ b/phpBB/develop/search_fill.php @@ -34,13 +34,11 @@ $user->setup(); $search_type = $config['search_type']; -if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) +if (!class_exists($search_type)) { trigger_error('NO_SUCH_SEARCH_MODULE'); } -require($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx); - $error = false; $search = new $search_type($error); diff --git a/phpBB/develop/utf_normalizer_test.php b/phpBB/develop/utf_normalizer_test.php index 463a274f66..186e10fea2 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 * */ |