На ваш страх и риск, запускать из корня
Код: Выделить всё
<?php
/**
*/
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);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$sql = "SELECT post_text, post_id
FROM " . POSTS_TABLE . "
WHERE post_text LIKE '%" . 'СТАРЫЙ_ТЕКСТ' . "%'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain posts', '', __LINE__, __FILE__, $sql);
}
else
{
for ($i = 1; $row = $db->sql_fetchrow($result); $i++)
{
ECHO "количество замен". $i;
$sql = "UPDATE " . POSTS_TABLE . "
SET post_text = '" . str_replace('СТАРЫЙ_ТЕКСТ', 'НОВЫЙ_ТЕКСТ', addslashes($row['post_text'])) . "'
WHERE post_id = '" . $row['post_id'] . "';";
if ( !($result_update = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update posts', '', __LINE__, __FILE__, $sql);
}
}
}
?>