Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -1903,7 +1903,7 @@ |
1904 | 1904 | $title: Title object that is being checked |
1905 | 1905 | $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() |
1906 | 1906 | |
1907 | | -'TitleIsKnown': Called when determining if a page exists. |
| 1907 | +'TitleIsAlwaysKnown': Called when determining if a page exists. |
1908 | 1908 | Allows overriding default behaviour for determining if a page exists. |
1909 | 1909 | If $isKnown is kept as null, regular checks happen. If it's a boolean, this value is returned by the isKnown method. |
1910 | 1910 | $title: Title object that is being checked |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -4134,9 +4134,28 @@ |
4135 | 4135 | * @return Bool |
4136 | 4136 | */ |
4137 | 4137 | 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 | + |
4138 | 4156 | if ( $this->mInterwiki != '' ) { |
4139 | 4157 | return true; // any interwiki link might be viewable, for all we know |
4140 | 4158 | } |
| 4159 | + |
4141 | 4160 | switch( $this->mNamespace ) { |
4142 | 4161 | case NS_MEDIA: |
4143 | 4162 | case NS_FILE: |
— | — | @@ -4165,21 +4184,7 @@ |
4166 | 4185 | * @return Bool |
4167 | 4186 | */ |
4168 | 4187 | 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(); |
4184 | 4189 | } |
4185 | 4190 | |
4186 | 4191 | /** |
Index: trunk/phase3/RELEASE-NOTES-1.20 |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | === Configuration changes in 1.20 === |
15 | 15 | |
16 | 16 | === 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. |
18 | 18 | * (bug 32341) Add upload by URL domain limitation. |
19 | 19 | |
20 | 20 | === Bug fixes in 1.20 === |