手册:Protect.php
Appearance
| MediaWiki文件: protect.php | |
|---|---|
| 位置: | maintenance/ |
| 源代码: | master • 1.45.3 • 1.44.5 • 1.43.8 |
| 类: | Protect |
细节
“protect.php”文件是一个维护脚本,用于处理对页面的保护和取消保护。
选项/参数
This script takes the title of the page as the first argument.
Tip: Spaces inside a title must be replaced with underscores ( _ ), or use double quotation marks like "Foo Bar"
This script accepts these options:
| 选项 | 必需 | 默认值 | |
|---|---|---|---|
| --unprotect | Removes protection | Optional | |
| --semiprotect | Adds semi-protection | Optional | |
| --cascade | Add cascading protection | Optional | |
| --user | Username to protect with | Optional | |
| --reason | Reason for un/protection | Optional |
用法
php maintenance/run.php protect title [ --unprotect| --semiprotect| --cascade| --user| --reason ]
在MediaWiki MediaWiki 1.39及更早版本中,您必须通过
php maintenance/脚本名称.php调用维护脚本,而不是php maintenance/run.php 脚本名称。Allowing only autoconfirmed users to edit the page
Terminal
$ php maintenance/run.php protect "Lorem" --semiprotect --reason "Allowing only autoconfirmed users to edit" Updating protection status... done
Allowing only sysop users to edit the page
Terminal
$ php maintenance/run.php protect "Lorem" --cascade --reason "Allowing only sysop users to edit" Updating protection status... done
Removing protection from a page
Terminal
$ php maintenance/run.php protect "Lorem" --unprotect --reason "Removing protection" Updating protection status... done
Protecting a page as username "Foo"
If you don't pass the --user option to the script, it will perform the action with user User:Maintenance script.
Terminal
$ php maintenance/run.php protect "Lorem" --cascade --user "Foo" --reason "Allowing only sysop users to edit" Updating protection status... done