Topic on User talk:星耀晨曦

你说我们要怎样才能使用维基百科的模板啊?

36
AndyPKU (talkcontribs)

比如我觉得维基百科的模板很好用,想用在自己的mw站上,应该怎么做呢?(我曾经尝试把它们的源代码复制到我的网站上来,但是发现还是会出现乱码。。)

星耀晨曦 (talkcontribs)

利用导出功能和导入功能。

AndyPKU (talkcontribs)

哟,还能导出导入。。。

AndyPKU (talkcontribs)

怎么导出导入啊?我在帮助:模板里面没有找到相应的解决方案啊。

星耀晨曦 (talkcontribs)
AndyPKU (talkcontribs)

我原先还想说直接复制粘贴它们的源代码不就完事了嘛。。可是发现这样不行。。。

星耀晨曦 (talkcontribs)

如果一个模版不包含另一个模版的话,复制粘贴也可以。但导出功能可以批量导出一个模板和这个模板所依赖的所有其它模板。

AndyPKU (talkcontribs)

Wikipedia

   zhwiki
   https://zh.wikipedia.org/wiki/Wikipedia:%E9%A6%96%E9%A1%B5
   MediaWiki 1.31.0-wmf.17
   first-letter
   
     Media
     Special
     
     Talk
     User
     User talk
     Wikipedia
     Wikipedia talk
     File
     File talk
     MediaWiki
     MediaWiki talk
     Template
     Template talk
     Help
     Help talk
     Category
     Category talk
     Portal
     Portal talk
     Draft
     Draft talk
     模块
     模块讨论
     Gadget
     Gadget talk
     Gadget definition
     Gadget definition talk
     Topic
   
 
 
   Template:艺人
   10
   5903294
   
   
     46301744
     2017-09-22T22:17:13Z
     
       Raymon090
       2170119
     
     编辑工具:自动创建重定向到[[Template:藝人]]
     wikitext
     text/x-wiki
     #REDIRECT [[Template:藝人]]

{{簡繁重定向}}

     dmwuzejkar3hvr9dzc6my8spdfhw4su

这个是导出以后出现的文字(或者说代码?)但是并不是一个文件。。。

AndyPKU (talkcontribs)

我好像搞清楚如何导出导入了。不过我在导入页面的时候好像出了一些问题。

AndyPKU (talkcontribs)

我用你的方式导入了几个页面(包含模板),为什么会出错呢?

AndyPKU (talkcontribs)

江西铜业股份

wikify]]{{#if:||{{{arg}}}}} 等。此外本模板具有自由選擇不同顏色、顯示特定預設圖片等功能。

请注意:这个模板只用于在条目名字空间使用的模板,其他名字空间使用的模板请不要使用。

星耀晨曦 (talkcontribs)

AndyPKU (talkcontribs)

我把『江西铜业股份』从维基百科里面导出来了xml格式,然后再在我的mw站上导入,结果就出现了这样的问题。。我不知道是什么情况。。

星耀晨曦 (talkcontribs)

可能是模版的问题,一个一个的排查。

AndyPKU (talkcontribs)

那为什么在维基百科上能够得到完美的呈现,可是在我的站点上却不能呢?

星耀晨曦 (talkcontribs)

主要是mediawiki:common.css的问题。维基百科把大部分共用的样式放到这里,许多模板也依赖这个页面。

AndyPKU (talkcontribs)

我把维基百科的这个页面导到我的站点上去是不是就可以解决问题了?

星耀晨曦 (talkcontribs)

起码可以解决大部分问题。

AndyPKU (talkcontribs)

还是没有解决。。。导入之后。。

星耀晨曦 (talkcontribs)

。。。你能提供你的维基站点的URL和问题模板的URL吗。

AndyPKU (talkcontribs)
星耀晨曦 (talkcontribs)

额,我现在这里看是HTTP 500。

AndyPKU (talkcontribs)

好吧,这个可能是我下午在安装扩展的时候失败所致。你说要怎么恢复回去比较好呢?

星耀晨曦 (talkcontribs)

注释掉加载扩展的语句。

AndyPKU (talkcontribs)

你说的是localsettings.php的设置啊,那个我已经注释掉了。。没有用。。

AndyPKU (talkcontribs)

Fatal error: Uncaught Error: Call to a member function getCode() on null in /var/www/html/includes/user/User.php:1594 Stack trace: #0 /var/www/html/includes/user/User.php(5272): User::getDefaultOptions() #1 /var/www/html/includes/user/User.php(2884): User->loadOptions() #2 /var/www/html/includes/context/RequestContext.php(364): User->getOption('language') #3 /var/www/html/includes/Message.php(380): RequestContext->getLanguage() #4 /var/www/html/includes/Message.php(1275): Message->getLanguage() #5 /var/www/html/includes/Message.php(842): Message->fetchMessage() #6 /var/www/html/includes/Message.php(934): Message->toString('text') #7 /var/www/html/includes/exception/MWExceptionRenderer.php(200): Message->text() #8 /var/www/html/includes/exception/MWExceptionRenderer.php(304): MWExceptionRenderer::msg('dberr-again', 'Try waiting a f...') #9 /var/www/html/includes/exception/MWExceptionRenderer.php(51): MWExceptionRenderer::reportOutageHTML(Object(Wikimedia\Rdbms\DBConnectionError)) #10 /var/www/html/includes/exception/MWExce in /var/www/html/includes/user/User.php on line 1594

你说这样的错误提示,应该怎么破?

我还在想,要是有类似windows的系统还原就好了。我把整个配置回滚到某个时间点,问题就全解决了。。但是似乎没有?

星耀晨曦 (talkcontribs)

添加了什么,就删掉什么。

如果要记录配置的时间点的话可以使用git

AndyPKU (talkcontribs)

我把下载的扩展给删了。我把localsettings.php的相关语句也都删了。。但是好像还没有解决空白页的问题。。

AndyPKU (talkcontribs)

那是不是能够让网站的设置回到初始状态呢?

星耀晨曦 (talkcontribs)

你可以重新运行一遍安装程序(mw-config/index.php)来生成一个新的LocalSettings.php文件。

星耀晨曦 (talkcontribs)

尝试把所有这种wfLoadExtension()require_once加载扩展的语句注释掉。

AndyPKU (talkcontribs)

我可以加你qq或者微信吗?

AndyPKU (talkcontribs)

全部注释掉了。。还是没用。。

星耀晨曦 (talkcontribs)

qq:1509251138

AndyPKU (talkcontribs)

已添加。。