Bản mẫu:ExtensionInstall

From mediawiki.org
This page is a translated version of the page Template:ExtensionInstall and the translation is 59% complete.
Outdated translations are marked like this.
  • Download and move the extracted ExtensionInstall folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/ExtensionInstall
  • Thêm mã sau vào dưới cùng tệp $LocalSettings của bạn:
    require_once "$IP/extensions/ExtensionInstall/ExtensionInstall.php";
    
  • Yes Xong – Chuyển tới Special:Version trên wiki của bạn để xác nhận phần mở rộng được cài đặt thành công.
Template documentation

Cách dùng

Installation instructions.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Extension name1

Set the extension name manually.

Default
The current page name without namespace prefix.
Auto value
{{ROOTPAGENAME}}
Stringoptional
Git submodulegit-submodule

Add --recurse-submodules to the git clone command

Booleanoptional
Vagrant role namevagrant

If given, shows how to install extension with the Vagrant's enable-role command

Stringoptional
Download linkdownload-link

Overwrite the download link.

Default
Link to Special:ExtensionDistributor with the extension name.
URLoptional
LocalSettings earlylocalsettingsearly

Pass custom php code that the user should include in [[LocalSettings.php]] before the extension is loaded.

Example
$wgUseAjax = true; //must be included before the extension is loaded
Unknownoptional
LocalSettingslocalsettings

Pass custom php code that the user should include in [[LocalSettings.php]].

Example
$wgUseAjax = true;
Unknownoptional
Database updatedb-update

If the extension has one or more database tables that need to be created through [[update.php]], set this parameter to any value.

Default
false
Booleanoptional
Composercomposer

If the extension uses [[Composer]] to manage dependencies, set this parameter to any value.

Default
false
Booleanoptional
Custom steps 0custom-steps0

Additional steps before download, e.g. other required extensions (as an unordered "* list")

Contentoptional
Custom stepscustom-steps

Additional steps (as an unordered "* list")

Contentoptional
Supports registrationregistration

Changes the template to use <code>wfLoadExtension()</code> if it supports registration. Set to any value if the extension supports registration, or to <code>required</code> if it <em>only</em> supports registration and doesn't support the old-style of loading.

Stringoptional
No registration versionno-registration-version

The MediaWiki version for which extension registration should not be used

Default
1.24
Unknownoptional

Ví dụ

Dưới đây là một vài ví dụ về cách sử dụng bản mẫu này:

Đơn giản

{{ExtensionInstall}}
  • Download and move the extracted MyExtension folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MyExtension
  • Thêm mã sau vào dưới cùng tệp $LocalSettings của bạn:
    require_once "$IP/extensions/MyExtension/MyExtension.php";
    
  • Yes Xong – Chuyển tới Special:Version trên wiki của bạn để xác nhận phần mở rộng được cài đặt thành công.

Tên

{{ExtensionInstall|CategoryTree}}
  • Download and move the extracted CategoryTree folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree
  • Thêm mã sau vào dưới cùng tệp $LocalSettings của bạn:
    require_once "$IP/extensions/CategoryTree/CategoryTree.php";
    
  • Yes Xong – Chuyển tới Special:Version trên wiki của bạn để xác nhận phần mở rộng được cài đặt thành công.

Link tải

{{ExtensionInstall
|download-link=[http://bits.wikimedia.org/example.zip Download]
}}
  • Tải và đặt (các) tệp trong một thư mục với tên MyExtension trong thư mục extensions/ của bạn.
  • Thêm mã sau vào dưới cùng tệp $LocalSettings của bạn:
    require_once "$IP/extensions/MyExtension/MyExtension.php";
    
  • Yes Xong – Chuyển tới Special:Version trên wiki của bạn để xác nhận phần mở rộng được cài đặt thành công.

LocalSettings

{{ExtensionInstall
|localsettings=
$wgUseAjax = true;
}}
  • Download and move the extracted MyExtension folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MyExtension
  • Thêm mã sau vào dưới cùng tệp $LocalSettings của bạn:
    require_once "$IP/extensions/MyExtension/MyExtension.php";
    $wgUseAjax = true;
    
  • Yes Xong – Chuyển tới Special:Version trên wiki của bạn để xác nhận phần mở rộng được cài đặt thành công.

LocalSettings early

{{ExtensionInstall
|localsettingsearly=
$wgUseAjax = true; // this must be included before the extension is loaded
}}
  • Download and move the extracted MyExtension folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MyExtension
  • Thêm mã sau vào dưới cùng tệp $LocalSettings của bạn:
    $wgUseAjax = true; // this must be included before the extension is loaded
    require_once "$IP/extensions/MyExtension/MyExtension.php";
    
  • Yes Xong – Chuyển tới Special:Version trên wiki của bạn để xác nhận phần mở rộng được cài đặt thành công.

Cập nhật CSDL

{{ExtensionInstall
|db-update=Yes
}}
  • Download and move the extracted MyExtension folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MyExtension
  • Thêm mã sau vào dưới cùng tệp $LocalSettings của bạn:
    require_once "$IP/extensions/MyExtension/MyExtension.php";
    
  • Chạy mã cập nhật mà sẽ tự động tạo các bảng cơ sở dữ liệu mà phần mở rộng này cần.
  • Yes Xong – Chuyển tới Special:Version trên wiki của bạn để xác nhận phần mở rộng được cài đặt thành công.

Composer

{{ExtensionInstall
|composer=Yes
}}
  • Download and move the extracted MyExtension folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MyExtension
  • Only when installing from git, Chạy Composer để cài đặt các phần phụ thuộc PHP, bằng cách cung cấp composer install --no-dev trong thư mục phần mở rộng. (Xem task T173141 để biết các xung đột có thể xảy ra.)
  • Thêm mã sau vào dưới cùng tệp $LocalSettings của bạn:
    require_once "$IP/extensions/MyExtension/MyExtension.php";
    
  • Yes Xong – Chuyển tới Special:Version trên wiki của bạn để xác nhận phần mở rộng được cài đặt thành công.

Các bước tùy biến

{{ExtensionInstall
|custom-steps=
* Lorem ipsum dolor sit amet
* Foo bar baz quux [[sandbox]]
}}
  • Download and move the extracted MyExtension folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MyExtension
  • Thêm mã sau vào dưới cùng tệp $LocalSettings của bạn:
    require_once "$IP/extensions/MyExtension/MyExtension.php";
    
  • Lorem ipsum dolor sit amet
  • Foo bar baz quux sandbox
  • Yes Xong – Chuyển tới Special:Version trên wiki của bạn để xác nhận phần mở rộng được cài đặt thành công.

Hỗ trợ đăng kí

{{ExtensionInstall
|registration=1
}}
  • Download and move the extracted MyExtension folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MyExtension
  • Thêm mã sau vào dưới cùng tệp $LocalSettings của bạn:
    wfLoadExtension( 'MyExtension' );
    
  • Yes Xong – Chuyển tới Special:Version trên wiki của bạn để xác nhận phần mở rộng được cài đặt thành công.

Support registration with minimum version

{{ExtensionInstall
|registration=1
|no-registration-version=1.39
}}
  • Download and move the extracted MyExtension folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MyExtension
  • Thêm mã sau vào dưới cùng tệp $LocalSettings của bạn:
    wfLoadExtension( 'MyExtension' );
    
  • Yes Xong – Chuyển tới Special:Version trên wiki của bạn để xác nhận phần mở rộng được cài đặt thành công.

Dành cho những người đang dùng MediaWiki 1.39 trở xuống:

Những chỉ dẫn bên trên diễn tả cách mới để cài phần mở rộng này sử dụng wfLoadExtension(). Nếu bạn muốn cài đặt phần mở rộng này trong những phiên bản cũ hơn, thay vì wfLoadExtension( 'MyExtension' );, bạn cần dùng:

require_once "$IP/extensions/MyExtension/MyExtension.php";

This only works if the version specified is 1.35 or later, otherwise the template assumes nobody cares about ancient versions and falls back to #Require registration.

Yêu cầu đăng kí

{{ExtensionInstall
|registration=required
}}
  • Download and move the extracted MyExtension folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MyExtension
  • Thêm mã sau vào dưới cùng tệp $LocalSettings của bạn:
    wfLoadExtension( 'MyExtension' );
    
  • Yes Xong – Chuyển tới Special:Version trên wiki của bạn để xác nhận phần mở rộng được cài đặt thành công.

Tất cả

{{ExtensionInstall|Example
|download-link=[http://bits.wikimedia.org/example.zip Download]
|vagrant=example
|localsettings=
$wgUseAjax = true;

|db-update=Yes
|composer=Yes
|custom-steps=
* Lorem ipsum dolor sit amet
* Foo bar baz quux [[sandbox]]
|registration=yes
}}
  • Tải và đặt (các) tệp trong một thư mục với tên Example trong thư mục extensions/ của bạn.
  • Only when installing from git, Chạy Composer để cài đặt các phần phụ thuộc PHP, bằng cách cung cấp composer install --no-dev trong thư mục phần mở rộng. (Xem task T173141 để biết các xung đột có thể xảy ra.)
  • Thêm mã sau vào dưới cùng tệp $LocalSettings của bạn:
    wfLoadExtension( 'Example' );
    $wgUseAjax = true;
    
  • Chạy mã cập nhật mà sẽ tự động tạo các bảng cơ sở dữ liệu mà phần mở rộng này cần.
  • Lorem ipsum dolor sit amet
  • Foo bar baz quux sandbox
  • Yes Xong – Chuyển tới Special:Version trên wiki của bạn để xác nhận phần mở rộng được cài đặt thành công.

Dành cho những người đang dùng MediaWiki 1.39 trở xuống:

Những chỉ dẫn bên trên diễn tả cách mới để cài phần mở rộng này sử dụng wfLoadExtension(). Nếu bạn muốn cài đặt phần mở rộng này trong những phiên bản cũ hơn, thay vì wfLoadExtension( 'Example' );, bạn cần dùng:

require_once "$IP/extensions/Example/Example.php";


Vagrant installation:

  • Nếu sử dụng Vagrant , cài đặt bằng vagrant roles enable example --provision