Manual:$wgExternalDiffEngine/zh

From Linux Web Expert

<translate> Content handlers and storage</translate>: $wgExternalDiffEngine
要使用的外部差异引擎的名称。
<translate> Introduced in version:</translate>1.6.0 (r12987)
<translate> Removed in version:</translate><translate> still in use</translate>
<translate> Allowed values:</translate>(字符串)或false
<translate> Default value:</translate>false

细节

要使用的外部差异引擎的名称,或设置为false以使用内部引擎。

可能的值:

  • false - 如果可用的话,使用wikidiff2 ,否则使用PHP实现。
  • 任何其他字符串都被视为外部差异可执行文件的路径。

The following values are no longer supported as of MW 1.32:

<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.32</tvar> is unsupported version</translate>">
<translate> ≤</translate> 1.32
<translate> MediaWiki version:</translate>
  • 'wikidiff2' - 作为PHP/HHVM模块实现的维基媒体的快速差分引擎。

The following values are no longer supported as of MW 1.27:

<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.27</tvar> is unsupported version</translate>">
<translate> ≤</translate> 1.27
<translate> MediaWiki version:</translate>
  • 'wikidiff' and 'wikidiff3' - 被视为false,以向后兼容。

The external engine should return HTML for a table row containing four columns (two 'marker/content' pairs). These can be collapsed into one for diff formats that don't require columns, e.g. <tr><td colspan="4"></td></tr>

此设置代替了$wgUseExternalDiffEngine

Example

To display diffs in the format of the common GNU diff program, it is necessary to wrap that executable in a small script such as the following. This is needed both to get the required HTML wrapper, and also because diff returns non-zero when inputs don't match (which they generally don't for wiki changes).

  • externaldiff.sh
    #!/bin/bash
    
    echo "<tr><td colspan=4><pre>"
    # @todo This should also escape HTML.
    diff "$1" "$2"
    DIFFRET=$?
    echo "</pre></td></tr>"
    
    if [[ $DIFFRET -eq 1 ]]; then
        exit 0
    else
        exit $DIFFRET
    fi
    
  • LocalSettings.php
    $wgDiffEngine = 'external';
    $wgExternalDiffEngine = '/path/to/externaldiff.sh';
    

See also