Manual:Protect.php

Category:MediaWiki code#Protect.php

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/run.php protect title [ --unprotect| --semiprotect| --cascade| --user| --reason ]
In MediaWiki version 1.39.12 and earlier, you must invoke maintenance scripts using php maintenance/scriptName.php instead of php maintenance/run.php scriptName.

Allowing only autoconfirmed users to edit the page

Terminal

Allowing only sysop users to edit the page

Terminal

Removing protection from a page

Terminal

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

See also

Category:Maintenance scripts Category:Content maintenance scripts
Category:Content maintenance scripts Category:Maintenance scripts Category:MediaWiki code