php - 编辑 vBulletin 数据库对站点没有影响

标签 php mysql serialization vbulletin

这是我在使用多个 vBulletin 数据库时一直遇到的问题。我无法编辑数据库来更改设置,例如 cookiepath、bburl 或它是否处于事件状态。我的意思是,我可以使用 PHPMyAdmin 更改它们,但效果是网站上没有任何更改。

现在,我无法访问旧安装,需要更改关闭原因、bburl 等。我更改了关闭原因的文本,但它仍然显示之前的文本,看板仍然关闭而且 bburl 仍然是错误的。

我已经验证它是正确的数据库和正确的服务器,因为这已经发生过很多次了。也许我只是在这里遗漏了什么?我不知道。

最佳答案

vBulletin 不直接从“设置”表访问设置。

此信息适用于 vBulletin 4.x,其他版本可能相同也可能不同。

保存设置时,它们会被序列化并存储在“数据存储”表中。 vBulletin 从“数据存储”表中提取数据以供使用。


我不需要使用以下步骤,但我通过 PhpMyAdmin 更改数据存储和设置表中“bburl”条目的协议(protocol)来测试它们。

您要查找的特定设置都存储在“选项”数组中。

如果您知道要更改的设置的当前数据或变量名称,则可以在序列化字符串中搜索它们并用新设置替换它们。

事件板的设置如下所示:s:8:"bbactive";i:1;
原因看起来是这样的:

s:14:"bbclosedreason";s:125:"<p>Sorry, the board is unavailable at the moment while we are testing some functionality.</p>
<p>We will be back soon...</p>";

转到“数据存储”表并在“标题”字段中找到“选项”条目。

从与“选项”条目关联的“数据”字段复制序列化数据。请务必对其进行备份,以防您的更改导致问题。

在数据中搜索您要更改的项目,当您更改数据时,通过更新与该条目关联的长度来确保您使用正确的序列化格式。

使用修改后的序列化数据更新“数据存储”表中的“选项”条目,并更新设置表中的各个条目。


更新“设置”和“数据存储”表的函数位于此处:
includes\adminfunctions.php

大约在第 2474 行(取决于您的版本)。

// #############################################################################
/**
* Reads settings from the settings then saves the values to the datastore
*
* After reading the contents of the setting table, the function will rebuild
* the $vbulletin->options array, then serialize the array and save that serialized
* array into the 'options' entry of the datastore in the database
*
* @return   array   The $vbulletin->options array
*/
function build_options()
{
    require_once(DIR . '/includes/adminfunctions_options.php');

    global $vbulletin;

    $vbulletin->options = array();

    $settings = $vbulletin->db->query_read("SELECT varname, value, datatype FROM " . TABLE_PREFIX . "setting");
    while ($setting = $vbulletin->db->fetch_array($settings))
    {
        $vbulletin->options["$setting[varname]"] = validate_setting_value($setting['value'], $setting['datatype'], true, false);
    }

    if (substr($vbulletin->options['cookiepath'], -1, 1) != '/')
    {
        $vbulletin->options['cookiepath'] .= '/';
        $vbulletin->db->query_write("
            UPDATE " . TABLE_PREFIX . "setting
            SET value = '" . $vbulletin->db->escape_string($vbulletin->options['cookiepath']) . "'
            WHERE varname = 'cookiepath'
        ");
    }

    build_datastore('options', serialize($vbulletin->options), 1);

    return $vbulletin->options;
}

关于php - 编辑 vBulletin 数据库对站点没有影响,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12842510/

相关文章:

php - MySql插入高CPU负载

php - 使用单选按钮控件从 PHP 获取 mysql 数据

C#:输入流不是有效的二进制格式

java - 为 JAXB 中生成的每个类生成唯一的可序列化 ID

ios - Swift - 可选属性的 JSON 序列化

php - 作为页面发布到 Facebook 页面墙

javascript - 从不同文件/页面导出

php - Laravel 5.4 PHP 要求(5.6.30 与 5.6.40)

java - 如何在hibernate中使用聚合函数编写查询?

mysql - 如何选择开始到(开始+长度)之间的计数