【问题标题】:Editing vBulletin database has no effect on the site编辑 vBulletin 数据库对站点没有影响
【发布时间】:2012-10-11 14:55:18
【问题描述】:

这是我在多个 vBulletin 数据库中一直存在的问题。我无法编辑数据库以更改 cookiepath、bburl 或它是否处于活动状态等设置。我的意思是,我可以使用 PHPMyAdmin 更改它们,但效果在网站上没有任何变化。

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

我已经验证了它是正确的数据库和正确的服务器,因为这种情况已经发生了很多次。也许我只是在这里遗漏了一些东西?我不知道。

【问题讨论】:

    标签: php mysql serialization vbulletin


    【解决方案1】:

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

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

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


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

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

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

    活动板的设置如下所示: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>";
    

    转到“datastore”表并在“title”字段中找到“options”条目。

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

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

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


    更新“设置”和“数据存储”表的函数位于此处:
    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;
    }
    

    【讨论】:

      猜你喜欢
      • 2020-04-25
      • 1970-01-01
      • 2018-06-04
      • 1970-01-01
      • 1970-01-01
      • 2022-06-13
      • 1970-01-01
      • 2020-08-03
      相关资源
      最近更新 更多