From 6fec9d682b1fff10386f96efbf5152d7abc9198b Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Mon, 9 Nov 2009 12:05:30 +0000 Subject: [PATCH] Follow-up to r58633 and r58628 (lqt): Rename Title::getProtectionTypes to Title::getRestrictionTypes and fix the hook name. --- docs/hooks.txt | 10 +++++----- includes/Article.php | 2 +- includes/ProtectionForm.php | 2 +- includes/Title.php | 9 ++++----- includes/api/ApiProtect.php | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index f184b47bac..45757b0ff4 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1260,11 +1260,6 @@ $errorMsg: an html message string of an error $article: the page the form is shown for $out: OutputPage object -'ProtectionFormGetApplicableTypes': Allows extensions to modify the types of protection - that can be applied. -$title: The title in question. -&$types: The types of protection available. - 'RawPageViewBeforeOutput': Right before the text is blown out in action=raw &$obj: RawPage object &$text: The text that's going to be the output @@ -1503,6 +1498,11 @@ database result &$titleArray: set this to an object to override the default object returned $res: database result used to create the object +'TitleGetRestrictionTypes': Allows extensions to modify the types of protection + that can be applied. +$title: The title in question. +&$types: The types of protection available. + 'TitleMoveComplete': after moving an article (title) $old: old title $nt: new title diff --git a/includes/Article.php b/includes/Article.php index ca134a5c4d..3e344059e9 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2258,7 +2258,7 @@ class Article { public function updateRestrictions( $limit = array(), $reason = '', &$cascade = 0, $expiry = array() ) { global $wgUser, $wgContLang; - $restrictionTypes = $this->mTitle->getProtectionTypes(); + $restrictionTypes = $this->mTitle->getRestrictionTypes(); $id = $this->mTitle->getArticleID(); if ( $id <= 0 ) { diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index f457e9a7ce..658bab0c73 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -58,7 +58,7 @@ class ProtectionForm { // Set instance variables. $this->mArticle = $article; $this->mTitle = $article->mTitle; - $this->mApplicableTypes = $this->mTitle->getProtectionTypes(); + $this->mApplicableTypes = $this->mTitle->getRestrictionTypes(); // Check if the form should be disabled. // If it is, the form will be available in read-only to show levels. diff --git a/includes/Title.php b/includes/Title.php index 5594c083b0..be871f3ea4 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -971,7 +971,7 @@ class Title { public function isProtected( $action = '' ) { global $wgRestrictionLevels; - $restrictionTypes = $this->getProtectionTypes(); + $restrictionTypes = $this->getRestrictionTypes(); # Special pages have inherent protection if( $this->getNamespace() == NS_SPECIAL ) @@ -1885,7 +1885,7 @@ class Title { public function loadRestrictionsFromRows( $rows, $oldFashionedRestrictions = NULL ) { $dbr = wfGetDB( DB_SLAVE ); - $restrictionTypes = $this->getProtectionTypes(); + $restrictionTypes = $this->getRestrictionTypes(); foreach( $restrictionTypes as $type ){ $this->mRestrictions[$type] = array(); @@ -3768,7 +3768,7 @@ class Title { } - public function getProtectionTypes() { + public function getRestrictionTypes() { global $wgRestrictionTypes; $types = $this->exists() ? $wgRestrictionTypes : array('create'); @@ -3776,8 +3776,7 @@ class Title { $types[] = 'upload'; } - wfRunHooks( 'ProtectionFormGetApplicableTypes', - array( $this, &$types ) ); + wfRunHooks( 'TitleGetRestrictionTypes', array( $this, &$types ) ); return $types; } diff --git a/includes/api/ApiProtect.php b/includes/api/ApiProtect.php index d0fa3f2bf1..221dc02675 100644 --- a/includes/api/ApiProtect.php +++ b/includes/api/ApiProtect.php @@ -69,7 +69,7 @@ class ApiProtect extends ApiBase { $this->dieUsageMsg(array('toofewexpiries', count($expiry), count($params['protections']))); } - $restrictionTypes = $titleObj->getProtectionTypes(); + $restrictionTypes = $titleObj->getRestrictionTypes(); $protections = array(); $expiryarray = array(); -- 2.20.1