diff options
Diffstat (limited to 'phpBB/develop')
-rw-r--r-- | phpBB/develop/add_permissions.php | 18 | ||||
-rw-r--r-- | phpBB/develop/calc_email_hash.php | 18 | ||||
-rw-r--r-- | phpBB/develop/change_smiley_ref.php | 26 | ||||
-rw-r--r-- | phpBB/develop/check_flash_bbcodes.php | 7 | ||||
-rw-r--r-- | phpBB/develop/create_schema_files.php | 79 | ||||
-rw-r--r-- | phpBB/develop/create_search_index.php | 137 | ||||
-rw-r--r-- | phpBB/develop/create_variable_overview.php | 30 | ||||
-rw-r--r-- | phpBB/develop/fill.php | 19 | ||||
-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/merge_attachment_tables.php | 18 | ||||
-rw-r--r-- | phpBB/develop/merge_post_tables.php | 26 | ||||
-rw-r--r-- | phpBB/develop/mysql_upgrader.php | 9 | ||||
-rw-r--r-- | phpBB/develop/utf_normalizer_test.php | 3 |
15 files changed, 260 insertions, 139 deletions
diff --git a/phpBB/develop/add_permissions.php b/phpBB/develop/add_permissions.php index 035c23f49c..6f26bf6ac6 100644 --- a/phpBB/develop/add_permissions.php +++ b/phpBB/develop/add_permissions.php @@ -1,15 +1,11 @@ <?php -// ------------------------------------------------------------- -// -// $Id$ -// -// FILENAME : add_permissions.php -// STARTED : Sat Nov 06, 2004 -// COPYRIGHT : © 2004 phpBB Group -// WWW : http://www.phpbb.com/ -// LICENCE : GPL vs2.0 [ see /docs/COPYING ] -// -// ------------------------------------------------------------- +/** +* +* @package phpBB3 +* @copyright (c) 2004 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ // // Security message: diff --git a/phpBB/develop/calc_email_hash.php b/phpBB/develop/calc_email_hash.php index a67b0f52a3..fccdfdfca9 100644 --- a/phpBB/develop/calc_email_hash.php +++ b/phpBB/develop/calc_email_hash.php @@ -1,15 +1,11 @@ <?php -// ------------------------------------------------------------- -// -// $Id$ -// -// FILENAME : calc_email_hash.php -// STARTED : Tue Feb 03, 2004 -// COPYRIGHT : © 2004 phpBB Group -// WWW : http://www.phpbb.com/ -// LICENCE : GPL vs2.0 [ see /docs/COPYING ] -// -// ------------------------------------------------------------- +/** +* +* @package phpBB3 +* @copyright (c) 2004 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ // // Security message: diff --git a/phpBB/develop/change_smiley_ref.php b/phpBB/develop/change_smiley_ref.php index db65dd52d4..59ee77b7b1 100644 --- a/phpBB/develop/change_smiley_ref.php +++ b/phpBB/develop/change_smiley_ref.php @@ -1,23 +1,11 @@ <?php -/*************************************************************************** - * merge_clean_posts.php - * ------------------- - * begin : Tuesday, February 25, 2003 - * copyright : (C) 2003 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ +/** +* +* @package phpBB3 +* @copyright (c) 2003 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ // // Security message: diff --git a/phpBB/develop/check_flash_bbcodes.php b/phpBB/develop/check_flash_bbcodes.php index b0fa399209..5946f685b8 100644 --- a/phpBB/develop/check_flash_bbcodes.php +++ b/phpBB/develop/check_flash_bbcodes.php @@ -2,14 +2,11 @@ /** * * @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 * -*/ - -/** * This script will check your database for potentially dangerous flash BBCode tags +* */ // diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 0515d801f2..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. @@ -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; @@ -329,6 +335,15 @@ foreach ($supported_dbms as $dbms) // Write columns one by one... foreach ($table_data['COLUMNS'] as $column_name => $column_data) { + if (strlen($column_name) > 30) + { + trigger_error("Column name '$column_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + if (isset($column_data[2]) && $column_data[2] == 'auto_increment' && strlen($column_name) > 26) // "${column_name}_gen" + { + trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + // Get type if (strpos($column_data[0], ':') !== false) { @@ -632,6 +647,11 @@ foreach ($supported_dbms as $dbms) $key_data[1] = array($key_data[1]); } + if (strlen($table_name . $key_name) > 30) + { + trigger_error("Index name '${table_name}_$key_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + switch ($dbms) { case 'mysql_40': @@ -926,7 +946,7 @@ function get_schema_struct() $schema_data['phpbb_bbcodes'] = array( 'COLUMNS' => array( - 'bbcode_id' => array('TINT:3', 0), + 'bbcode_id' => array('USINT', 0), 'bbcode_tag' => array('VCHAR:16', ''), 'bbcode_helpline' => array('VCHAR_UNI', ''), 'display_on_posting' => array('BOOL', 0), @@ -1207,6 +1227,24 @@ function get_schema_struct() ), ); + $schema_data['phpbb_login_attempts'] = array( + 'COLUMNS' => array( + 'attempt_ip' => array('VCHAR:40', ''), + 'attempt_browser' => array('VCHAR:150', ''), + 'attempt_forwarded_for' => array('VCHAR:255', ''), + 'attempt_time' => array('TIMESTAMP', 0), + 'user_id' => array('UINT', 0), + 'username' => array('VCHAR_UNI:255', 0), + 'username_clean' => array('VCHAR_CI', 0), + ), + 'KEYS' => array( + 'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')), + 'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')), + 'att_time' => array('INDEX', array('attempt_time')), + 'user_id' => array('INDEX', 'user_id'), + ), + ); + $schema_data['phpbb_moderator_cache'] = array( 'COLUMNS' => array( 'forum_id' => array('UINT', 0), @@ -2047,4 +2085,3 @@ EOF; echo 'done'; -?>
\ No newline at end of file diff --git a/phpBB/develop/create_search_index.php b/phpBB/develop/create_search_index.php new file mode 100644 index 0000000000..c1a7125d61 --- /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; + +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; + $time = time(); + + 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 3782f53e4c..f926d79eb5 100644 --- a/phpBB/develop/create_variable_overview.php +++ b/phpBB/develop/create_variable_overview.php @@ -1,19 +1,13 @@ <?php -// ------------------------------------------------------------- -// -// $Id$ -// -// FILENAME : create_variable_overview.php -// STARTED : Fri Aug 15 2003 -// COPYRIGHT : © 2003 phpBB Group -// WWW : http://www.phpbb.com/ -// LICENCE : GPL vs2.0 [ see /docs/COPYING ] -// -// ------------------------------------------------------------- - -/* - This script generates an index of some template vars and their use within the templates. - It writes down all language variables used by various templates. +/** +* +* @package phpBB3 +* @copyright (c) 2003 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +* This script generates an index of some template vars and their use within the templates. +* It writes down all language variables used by various templates. +* */ // @@ -83,7 +77,7 @@ $html_skeleton .= '<br><br><a name="ref"></a><b>References: </b>{SEE_FILES}'; $html_skeleton .= ' <br><br> -<div class="copyright" align="center">Powered by phpBB 2.2 © <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB Group</a>, 2003</div> +<div class="copyright" align="center">Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group</div> <br clear="all" /></td> </tr> @@ -405,7 +399,7 @@ $html_data .= '<br><li><a href="./lang_index.html" class="gen">Appendix A: Langu $html_data .= ' </ol><br><br> -<div class="copyright" align="center">Powered by phpBB 2.2 © <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB Group</a>, 2003</div> +<div class="copyright" align="center">Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group</div> <br clear="all" /></td> </tr> @@ -528,7 +522,7 @@ foreach ($lang_fp as $filepointer) $html_data .= ' <br><br> -<div class="copyright" align="center">Powered by phpBB 2.2 © <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB Group</a>, 2003</div> +<div class="copyright" align="center">Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group</div> <br clear="all" /></td> </tr> diff --git a/phpBB/develop/fill.php b/phpBB/develop/fill.php index 336e510d06..e0d054d073 100644 --- a/phpBB/develop/fill.php +++ b/phpBB/develop/fill.php @@ -1,15 +1,12 @@ <?php -// ------------------------------------------------------------- -// -// $Id$ -// -// FILENAME : fill.php -// STARTED : Mon Sep 15, 2003 -// COPYRIGHT : © 2001, 2003 phpBB Group -// WWW : http://www.phpbb.com/ -// LICENCE : GPL vs2.0 [ see /docs/COPYING ] -// -// ------------------------------------------------------------- +/** +* +* @package phpBB3 +* @copyright (c) 2001, 2003 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + // // Security message: // 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_attachment_tables.php b/phpBB/develop/merge_attachment_tables.php index ae7fe57be4..0186b3cc8b 100644 --- a/phpBB/develop/merge_attachment_tables.php +++ b/phpBB/develop/merge_attachment_tables.php @@ -1,15 +1,11 @@ <?php -// ------------------------------------------------------------- -// -// $Id$ -// -// FILENAME : merge_attachment_tables.php -// STARTED : Tue Nov 04, 2003 -// COPYRIGHT : © 2001, 2003 phpBB Group -// WWW : http://www.phpbb.com/ -// LICENCE : GPL vs2.0 [ see /docs/COPYING ] -// -// ------------------------------------------------------------- +/** +* +* @package phpBB3 +* @copyright (c) 2001, 2003 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ // // Security message: diff --git a/phpBB/develop/merge_post_tables.php b/phpBB/develop/merge_post_tables.php index 3567a569c6..2d99d725d0 100644 --- a/phpBB/develop/merge_post_tables.php +++ b/phpBB/develop/merge_post_tables.php @@ -1,23 +1,11 @@ <?php -/*************************************************************************** - * merge_clean_posts.php - * ------------------- - * begin : Tuesday, February 25, 2003 - * copyright : (C) 2003 The phpBB Group - * email : support@phpbb.com - * - * $Id$ - * - ***************************************************************************/ - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - ***************************************************************************/ +/** +* +* @package phpBB3 +* @copyright (c) 2003 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ // // Security message: diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index 57230339e8..05d279a099 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -2,15 +2,13 @@ /** * * @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 * */ - // // Security message: // @@ -21,6 +19,7 @@ die("Please read the first lines of this script for instructions on how to enable it"); define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); @@ -252,7 +251,7 @@ foreach ($schema_data as $table_name => $table_data) // Do we now need to re-add the fulltext index? ;) if ($table_name == ($prefix . 'posts') && $drop_index) { - echo "ALTER TABLE $table_name ADD FULLTEXT (post_subject), ADD FULLTEXT (post_text), ADD FULLTEXT post_content (post_subject, post_text){$newline}"; + echo "ALTER TABLE $table_name ADD FULLTEXT (post_subject), ADD FULLTEXT (post_text), ADD FULLTEXT post_content (post_subject, post_text);{$newline}"; } } @@ -414,7 +413,7 @@ function get_schema_struct() $schema_data['phpbb_bbcodes'] = array( 'COLUMNS' => array( - 'bbcode_id' => array('TINT:3', 0), + 'bbcode_id' => array('USINT', 0), 'bbcode_tag' => array('VCHAR:16', ''), 'bbcode_helpline' => array('VCHAR_UNI', ''), 'display_on_posting' => array('BOOL', 0), 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 * */ |