Harej has uploaded a new change for review. https://gerrit.wikimedia.org/r/308299
Change subject: Adds a new hook called AllowCustomContentModel. ...................................................................... Adds a new hook called AllowCustomContentModel. This hook is meant to be used by extensions that implement novel content models through pre-specified workflows such as special pages. The reasoning is that if if the creation of a page with a non-default model is governed by a specific workflow and not from arbitrarily changing a page's content model, then the permissions should be based on the user's general ability to create pages. This hook is used in CollaborationKit to allow Special:CreateCollaborationHub to be used by non-admins. Change-Id: Id052508d88f245526c5e75b0fb69c9601f82a5cd --- M includes/EditPage.php 1 file changed, 10 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/99/308299/1 diff --git a/includes/EditPage.php b/includes/EditPage.php index e0080fa..090d652 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1809,14 +1809,15 @@ $changingContentModel = false; if ( $this->contentModel !== $this->mTitle->getContentModel() ) { - if ( !$wgContentHandlerUseDB ) { - $status->fatal( 'editpage-cannot-use-custom-model' ); - $status->value = self::AS_CANNOT_USE_CUSTOM_MODEL; - return $status; - } elseif ( !$wgUser->isAllowed( 'editcontentmodel' ) ) { - $status->setResult( false, self::AS_NO_CHANGE_CONTENT_MODEL ); - return $status; - + if ( !Hooks::run( 'AllowCustomContentModel', array( $this->mTitle, &$wgUser ) ) === false) { + if ( !$wgContentHandlerUseDB ) { + $status->fatal( 'editpage-cannot-use-custom-model' ); + $status->value = self::AS_CANNOT_USE_CUSTOM_MODEL; + return $status; + } elseif ( !$wgUser->isAllowed( 'editcontentmodel' ) ) { + $status->setResult( false, self::AS_NO_CHANGE_CONTENT_MODEL ); + return $status; + } } $changingContentModel = true; $oldContentModel = $this->mTitle->getContentModel(); @@ -4280,4 +4281,4 @@ // reverse the transform that we made for reversibility reasons. return strtr( $result, [ "�" => "&#x" ] ); } -} +} \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/308299 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id052508d88f245526c5e75b0fb69c9601f82a5cd Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Harej <jamesmh...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits