Bản mẫu:ExtensionInstall
- Download and move the extracted
ExtensionInstallfolder to yourextensions/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";
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.
| Uses Lua: |
Cách dùng
Installation instructions.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Extension name | 1 | Set the extension name manually.
| String | optional |
| Git submodule | git-submodule | Add --recurse-submodules to the git clone command | Boolean | optional |
| Vagrant role name | vagrant | If given, shows how to install extension with the Vagrant's enable-role command | String | optional |
| Download link | download-link | Overwrite the download link.
| URL | optional |
| LocalSettings early | localsettingsearly | Pass custom php code that the user should include in [[LocalSettings.php]] before the extension is loaded.
| Unknown | optional |
| LocalSettings | localsettings | Pass custom PHP code that the user should include in [[LocalSettings.php]].
| Unknown | optional |
| Database update | db-update | If the extension requires the update script to be run, set this parameter to any value. (For example, if it has one or more database tables that need to be created.)
| Boolean | optional |
| Composer | composer | If the extension uses Composer to manage dependencies, set this parameter to any value. Not that this does not indicate that the extension is able to be installed with Composer.
| Boolean | optional |
| Custom steps 0 | custom-steps0 | Additional steps before download, e.g. other required extensions (as an unordered "* list"). | Content | optional |
| Custom steps | custom-steps | Additional steps (as an unordered "* list"). | Content | optional |
| Supports registration | registration | 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. | String | optional |
| No registration version | no-registration-version | The MediaWiki version for which extension registration should not be used.
| Unknown | optional |
See also
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
MyExtensionfolder to yourextensions/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";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
CategoryTreefolder to yourextensions/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";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
MyExtensiontrong thư mụcextensions/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";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
MyExtensionfolder to yourextensions/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;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
MyExtensionfolder to yourextensions/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";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
MyExtensionfolder to yourextensions/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.
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
MyExtensionfolder to yourextensions/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-devtrong thư mục phần mở rộng. (Xem 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";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
MyExtensionfolder to yourextensions/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
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
MyExtensionfolder to yourextensions/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' );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
MyExtensionfolder to yourextensions/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' );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.39 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
MyExtensionfolder to yourextensions/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' );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
Exampletrong thư mụcextensions/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-devtrong thư mục phần mở rộng. (Xem 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
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