jenkins-bot has submitted this change and it was merged. Change subject: Replace ArticleSave hook usage ......................................................................
Replace ArticleSave hook usage Bug: T147390 Change-Id: I1634cab17a861459c4cf40aadcf37c7559e04a11 --- M Emoticons/Emoticons.class.php M PageAccess/PageAccess.class.php 2 files changed, 12 insertions(+), 13 deletions(-) Approvals: Pwirth: Looks good to me, approved jenkins-bot: Verified diff --git a/Emoticons/Emoticons.class.php b/Emoticons/Emoticons.class.php index 25872db..f254d06 100644 --- a/Emoticons/Emoticons.class.php +++ b/Emoticons/Emoticons.class.php @@ -51,7 +51,7 @@ protected function initExt() { wfProfileIn( 'BS::'.__METHOD__ ); $this->setHook( 'OutputPageBeforeHTML' ); - $this->setHook( 'ArticleSave' ); + $this->setHook( 'PageContentSave' ); wfProfileOut( 'BS::'.__METHOD__ ); } @@ -136,9 +136,9 @@ /** * Hook-Handler for 'ArticleSave' (MediaWiki). Validates provided mapping syntax for Emoticons. - * @param Article $oArticle The article object being saved + * @param WikiPage $owikiPage The article object being saved * @param User $oUser The user object saving the article - * @param string $sText The new article text + * @param Content $oContent The new article text * @param string $sSummary The article summary (comment) * @param bool $bIsMinor Minor flag * @param bool $bIsWatch Watch flag @@ -148,12 +148,12 @@ * @global MWMemcached $wgMemc The MediaWiki Memcached object * @return mixed Boolean true if syntax is okay or the saved article is not the MappingSourceArticle, String 'error-msg' if an error occurs. */ - public function onArticleSave( $oArticle, $oUser, $sText, $sSummary, $bIsMinor, $bIsWatch, $iSection, &$iFlags, $oStatus ) { + public function onPageContentSave( $owikiPage, $oUser, $oContent, $sSummary, $bIsMinor, $bIsWatch, $iSection, &$iFlags, $oStatus ) { global $wgMemc; $oMappingSourceTitle = Title::newFromText( 'bs-emoticons-mapping', NS_MEDIAWIKI ); - if( !$oMappingSourceTitle->equals( $oArticle->getTitle() ) ) return true; + if( !$oMappingSourceTitle->equals( $owikiPage->getTitle() ) ) return true; - $aLines = explode( "\n" , $sText ); + $aLines = explode( "\n" , $oContent->getNativeData() ); foreach( $aLines as $iLineNumber => $sLine ) { $iLineNumber++; diff --git a/PageAccess/PageAccess.class.php b/PageAccess/PageAccess.class.php index a7b3b76..2bbbc0b 100644 --- a/PageAccess/PageAccess.class.php +++ b/PageAccess/PageAccess.class.php @@ -40,7 +40,7 @@ class PageAccess extends BsExtensionMW { protected function initExt() { wfProfileIn( 'BS::'.__METHOD__ ); - $this->setHook( 'ArticleSave' ); + $this->setHook( 'PageContentSave' ); $this->setHook( 'ParserFirstCallInit' ); $this->setHook( 'userCan' ); $this->setHook( 'BSInsertMagicAjaxGetData', 'onBSInsertMagicAjaxGetData' ); @@ -51,10 +51,9 @@ wfProfileOut( 'BS::'.__METHOD__ ); } - public function onArticleSave( &$article, &$user, &$text, &$summary, $minor, $watchthis, $sectionanchor, &$flags, &$status ) { + public function onPageContentSave( &$wikiPage, &$user, &$content, &$summary, $minor, $watchthis, $sectionanchor, &$flags, &$status ) { # Prevent user from locking himself out of his own page - $content = ContentHandler::makeContent( $text, $article->getTitle() ); - $oEditInfo = $article->prepareContentForEdit( $content, null, $user ); + $oEditInfo = $wikiPage->prepareContentForEdit( $content, null, $user ); $sAccessGroups = $oEditInfo->output->getProperty( 'bs-page-access' ); if ( !$this->checkAccessGroups( $user, $sAccessGroups ) ) { $err[0] = 'bs-pageaccess-error-not-member-of-given-groups'; @@ -63,7 +62,7 @@ } # Also check if user includes forbidden templates - $aTemplateTitles = $this->getTemplateTitles( $text ); + $aTemplateTitles = $this->getTemplateTitles( $content->getNativeData() ); foreach ( $aTemplateTitles as $oTemplateTitle ) { if ( !$this->isUserAllowed( $oTemplateTitle, $user ) ) { $err[0] = 'bs-pageaccess-error-included-forbidden-template'; @@ -76,13 +75,13 @@ $dbr = wfGetDB( DB_SLAVE ); $sAccessGroupsOld = $dbr->selectField( 'page_props', 'pp_value', array ( - 'pp_page' => $article->getTitle()->getArticleID(), + 'pp_page' => $wikiPage->getTitle()->getArticleID(), 'pp_propname' => 'bs-page-access' ), __METHOD__ ); if ( $sAccessGroups != $sAccessGroupsOld ) { // Create a log entry for the change on the page-access settings - $oTitle = $article->getTitle(); + $oTitle = $wikiPage->getTitle(); $oUser = RequestContext::getMain()->getUser(); $oLogger = new ManualLogEntry( 'bs-pageaccess', 'change' ); $oLogger->setPerformer( $oUser ); -- To view, visit https://gerrit.wikimedia.org/r/315224 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1634cab17a861459c4cf40aadcf37c7559e04a11 Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions Gerrit-Branch: master Gerrit-Owner: Paladox <thomasmulhall...@yahoo.com> Gerrit-Reviewer: Dvogel hallowelt <daniel.vo...@hallowelt.com> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: Ljonka <l.verhovs...@gmail.com> Gerrit-Reviewer: Mglaser <gla...@hallowelt.biz> Gerrit-Reviewer: Paladox <thomasmulhall...@yahoo.com> Gerrit-Reviewer: Pwirth <wi...@hallowelt.biz> Gerrit-Reviewer: Reedy <re...@wikimedia.org> Gerrit-Reviewer: Robert Vogel <vo...@hallowelt.biz> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits