MediaWiki file: protect.php
Location: maintenance/
Source code: master 1.40.0 1.39.4 1.35.11
Classes: Protect

Details

protect.php file is a maintenance script that handles protecting and unprotecting a page.

Options/Arguments

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:

Option Required Default value
--unprotectRemoves protectionOptional
--semiprotectAdds semi-protectionOptional
--cascadeAdd cascading protectionOptional
--userUsername to protect withOptional
--reasonReason for un/protectionOptional

Usage

php maintenance/protect.php title [ --unprotect| --semiprotect| --cascade| --user| --reason ]

Allowing only autoconfirmed users to edit the page

Terminal
$ php maintenance/protect.php "Lorem" --semiprotect --reason "Allowing only autoconfirmed users to edit"

Updating protection status... done

Allowing only sysop users to edit the page

Terminal
$ php maintenance/protect.php "Lorem" --cascade --reason "Allowing only sysop users to edit"

Updating protection status... done


Removing protection from a page

Terminal
$ php maintenance/protect.php "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/protect.php "Lorem" --cascade --user "Foo" --reason "Allowing only sysop users to edit"

Updating protection status... done

See also

This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.