Merge "Add protected & semiprotected notices to api."

This commit is contained in:
jenkins-bot 2013-07-10 22:59:09 +00:00 committed by Gerrit Code Review
commit 301948184c

View file

@ -265,6 +265,16 @@ class ApiVisualEditor extends ApiBase {
if ( $parsed && $parsed['restoring'] ) { if ( $parsed && $parsed['restoring'] ) {
$wgVisualEditorEditNotices[] = 'editingold'; $wgVisualEditorEditNotices[] = 'editingold';
} }
// Protected page
if ( $page->getNamespace() != NS_MEDIAWIKI && $page->isProtected( 'edit' ) ) {
# Is the title semi-protected?
if ( $page->isSemiProtected() ) {
$wgVisualEditorEditNotices[] = 'semiprotectedpagewarning';
} else {
# Then it must be protected based on static groups (regular)
$wgVisualEditorEditNotices[] = 'protectedpagewarning';
}
}
if ( count( $wgVisualEditorEditNotices ) ) { if ( count( $wgVisualEditorEditNotices ) ) {
foreach ( $wgVisualEditorEditNotices as $key ) { foreach ( $wgVisualEditorEditNotices as $key ) {
$notices[] = wfMessage( $key )->parseAsBlock(); $notices[] = wfMessage( $key )->parseAsBlock();