扩展:Cargo/下载与安装

From mediawiki.org
This page is a translated version of the page Extension:Cargo/Download and installation and the translation is 70% complete.

下載

你可以在这里下载.zip模式的Cargo源代码: https://github.com/wikimedia/mediawiki-extensions-Cargo/archive/3.5.1.zip

您也可以直接从MediaWiki源代码库通过Git下载代码(参见可用标签)。 从扩展目录的命令行,运行以下代码:

git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Cargo

如需在线查看代码,包括每个文件的历史版本,请在此处: view Cargo code

安裝

要安装扩展,将整个“Cargo”目录放在您的MediaWiki的“extensions”目录下,然后在您的LocalSettings.php文件中加入如下代码:

wfLoadExtension( 'Cargo' );

设置了代码之后,Cargo会在需要的主数据库中有两个数据库表格。 你需要通过前往MediaWiki的maintenance目录下通过以下代码设置:

php update.php

最终,你需要确保代码关联数据库的数据库账户有能力创建和删除表格。 这个可能是或不是标准的MediaWiki数据库账户,见下。

设置Cargo数据库

默认情况下,Cargo使用标准的MediaWiki数据库来存储其数据。 (如果你通过$wgDBservers 设置了多个数据库,则使用这些数据库中的第一个。) Cargo会通过其所有名称以前缀开头来区分它的数据库表和所有其他表,前缀默认为“cargo__”。

你可以改变它来使得Cargo使用其他的数据库。 (虽然Cargo的两个helper表,cargo_tables和cago_pages会留存在主要的MediaWiki数据库中。) 最好使用单独的数据库,有以下两个原因:

  • Cargo可能有安全漏洞,比如,Cargo查询允许包含允许用户访问不应该访问的信息的恶意SQL,或者甚至修改数据库。 There are no known security leaks - and Cargo uses a lot of safeguards to try to prevent any such leaks - but that does not mean that no leak exists. If there is any such vulnerability, having a separate database using a separate database user with restricted permissions is the safer option.
  • If slow, intensive queries are run, either unknowingly or maliciously, having a separate database on a separate database server would prevent such queries from interfering with the regular operation of the wiki.

Cargo offers the following global settings to let you set a separate database:

  • $wgCargoDBtype
  • $wgCargoDBserver
  • $wgCargoDBname
  • $wgCargoDBuser
  • $wgCargoDBpassword
  • $wgCargoDBprefix

These are set in the same way as their non-Cargo equivalents, which can be found in LocalSettings.php. To set this custom database, add lines for at least the first five variables to LocalSettings.php; the sixth (for the prefix) is optional.

Permissions

The runcargoqueries permission governs access to Special:ViewData and Special:Drilldown and by default is true for everyone. This can be changed by following the instructions in Manual:User rights.

其它需求

  • If you plan to export data to an Excel spreadsheet, you need to install the PhpSpreadsheet library on your server.

This can be done by adding phpoffice/phpspreadsheet to your composer.local.json and running composer update --no-dev -o.

Upgrading

If you used 'git clone' to install Cargo, you can update to the very latest code for it with a simple command. It may not be a stable release.

From a command line in the Cargo directory, run the following:

git pull