Mediawiki死于FileBackendException:'后端名称`shared-backend`已经注册'

时间:2016-03-09 17:11:41

标签: mediawiki

我正在尝试设置Mediawiki。我已经确认我可以加载特殊页面(其中任何一个),但是当涉及到常规页面时,该网站会因以下内容而死亡:

Exception encountered, of type "FileBackendException"
[32b52f48] /Main_Page FileBackendException from line 125 of /......../mediawiki/includes/filebackend/FileBackendGroup.php: Backend with name `shared-backend` already registered.
Backtrace:
#0 /......../mediawiki/includes/filebackend/FileBackendGroup.php(109): FileBackendGroup->register(array)
#1 /......../mediawiki/includes/filebackend/FileBackendGroup.php(47): FileBackendGroup->initFromGlobals()
#2 /......../mediawiki/includes/filerepo/FileRepo.php(152): FileBackendGroup::singleton()
#3 /......../mediawiki/includes/filerepo/LocalRepo.php(54): FileRepo->__construct(array)
#4 /......../mediawiki/includes/filerepo/RepoGroup.php(418): LocalRepo->__construct(array)
#5 /......../mediawiki/includes/filerepo/RepoGroup.php(403): RepoGroup->newRepo(array)
#6 /......../mediawiki/includes/filerepo/RepoGroup.php(228): RepoGroup->initialiseRepos()
#7 /......../mediawiki/includes/GlobalFunctions.php(4079): RepoGroup->checkRedirect(Title)
#8 /......../mediawiki/includes/parser/Parser.php(2247): wfIsBadImage(string, Title)
#9 /......../mediawiki/includes/parser/Parser.php(2013): Parser->replaceInternalLinks2(string)
#10 /......../mediawiki/includes/parser/Parser.php(1262): Parser->replaceInternalLinks(string)
#11 /......../mediawiki/includes/parser/Parser.php(439): Parser->internalParse(string)
#12 /......../mediawiki/includes/content/WikitextContent.php(331): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#13 /......../mediawiki/includes/content/AbstractContent.php(497): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)
#14 /......../mediawiki/includes/poolcounter/PoolWorkArticleView.php(140): AbstractContent->getParserOutput(Title, integer, ParserOptions)
#15 /......../mediawiki/includes/poolcounter/PoolCounterWork.php(123): PoolWorkArticleView->doWork()
#16 /......../mediawiki/includes/page/Article.php(676): PoolCounterWork->execute()
#17 /......../mediawiki/includes/actions/ViewAction.php(44): Article->view()
#18 /......../mediawiki/includes/MediaWiki.php(490): ViewAction->show()
#19 /......../mediawiki/includes/MediaWiki.php(287): MediaWiki->performAction(Article, Title)
#20 /......../mediawiki/includes/MediaWiki.php(714): MediaWiki->performRequest()
#21 /......../mediawiki/includes/MediaWiki.php(508): MediaWiki->main()
#22 /......../mediawiki/index.php(41): MediaWiki->run()
#23 {main}

不幸的是,除了this之外,没有任何文档可以找到处理此异常的文档。

我已经尝试禁用所有扩展,认为其中一些可能有问题,生成一些需要保留为单例的对象,但这没有帮助。

$wgFileBackends仅在DefaultSettings.php中定义一次。

# grep -R 'wgFileBackends' .
./includes/DefaultSettings.php: * The name "local-fs" should correspond by name to an entry in $wgFileBackends.
./includes/DefaultSettings.php: * @see $wgFileBackends
./includes/DefaultSettings.php: *   - backend          A file backend name (see $wgFileBackends).
./includes/DefaultSettings.php:$wgFileBackends = array();
./includes/filebackend/FileBackendGroup.php:            global $wgLocalFileRepo, $wgForeignFileRepos, $wgFileBackends;
./includes/filebackend/FileBackendGroup.php:            $this->register( $wgFileBackends );
./includes/filebackend/README:$wgFileBackends. To access one of those defined backends, one would use
./includes/externalstore/ExternalStoreMwstore.php: * The file backends must be defined in $wgFileBackends and must be global
./tests/phpunit/includes/filebackend/FileBackendTest.php:               global $wgFileBackends;
./tests/phpunit/includes/filebackend/FileBackendTest.php:                               foreach ( $wgFileBackends as $conf ) {
./tests/phpunit/includes/filerepo/StoreBatchTest.php:           global $wgFileBackends;
./tests/phpunit/includes/filerepo/StoreBatchTest.php:                   foreach ( $wgFileBackends as $conf ) {
./tests/phpunit/includes/parser/NewParserTest.php:              global $wgFileBackends;
./tests/phpunit/includes/parser/NewParserTest.php:                              foreach ( $wgFileBackends as $conf ) {

1 个答案:

答案 0 :(得分:1)

感谢Tgr的评论,我能够找到答案。

问题是LocalSettings.php中定义的$wgForeignFileRepos数组。它是从Mediawiki的早期版本中删除的,显然这些名称不是问题所在。

给予细胞的名称是不同的,没有一个可以标题为“共享”。这一点实际上是在$wgForeignFileRepos文档页面上进行的:

$wgForeignFileRepos[] = array(
   'class'                   => 'ForeignAPIRepo',
   'name'                    => 'commonswiki', // Must be a distinct name
   'apibase'                 => 'https://commons.wikimedia.org/w/api.php',
   'hashLevels'              => 2,
   ...
   );