r111335 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111334‎ | r111335 | r111336 >
Date:23:10, 12 February 2012
Author:jeroendedauw
Status:ok (Comments)
Tags:
Comment:
follow up to r111017, move hook to isAlwatsKnown as per discussion on CR
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.20 (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -1903,7 +1903,7 @@
19041904 $title: Title object that is being checked
19051905 $result: Boolean; whether MediaWiki currently thinks this is a CSS/JS page. Hooks may change this value to override the return value of Title::isCssOrJsPage()
19061906
1907 -'TitleIsKnown': Called when determining if a page exists.
 1907+'TitleIsAlwaysKnown': Called when determining if a page exists.
19081908 Allows overriding default behaviour for determining if a page exists.
19091909 If $isKnown is kept as null, regular checks happen. If it's a boolean, this value is returned by the isKnown method.
19101910 $title: Title object that is being checked
Index: trunk/phase3/includes/Title.php
@@ -4134,9 +4134,28 @@
41354135 * @return Bool
41364136 */
41374137 public function isAlwaysKnown() {
 4138+ $isKnown = null;
 4139+
 4140+ /**
 4141+ * Allows overriding default behaviour for determining if a page exists.
 4142+ * If $isKnown is kept as null, regular checks happen. If it's
 4143+ * a boolean, this value is returned by the isKnown method.
 4144+ *
 4145+ * @since 1.20
 4146+ *
 4147+ * @param Title $title
 4148+ * @param boolean|null $isKnown
 4149+ */
 4150+ wfRunHooks( 'TitleIsAlwaysKnown', array( $this, &$isKnown ) );
 4151+
 4152+ if ( !is_null( $isKnown ) ) {
 4153+ return $isKnown;
 4154+ }
 4155+
41384156 if ( $this->mInterwiki != '' ) {
41394157 return true; // any interwiki link might be viewable, for all we know
41404158 }
 4159+
41414160 switch( $this->mNamespace ) {
41424161 case NS_MEDIA:
41434162 case NS_FILE:
@@ -4165,21 +4184,7 @@
41664185 * @return Bool
41674186 */
41684187 public function isKnown() {
4169 - $isKnown = null;
4170 -
4171 - /**
4172 - * Allows overriding default behaviour for determining if a page exists.
4173 - * If $isKnown is kept as null, regular checks happen. If it's
4174 - * a boolean, this value is returned by the isKnown method.
4175 - *
4176 - * @since 1.20
4177 - *
4178 - * @param Title $title
4179 - * @param boolean|null $isKnown
4180 - */
4181 - wfRunHooks( 'TitleIsKnown', array( $this, &$isKnown ) );
4182 -
4183 - return is_null( $isKnown ) ? ( $this->isAlwaysKnown() || $this->exists() ) : $isKnown;
 4188+ return $this->isAlwaysKnown() || $this->exists();
41844189 }
41854190
41864191 /**
Index: trunk/phase3/RELEASE-NOTES-1.20
@@ -13,7 +13,7 @@
1414 === Configuration changes in 1.20 ===
1515
1616 === New features in 1.20 ===
17 -* Added TitleIsKnown hook which gets called when determining if a page exists.
 17+* Added TitleIsAlwaysKnown hook which gets called when determining if a page exists.
1818 * (bug 32341) Add upload by URL domain limitation.
1919
2020 === Bug fixes in 1.20 ===

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111017put in r110285 again now that 1.19 branchedjeroendedauw01:34, 9 February 2012

Comments

#Comment by Aaron Schulz (talk | contribs)   19:14, 13 February 2012

Do any other hooks have inline documentation like this?

#Comment by 😂 (talk | contribs)   15:28, 14 February 2012

Not with parameters and such. In fact I'm not sure how doxygen will handle those inside the body of a function.

#Comment by Platonides (talk | contribs)   23:32, 25 February 2012

This wasn't reverted. Looks ok for me, but leaving at new in case Chad intended to set it to something else.

#Comment by 😂 (talk | contribs)   23:35, 25 February 2012

I might've gotten it mixed with the version introduced in 1.19 and backed out again, apologies.

Status & tagging log