我正在尝试将 mediawiki 数据库从 1.10 升级到 1.23.10(1.25.2 也是如此)。我已按照 MediaWiki 升级页面中描述的所有步骤进行操作,但脚本失败并出现以下错误:
Updating indexes to 20031107 ...A database query error has occurred.
Query: ALTER TABLE IF EXISTS `links`
DROP INDEX l_from,
ADD INDEX l_from (l_from)
Function: DatabaseBase::sourceFile( patch-indexes.sql )
Error: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF EXISTS `links`\x0A DROP INDEX l_from,\x0A ADD INDEX l_from (l_from)' at line 1 (localhost)
PHP Notice: Uncommitted DB writes (transaction from DatabaseUpdater::doUpdates). in /home/max/newforum2/mediawiki-1.23.10/includes/db/Database.php on line 4147
我正在使用 PHP 5.5.9-1ubuntu4.13 (cli) 和 MySQL 5.5.44。
最佳答案
TiiJ7 said it already: The bug appears with the MediaWiki update script!
信息
ALTER TABLE IF EXISTS
仅适用于 PostgreSQL >=9.2。- 它已经通过Phabricator 报告给了维基媒体。 .
修复bug
Try to remove the
IF EXISTS
code part inpatch-indexes.sql
file in/maintenance/archives
folder!
来自这里:
ALTER TABLE IF EXISTS/*$wgDBprefix*/links
DROP INDEX l_from,
ADD INDEX l_from (l_from);
ALTER TABLE /*$wgDBprefix*/brokenlinks
DROP INDEX bl_to,
ADD INDEX bl_to (bL_to);
ALTER TABLE /*$wgDBprefix*/recentchanges
为此:
ALTER TABLE /*$wgDBprefix*/links
DROP INDEX l_from,
ADD INDEX l_from (l_from);
ALTER TABLE /*$wgDBprefix*/brokenlinks
DROP INDEX bl_to,
ADD INDEX bl_to (bL_to);
ALTER TABLE /*$wgDBprefix*/recentchanges
关于php - MediaWiki 1.25.2 升级脚本从 1.10 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32912697/