Index: trunk/phase3/includes/Title.php |
— | — | @@ -23,53 +23,50 @@ |
24 | 24 | define( 'CASCADE', 1 ); |
25 | 25 | |
26 | 26 | /** |
27 | | - * Title class |
28 | | - * - Represents a title, which may contain an interwiki designation or namespace |
29 | | - * - Can fetch various kinds of data from the database, albeit inefficiently. |
30 | | - * |
| 27 | + * Represents a title within MediaWiki. |
| 28 | + * Optionally may contain an interwiki designation or namespace. |
| 29 | + * @note This class can fetch various kinds of data from the database; |
| 30 | + * however, it does so inefficiently. |
31 | 31 | */ |
32 | 32 | class Title { |
33 | | - /** |
34 | | - * Static cache variables |
35 | | - */ |
| 33 | + /** @name Static cache variables */ |
| 34 | + //@{ |
36 | 35 | static private $titleCache=array(); |
37 | 36 | static private $interwikiCache=array(); |
| 37 | + //@} |
38 | 38 | |
39 | | - |
40 | 39 | /** |
41 | | - * All member variables should be considered private |
42 | | - * Please use the accessor functions |
43 | | - */ |
44 | | - |
45 | | - /**#@+ |
| 40 | + * @name Private member variables |
| 41 | + * Please use the accessor functions instead. |
46 | 42 | * @private |
47 | 43 | */ |
| 44 | + //@{ |
48 | 45 | |
49 | | - var $mTextform = ''; # Text form (spaces not underscores) of the main part |
50 | | - var $mUrlform = ''; # URL-encoded form of the main part |
51 | | - var $mDbkeyform = ''; # Main part with underscores |
52 | | - var $mUserCaseDBKey; # DB key with the initial letter in the case specified by the user |
53 | | - var $mNamespace = NS_MAIN; # Namespace index, i.e. one of the NS_xxxx constants |
54 | | - var $mInterwiki = ''; # Interwiki prefix (or null string) |
55 | | - var $mFragment; # Title fragment (i.e. the bit after the #) |
56 | | - var $mArticleID = -1; # Article ID, fetched from the link cache on demand |
57 | | - var $mLatestID = false; # ID of most recent revision |
58 | | - var $mRestrictions = array(); # Array of groups allowed to edit this article |
| 46 | + var $mTextform = ''; ///< Text form (spaces not underscores) of the main part |
| 47 | + var $mUrlform = ''; ///< URL-encoded form of the main part |
| 48 | + var $mDbkeyform = ''; ///< Main part with underscores |
| 49 | + var $mUserCaseDBKey; ///< DB key with the initial letter in the case specified by the user |
| 50 | + var $mNamespace = NS_MAIN; ///< Namespace index, i.e. one of the NS_xxxx constants |
| 51 | + var $mInterwiki = ''; ///< Interwiki prefix (or null string) |
| 52 | + var $mFragment; ///< Title fragment (i.e. the bit after the #) |
| 53 | + var $mArticleID = -1; ///< Article ID, fetched from the link cache on demand |
| 54 | + var $mLatestID = false; ///< ID of most recent revision |
| 55 | + var $mRestrictions = array(); ///< Array of groups allowed to edit this article |
59 | 56 | var $mOldRestrictions = false; |
60 | | - var $mCascadeRestriction; # Cascade restrictions on this page to included templates and images? |
61 | | - var $mRestrictionsExpiry; # When do the restrictions on this page expire? |
62 | | - var $mHasCascadingRestrictions; # Are cascading restrictions in effect on this page? |
63 | | - var $mCascadeRestrictionSources; # Where are the cascading restrictions coming from on this page? |
64 | | - var $mRestrictionsLoaded = false; # Boolean for initialisation on demand |
65 | | - var $mPrefixedText; # Text form including namespace/interwiki, initialised on demand |
| 57 | + var $mCascadeRestriction; ///< Cascade restrictions on this page to included templates and images? |
| 58 | + var $mRestrictionsExpiry; ///< When do the restrictions on this page expire? |
| 59 | + var $mHasCascadingRestrictions; ///< Are cascading restrictions in effect on this page? |
| 60 | + var $mCascadeRestrictionSources; ///< Where are the cascading restrictions coming from on this page? |
| 61 | + var $mRestrictionsLoaded = false; ///< Boolean for initialisation on demand |
| 62 | + var $mPrefixedText; ///< Text form including namespace/interwiki, initialised on demand |
66 | 63 | # Don't change the following default, NS_MAIN is hardcoded in several |
67 | 64 | # places. See bug 696. |
68 | | - var $mDefaultNamespace = NS_MAIN; # Namespace index when there is no namespace |
69 | | - # Zero except in {{transclusion}} tags |
70 | | - var $mWatched = null; # Is $wgUser watching this page? null if unfilled, accessed through userIsWatching() |
71 | | - var $mLength = -1; # The page length, 0 for special pages |
72 | | - var $mRedirect = null; # Is the article at this title a redirect? |
73 | | - /**#@-*/ |
| 65 | + var $mDefaultNamespace = NS_MAIN; ///< Namespace index when there is no namespace |
| 66 | + # Zero except in {{transclusion}} tags |
| 67 | + var $mWatched = null; ///< Is $wgUser watching this page? null if unfilled, accessed through userIsWatching() |
| 68 | + var $mLength = -1; ///< The page length, 0 for special pages |
| 69 | + var $mRedirect = null; ///< Is the article at this title a redirect? |
| 70 | + //@} |
74 | 71 | |
75 | 72 | |
76 | 73 | /** |
— | — | @@ -80,10 +77,10 @@ |
81 | 78 | |
82 | 79 | /** |
83 | 80 | * Create a new Title from a prefixed DB key |
84 | | - * @param string $key The database key, which has underscores |
| 81 | + * @param $key \type{\string} The database key, which has underscores |
85 | 82 | * instead of spaces, possibly including namespace and |
86 | 83 | * interwiki prefixes |
87 | | - * @return Title the new object, or NULL on an error |
| 84 | + * @return \type{Title} the new object, or NULL on an error |
88 | 85 | */ |
89 | 86 | public static function newFromDBkey( $key ) { |
90 | 87 | $t = new Title(); |
— | — | @@ -98,12 +95,12 @@ |
99 | 96 | * Create a new Title from text, such as what one would |
100 | 97 | * find in a link. Decodes any HTML entities in the text. |
101 | 98 | * |
102 | | - * @param string $text the link text; spaces, prefixes, |
| 99 | + * @param $text \type{\string} the link text; spaces, prefixes, |
103 | 100 | * and an initial ':' indicating the main namespace |
104 | 101 | * are accepted |
105 | | - * @param int $defaultNamespace the namespace to use if |
| 102 | + * @param $defaultNamespace \type{\int} the namespace to use if |
106 | 103 | * none is specified by a prefix |
107 | | - * @return Title the new object, or NULL on an error |
| 104 | + * @return \type{Title} the new object, or NULL on an error |
108 | 105 | */ |
109 | 106 | public static function newFromText( $text, $defaultNamespace = NS_MAIN ) { |
110 | 107 | if( is_object( $text ) ) { |
— | — | @@ -152,8 +149,8 @@ |
153 | 150 | /** |
154 | 151 | * Create a new Title from URL-encoded text. Ensures that |
155 | 152 | * the given title's length does not exceed the maximum. |
156 | | - * @param string $url the title, as might be taken from a URL |
157 | | - * @return Title the new object, or NULL on an error |
| 153 | + * @param $url \type{\string} the title, as might be taken from a URL |
| 154 | + * @return \type{Title} the new object, or NULL on an error |
158 | 155 | */ |
159 | 156 | public static function newFromURL( $url ) { |
160 | 157 | global $wgLegalTitleChars; |
— | — | @@ -180,9 +177,9 @@ |
181 | 178 | * @todo This is inefficiently implemented, the page row is requested |
182 | 179 | * but not used for anything else |
183 | 180 | * |
184 | | - * @param int $id the page_id corresponding to the Title to create |
185 | | - * @param int $flags, use GAID_FOR_UPDATE to use master |
186 | | - * @return Title the new object, or NULL on an error |
| 181 | + * @param $id \type{\int} the page_id corresponding to the Title to create |
| 182 | + * @param $flags \type{\int} use GAID_FOR_UPDATE to use master |
| 183 | + * @return \type{Title} the new object, or NULL on an error |
187 | 184 | */ |
188 | 185 | public static function newFromID( $id, $flags = 0 ) { |
189 | 186 | $fname = 'Title::newFromID'; |
— | — | @@ -199,6 +196,8 @@ |
200 | 197 | |
201 | 198 | /** |
202 | 199 | * Make an array of titles from an array of IDs |
| 200 | + * @param $ids \arrayof{\int} Array of IDs |
| 201 | + * @return \arrayof{Title} Array of Titles |
203 | 202 | */ |
204 | 203 | public static function newFromIDs( $ids ) { |
205 | 204 | if ( !count( $ids ) ) { |
— | — | @@ -217,7 +216,8 @@ |
218 | 217 | |
219 | 218 | /** |
220 | 219 | * Make a Title object from a DB row |
221 | | - * @param Row $row (needs at least page_title,page_namespace) |
| 220 | + * @param $row \type{Row} (needs at least page_title,page_namespace) |
| 221 | + * @return \type{Title} corresponding Title |
222 | 222 | */ |
223 | 223 | public static function newFromRow( $row ) { |
224 | 224 | $t = self::makeTitle( $row->page_namespace, $row->page_title ); |
— | — | @@ -237,10 +237,10 @@ |
238 | 238 | * For convenience, spaces are converted to underscores so that |
239 | 239 | * eg user_text fields can be used directly. |
240 | 240 | * |
241 | | - * @param int $ns the namespace of the article |
242 | | - * @param string $title the unprefixed database key form |
243 | | - * @param string $fragment The link fragment (after the "#") |
244 | | - * @return Title the new object |
| 241 | + * @param $ns \type{\int} the namespace of the article |
| 242 | + * @param $title \type{\string} the unprefixed database key form |
| 243 | + * @param $fragment \type{\string} The link fragment (after the "#") |
| 244 | + * @return \type{Title} the new object |
245 | 245 | */ |
246 | 246 | public static function &makeTitle( $ns, $title, $fragment = '' ) { |
247 | 247 | $t = new Title(); |
— | — | @@ -259,10 +259,10 @@ |
260 | 260 | * The parameters will be checked for validity, which is a bit slower |
261 | 261 | * than makeTitle() but safer for user-provided data. |
262 | 262 | * |
263 | | - * @param int $ns the namespace of the article |
264 | | - * @param string $title the database key form |
265 | | - * @param string $fragment The link fragment (after the "#") |
266 | | - * @return Title the new object, or NULL on an error |
| 263 | + * @param $ns \type{\int} the namespace of the article |
| 264 | + * @param $title \type{\string} the database key form |
| 265 | + * @param $fragment \type{\string} The link fragment (after the "#") |
| 266 | + * @return \type{Title} the new object, or NULL on an error |
267 | 267 | */ |
268 | 268 | public static function makeTitleSafe( $ns, $title, $fragment = '' ) { |
269 | 269 | $t = new Title(); |
— | — | @@ -276,7 +276,7 @@ |
277 | 277 | |
278 | 278 | /** |
279 | 279 | * Create a new Title for the Main Page |
280 | | - * @return Title the new object |
| 280 | + * @return \type{Title} the new object |
281 | 281 | */ |
282 | 282 | public static function newMainPage() { |
283 | 283 | $title = Title::newFromText( wfMsgForContent( 'mainpage' ) ); |
— | — | @@ -291,8 +291,8 @@ |
292 | 292 | * Extract a redirect destination from a string and return the |
293 | 293 | * Title, or null if the text doesn't contain a valid redirect |
294 | 294 | * |
295 | | - * @param string $text Text with possible redirect |
296 | | - * @return Title |
| 295 | + * @param $text \type{String} Text with possible redirect |
| 296 | + * @return \type{Title} The corresponding Title |
297 | 297 | */ |
298 | 298 | public static function newFromRedirect( $text ) { |
299 | 299 | $redir = MagicWord::get( 'redirect' ); |
— | — | @@ -326,8 +326,8 @@ |
327 | 327 | |
328 | 328 | /** |
329 | 329 | * Get the prefixed DB key associated with an ID |
330 | | - * @param int $id the page_id of the article |
331 | | - * @return Title an object representing the article, or NULL |
| 330 | + * @param $id \type{\int} the page_id of the article |
| 331 | + * @return \type{Title} an object representing the article, or NULL |
332 | 332 | * if no such article was found |
333 | 333 | */ |
334 | 334 | public static function nameOf( $id ) { |
— | — | @@ -342,7 +342,7 @@ |
343 | 343 | |
344 | 344 | /** |
345 | 345 | * Get a regex character class describing the legal characters in a link |
346 | | - * @return string the list of characters, not delimited |
| 346 | + * @return \type{\string} the list of characters, not delimited |
347 | 347 | */ |
348 | 348 | public static function legalChars() { |
349 | 349 | global $wgLegalTitleChars; |
— | — | @@ -353,9 +353,9 @@ |
354 | 354 | * Get a string representation of a title suitable for |
355 | 355 | * including in a search index |
356 | 356 | * |
357 | | - * @param int $ns a namespace index |
358 | | - * @param string $title text-form main part |
359 | | - * @return string a stripped-down title string ready for the |
| 357 | + * @param $ns \type{\int} a namespace index |
| 358 | + * @param $title \type{\string} text-form main part |
| 359 | + * @return \type{\string} a stripped-down title string ready for the |
360 | 360 | * search index |
361 | 361 | */ |
362 | 362 | public static function indexTitle( $ns, $title ) { |
— | — | @@ -380,10 +380,10 @@ |
381 | 381 | |
382 | 382 | /* |
383 | 383 | * Make a prefixed DB key from a DB key and a namespace index |
384 | | - * @param int $ns numerical representation of the namespace |
385 | | - * @param string $title the DB key form the title |
386 | | - * @param string $fragment The link fragment (after the "#") |
387 | | - * @return string the prefixed form of the title |
| 384 | + * @param $ns \type{\int} numerical representation of the namespace |
| 385 | + * @param $title \type{\string} the DB key form the title |
| 386 | + * @param $fragment \type{\string} The link fragment (after the "#") |
| 387 | + * @return \type{\string} the prefixed form of the title |
388 | 388 | */ |
389 | 389 | public static function makeName( $ns, $title, $fragment = '' ) { |
390 | 390 | global $wgContLang; |
— | — | @@ -398,9 +398,9 @@ |
399 | 399 | |
400 | 400 | /** |
401 | 401 | * Returns the URL associated with an interwiki prefix |
402 | | - * @param string $key the interwiki prefix (e.g. "MeatBall") |
403 | | - * @return the associated URL, containing "$1", which should be |
404 | | - * replaced by an article title |
| 402 | + * @param $key \type{\string} the interwiki prefix (e.g. "MeatBall") |
| 403 | + * @return \type{\string} the associated URL, containing "$1", |
| 404 | + * which should be replaced by an article title |
405 | 405 | * @static (arguably) |
406 | 406 | */ |
407 | 407 | public function getInterwikiLink( $key ) { |
— | — | @@ -449,11 +449,12 @@ |
450 | 450 | } |
451 | 451 | |
452 | 452 | /** |
453 | | - * Fetch interwiki prefix data from local cache in constant database |
| 453 | + * Fetch interwiki prefix data from local cache in constant database. |
454 | 454 | * |
455 | | - * More logic is explained in DefaultSettings |
| 455 | + * @note More logic is explained in DefaultSettings. |
456 | 456 | * |
457 | | - * @return string URL of interwiki site |
| 457 | + * @param $key \type{\string} Database key |
| 458 | + * @return \type{\string} URL of interwiki site |
458 | 459 | */ |
459 | 460 | public static function getInterwikiCached( $key ) { |
460 | 461 | global $wgInterwikiCache, $wgInterwikiScopes, $wgInterwikiFallbackSite; |
— | — | @@ -490,11 +491,12 @@ |
491 | 492 | Title::$interwikiCache[wfMemcKey( 'interwiki', $key )] = $s; |
492 | 493 | return $s->iw_url; |
493 | 494 | } |
| 495 | + |
494 | 496 | /** |
495 | 497 | * Determine whether the object refers to a page within |
496 | 498 | * this project. |
497 | 499 | * |
498 | | - * @return bool TRUE if this is an in-project interwiki link |
| 500 | + * @return \type{\bool} TRUE if this is an in-project interwiki link |
499 | 501 | * or a wikilink, FALSE otherwise |
500 | 502 | */ |
501 | 503 | public function isLocal() { |
— | — | @@ -512,7 +514,7 @@ |
513 | 515 | * Determine whether the object refers to a page within |
514 | 516 | * this project and is transcludable. |
515 | 517 | * |
516 | | - * @return bool TRUE if this is transcludable |
| 518 | + * @return \type{\bool} TRUE if this is transcludable |
517 | 519 | */ |
518 | 520 | public function isTrans() { |
519 | 521 | if ($this->mInterwiki == '') |
— | — | @@ -543,27 +545,27 @@ |
544 | 546 | /** Simple accessors */ |
545 | 547 | /** |
546 | 548 | * Get the text form (spaces not underscores) of the main part |
547 | | - * @return string |
| 549 | + * @return \type{\string} Main part of the title |
548 | 550 | */ |
549 | 551 | public function getText() { return $this->mTextform; } |
550 | 552 | /** |
551 | 553 | * Get the URL-encoded form of the main part |
552 | | - * @return string |
| 554 | + * @return \type{\string} Main part of the title, URL-encoded |
553 | 555 | */ |
554 | 556 | public function getPartialURL() { return $this->mUrlform; } |
555 | 557 | /** |
556 | 558 | * Get the main part with underscores |
557 | | - * @return string |
| 559 | + * @return \type{\string} Main part of the title, with underscores |
558 | 560 | */ |
559 | 561 | public function getDBkey() { return $this->mDbkeyform; } |
560 | 562 | /** |
561 | | - * Get the namespace index, i.e. one of the NS_xxxx constants |
562 | | - * @return int |
| 563 | + * Get the namespace index, i.e.\ one of the NS_xxxx constants. |
| 564 | + * @return \type{\int} Namespace index |
563 | 565 | */ |
564 | 566 | public function getNamespace() { return $this->mNamespace; } |
565 | 567 | /** |
566 | 568 | * Get the namespace text |
567 | | - * @return string |
| 569 | + * @return \type{\string} Namespace text |
568 | 570 | */ |
569 | 571 | public function getNsText() { |
570 | 572 | global $wgContLang, $wgCanonicalNamespaceNames; |
— | — | @@ -583,49 +585,47 @@ |
584 | 586 | } |
585 | 587 | /** |
586 | 588 | * Get the DB key with the initial letter case as specified by the user |
| 589 | + * @return \type{\string} DB key |
587 | 590 | */ |
588 | 591 | function getUserCaseDBKey() { |
589 | 592 | return $this->mUserCaseDBKey; |
590 | 593 | } |
591 | 594 | /** |
592 | 595 | * Get the namespace text of the subject (rather than talk) page |
593 | | - * @return string |
| 596 | + * @return \type{\string} Namespace text |
594 | 597 | */ |
595 | 598 | public function getSubjectNsText() { |
596 | 599 | global $wgContLang; |
597 | 600 | return $wgContLang->getNsText( MWNamespace::getSubject( $this->mNamespace ) ); |
598 | 601 | } |
599 | | - |
600 | 602 | /** |
601 | 603 | * Get the namespace text of the talk page |
602 | | - * @return string |
| 604 | + * @return \type{\string} Namespace text |
603 | 605 | */ |
604 | 606 | public function getTalkNsText() { |
605 | 607 | global $wgContLang; |
606 | 608 | return( $wgContLang->getNsText( MWNamespace::getTalk( $this->mNamespace ) ) ); |
607 | 609 | } |
608 | | - |
609 | 610 | /** |
610 | 611 | * Could this title have a corresponding talk page? |
611 | | - * @return bool |
| 612 | + * @return \type{\bool} TRUE or FALSE |
612 | 613 | */ |
613 | 614 | public function canTalk() { |
614 | 615 | return( MWNamespace::canTalk( $this->mNamespace ) ); |
615 | 616 | } |
616 | | - |
617 | 617 | /** |
618 | 618 | * Get the interwiki prefix (or null string) |
619 | | - * @return string |
| 619 | + * @return \type{\string} Interwiki prefix |
620 | 620 | */ |
621 | 621 | public function getInterwiki() { return $this->mInterwiki; } |
622 | 622 | /** |
623 | | - * Get the Title fragment (i.e. the bit after the #) in text form |
624 | | - * @return string |
| 623 | + * Get the Title fragment (i.e.\ the bit after the #) in text form |
| 624 | + * @return \type{\string} Title fragment |
625 | 625 | */ |
626 | 626 | public function getFragment() { return $this->mFragment; } |
627 | 627 | /** |
628 | 628 | * Get the fragment in URL form, including the "#" character if there is one |
629 | | - * @return string |
| 629 | + * @return \type{\string} Fragment in URL form |
630 | 630 | */ |
631 | 631 | public function getFragmentForURL() { |
632 | 632 | if ( $this->mFragment == '' ) { |
— | — | @@ -636,13 +636,13 @@ |
637 | 637 | } |
638 | 638 | /** |
639 | 639 | * Get the default namespace index, for when there is no namespace |
640 | | - * @return int |
| 640 | + * @return \type{\int} Default namespace index |
641 | 641 | */ |
642 | 642 | public function getDefaultNamespace() { return $this->mDefaultNamespace; } |
643 | 643 | |
644 | 644 | /** |
645 | 645 | * Get title for search index |
646 | | - * @return string a stripped-down title string ready for the |
| 646 | + * @return \type{\string} a stripped-down title string ready for the |
647 | 647 | * search index |
648 | 648 | */ |
649 | 649 | public function getIndexTitle() { |
— | — | @@ -651,7 +651,7 @@ |
652 | 652 | |
653 | 653 | /** |
654 | 654 | * Get the prefixed database key form |
655 | | - * @return string the prefixed title, with underscores and |
| 655 | + * @return \type{\string} the prefixed title, with underscores and |
656 | 656 | * any interwiki and namespace prefixes |
657 | 657 | */ |
658 | 658 | public function getPrefixedDBkey() { |
— | — | @@ -663,7 +663,7 @@ |
664 | 664 | /** |
665 | 665 | * Get the prefixed title with spaces. |
666 | 666 | * This is the form usually used for display |
667 | | - * @return string the prefixed title, with spaces |
| 667 | + * @return \type{\string} the prefixed title, with spaces |
668 | 668 | */ |
669 | 669 | public function getPrefixedText() { |
670 | 670 | if ( empty( $this->mPrefixedText ) ) { // FIXME: bad usage of empty() ? |
— | — | @@ -677,7 +677,7 @@ |
678 | 678 | /** |
679 | 679 | * Get the prefixed title with spaces, plus any fragment |
680 | 680 | * (part beginning with '#') |
681 | | - * @return string the prefixed title, with spaces and |
| 681 | + * @return \type{\string} the prefixed title, with spaces and |
682 | 682 | * the fragment, including '#' |
683 | 683 | */ |
684 | 684 | public function getFullText() { |
— | — | @@ -690,7 +690,7 @@ |
691 | 691 | |
692 | 692 | /** |
693 | 693 | * Get the base name, i.e. the leftmost parts before the / |
694 | | - * @return string Base name |
| 694 | + * @return \type{\string} Base name |
695 | 695 | */ |
696 | 696 | public function getBaseText() { |
697 | 697 | if( !MWNamespace::hasSubpages( $this->mNamespace ) ) { |
— | — | @@ -706,7 +706,7 @@ |
707 | 707 | |
708 | 708 | /** |
709 | 709 | * Get the lowest-level subpage name, i.e. the rightmost part after / |
710 | | - * @return string Subpage name |
| 710 | + * @return \type{\string} Subpage name |
711 | 711 | */ |
712 | 712 | public function getSubpageText() { |
713 | 713 | if( !MWNamespace::hasSubpages( $this->mNamespace ) ) { |
— | — | @@ -718,7 +718,7 @@ |
719 | 719 | |
720 | 720 | /** |
721 | 721 | * Get a URL-encoded form of the subpage text |
722 | | - * @return string URL-encoded subpage name |
| 722 | + * @return \type{\string} URL-encoded subpage name |
723 | 723 | */ |
724 | 724 | public function getSubpageUrlForm() { |
725 | 725 | $text = $this->getSubpageText(); |
— | — | @@ -729,7 +729,7 @@ |
730 | 730 | |
731 | 731 | /** |
732 | 732 | * Get a URL-encoded title (not an actual URL) including interwiki |
733 | | - * @return string the URL-encoded form |
| 733 | + * @return \type{\string} the URL-encoded form |
734 | 734 | */ |
735 | 735 | public function getPrefixedURL() { |
736 | 736 | $s = $this->prefix( $this->mDbkeyform ); |
— | — | @@ -748,11 +748,11 @@ |
749 | 749 | * Get a real URL referring to this title, with interwiki link and |
750 | 750 | * fragment |
751 | 751 | * |
752 | | - * @param array $query an optional query string, not used for interwiki |
| 752 | + * @param $query \twotypes{\string,\array} an optional query string, not used for interwiki |
753 | 753 | * links. Can be specified as an associative array as well, e.g., |
754 | 754 | * array( 'action' => 'edit' ) (keys and values will be URL-escaped). |
755 | | - * @param string $variant language variant of url (for sr, zh..) |
756 | | - * @return string the URL |
| 755 | + * @param $variant \type{\string} language variant of url (for sr, zh..) |
| 756 | + * @return \type{\string} the URL |
757 | 757 | */ |
758 | 758 | public function getFullURL( $query = '', $variant = false ) { |
759 | 759 | global $wgContLang, $wgServer, $wgRequest; |
— | — | @@ -796,8 +796,8 @@ |
797 | 797 | * $wgArticlePath will be used. Can be specified as an associative array |
798 | 798 | * as well, e.g., array( 'action' => 'edit' ) (keys and values will be |
799 | 799 | * URL-escaped). |
800 | | - * @param string $variant language variant of url (for sr, zh..) |
801 | | - * @return string the URL |
| 800 | + * @param $variant \type{\string} language variant of url (for sr, zh..) |
| 801 | + * @return \type{\string} the URL |
802 | 802 | */ |
803 | 803 | public function getLocalURL( $query = '', $variant = false ) { |
804 | 804 | global $wgArticlePath, $wgScript, $wgServer, $wgRequest; |
— | — | @@ -877,12 +877,12 @@ |
878 | 878 | * there's a fragment but the prefixed text is empty, we just return a link |
879 | 879 | * to the fragment. |
880 | 880 | * |
881 | | - * @param array $query An associative array of key => value pairs for the |
| 881 | + * @param $query \arrayof{\string} An associative array of key => value pairs for the |
882 | 882 | * query string. Keys and values will be escaped. |
883 | | - * @param string $variant Language variant of URL (for sr, zh..). Ignored |
| 883 | + * @param $variant \type{\string} Language variant of URL (for sr, zh..). Ignored |
884 | 884 | * for external links. Default is "false" (same variant as current page, |
885 | 885 | * for anonymous users). |
886 | | - * @return string the URL |
| 886 | + * @return \type{\string} the URL |
887 | 887 | */ |
888 | 888 | public function getLinkUrl( $query = array(), $variant = false ) { |
889 | 889 | if( !is_array( $query ) ) { |
— | — | @@ -903,8 +903,8 @@ |
904 | 904 | /** |
905 | 905 | * Get an HTML-escaped version of the URL form, suitable for |
906 | 906 | * using in a link, without a server name or fragment |
907 | | - * @param string $query an optional query string |
908 | | - * @return string the URL |
| 907 | + * @param $query \type{\string} an optional query string |
| 908 | + * @return \type{\string} the URL |
909 | 909 | */ |
910 | 910 | public function escapeLocalURL( $query = '' ) { |
911 | 911 | return htmlspecialchars( $this->getLocalURL( $query ) ); |
— | — | @@ -914,8 +914,8 @@ |
915 | 915 | * Get an HTML-escaped version of the URL form, suitable for |
916 | 916 | * using in a link, including the server name and fragment |
917 | 917 | * |
918 | | - * @return string the URL |
919 | | - * @param string $query an optional query string |
| 918 | + * @param $query \type{\string} an optional query string |
| 919 | + * @return \type{\string} the URL |
920 | 920 | */ |
921 | 921 | public function escapeFullURL( $query = '' ) { |
922 | 922 | return htmlspecialchars( $this->getFullURL( $query ) ); |
— | — | @@ -926,9 +926,9 @@ |
927 | 927 | * - Used in various Squid-related code, in case we have a different |
928 | 928 | * internal hostname for the server from the exposed one. |
929 | 929 | * |
930 | | - * @param string $query an optional query string |
931 | | - * @param string $variant language variant of url (for sr, zh..) |
932 | | - * @return string the URL |
| 930 | + * @param $query \type{\string} an optional query string |
| 931 | + * @param $variant \type{\string} language variant of url (for sr, zh..) |
| 932 | + * @return \type{\string} the URL |
933 | 933 | */ |
934 | 934 | public function getInternalURL( $query = '', $variant = false ) { |
935 | 935 | global $wgInternalServer; |
— | — | @@ -939,7 +939,7 @@ |
940 | 940 | |
941 | 941 | /** |
942 | 942 | * Get the edit URL for this Title |
943 | | - * @return string the URL, or a null string if this is an |
| 943 | + * @return \type{\string} the URL, or a null string if this is an |
944 | 944 | * interwiki link |
945 | 945 | */ |
946 | 946 | public function getEditURL() { |
— | — | @@ -952,7 +952,7 @@ |
953 | 953 | /** |
954 | 954 | * Get the HTML-escaped displayable text form. |
955 | 955 | * Used for the title field in <a> tags. |
956 | | - * @return string the text, including any prefixes |
| 956 | + * @return \type{\string} the text, including any prefixes |
957 | 957 | */ |
958 | 958 | public function getEscapedText() { |
959 | 959 | return htmlspecialchars( $this->getPrefixedText() ); |
— | — | @@ -960,15 +960,15 @@ |
961 | 961 | |
962 | 962 | /** |
963 | 963 | * Is this Title interwiki? |
964 | | - * @return boolean |
| 964 | + * @return \type{\bool} |
965 | 965 | */ |
966 | 966 | public function isExternal() { return ( '' != $this->mInterwiki ); } |
967 | 967 | |
968 | 968 | /** |
969 | 969 | * Is this page "semi-protected" - the *only* protection is autoconfirm? |
970 | 970 | * |
971 | | - * @param string Action to check (default: edit) |
972 | | - * @return bool |
| 971 | + * @param @action \type{\string} Action to check (default: edit) |
| 972 | + * @return \type{\bool} |
973 | 973 | */ |
974 | 974 | public function isSemiProtected( $action = 'edit' ) { |
975 | 975 | if( $this->exists() ) { |
— | — | @@ -991,9 +991,9 @@ |
992 | 992 | |
993 | 993 | /** |
994 | 994 | * Does the title correspond to a protected article? |
995 | | - * @param string $what the action the page is protected from, |
| 995 | + * @param $what \type{\string} the action the page is protected from, |
996 | 996 | * by default checks move and edit |
997 | | - * @return boolean |
| 997 | + * @return \type{\bool} |
998 | 998 | */ |
999 | 999 | public function isProtected( $action = '' ) { |
1000 | 1000 | global $wgRestrictionLevels, $wgRestrictionTypes; |
— | — | @@ -1019,7 +1019,7 @@ |
1020 | 1020 | |
1021 | 1021 | /** |
1022 | 1022 | * Is $wgUser watching this page? |
1023 | | - * @return boolean |
| 1023 | + * @return \type{\bool} |
1024 | 1024 | */ |
1025 | 1025 | public function userIsWatching() { |
1026 | 1026 | global $wgUser; |
— | — | @@ -1043,8 +1043,8 @@ |
1044 | 1044 | * |
1045 | 1045 | * May provide false positives, but should never provide a false negative. |
1046 | 1046 | * |
1047 | | - * @param string $action action that permission needs to be checked for |
1048 | | - * @return boolean |
| 1047 | + * @param $action \type{\string} action that permission needs to be checked for |
| 1048 | + * @return \type{\bool} |
1049 | 1049 | */ |
1050 | 1050 | public function quickUserCan( $action ) { |
1051 | 1051 | return $this->userCan( $action, false ); |
— | — | @@ -1054,7 +1054,7 @@ |
1055 | 1055 | * Determines if $wgUser is unable to edit this page because it has been protected |
1056 | 1056 | * by $wgNamespaceProtection. |
1057 | 1057 | * |
1058 | | - * @return boolean |
| 1058 | + * @return \type{\bool} |
1059 | 1059 | */ |
1060 | 1060 | public function isNamespaceProtected() { |
1061 | 1061 | global $wgNamespaceProtection, $wgUser; |
— | — | @@ -1069,9 +1069,9 @@ |
1070 | 1070 | |
1071 | 1071 | /** |
1072 | 1072 | * Can $wgUser perform $action on this page? |
1073 | | - * @param string $action action that permission needs to be checked for |
1074 | | - * @param bool $doExpensiveQueries Set this to false to avoid doing unnecessary queries. |
1075 | | - * @return boolean |
| 1073 | + * @param \type{\string} $action action that permission needs to be checked for |
| 1074 | + * @param $doExpensiveQueries \type{\bool} Set this to false to avoid doing unnecessary queries. |
| 1075 | + * @return \type{\bool} |
1076 | 1076 | */ |
1077 | 1077 | public function userCan( $action, $doExpensiveQueries = true ) { |
1078 | 1078 | global $wgUser; |
— | — | @@ -1083,11 +1083,11 @@ |
1084 | 1084 | * |
1085 | 1085 | * FIXME: This *does not* check throttles (User::pingLimiter()). |
1086 | 1086 | * |
1087 | | - * @param string $action action that permission needs to be checked for |
1088 | | - * @param User $user user to check |
1089 | | - * @param bool $doExpensiveQueries Set this to false to avoid doing unnecessary queries. |
1090 | | - * @param array $ignoreErrors Set this to a list of message keys whose corresponding errors may be ignored. |
1091 | | - * @return array Array of arrays of the arguments to wfMsg to explain permissions problems. |
| 1087 | + * @param $action \type{\string}action that permission needs to be checked for |
| 1088 | + * @param $user \type{User} user to check |
| 1089 | + * @param $doExpensiveQueries \type{\bool} Set this to false to avoid doing unnecessary queries. |
| 1090 | + * @param $ignoreErrors \arrayof{\string} Set this to a list of message keys whose corresponding errors may be ignored. |
| 1091 | + * @return \type{\array} Array of arrays of the arguments to wfMsg to explain permissions problems. |
1092 | 1092 | */ |
1093 | 1093 | public function getUserPermissionsErrors( $action, $user, $doExpensiveQueries = true, $ignoreErrors = array() ) { |
1094 | 1094 | if( !StubObject::isRealObject( $user ) ) { |
— | — | @@ -1173,10 +1173,10 @@ |
1174 | 1174 | * which checks ONLY that previously checked by userCan (i.e. it leaves out |
1175 | 1175 | * checks on wfReadOnly() and blocks) |
1176 | 1176 | * |
1177 | | - * @param string $action action that permission needs to be checked for |
1178 | | - * @param User $user user to check |
1179 | | - * @param bool $doExpensiveQueries Set this to false to avoid doing unnecessary queries. |
1180 | | - * @return array Array of arrays of the arguments to wfMsg to explain permissions problems. |
| 1177 | + * @param $action \type{\string} action that permission needs to be checked for |
| 1178 | + * @param $user \type{User} user to check |
| 1179 | + * @param $doExpensiveQueries \type{\bool} Set this to false to avoid doing unnecessary queries. |
| 1180 | + * @return \type{\array} Array of arrays of the arguments to wfMsg to explain permissions problems. |
1181 | 1181 | */ |
1182 | 1182 | private function getUserPermissionsErrorsInternal( $action, $user, $doExpensiveQueries = true ) { |
1183 | 1183 | wfProfileIn( __METHOD__ ); |
— | — | @@ -1330,7 +1330,7 @@ |
1331 | 1331 | |
1332 | 1332 | /** |
1333 | 1333 | * Is this title subject to title protection? |
1334 | | - * @return mixed An associative array representing any existent title |
| 1334 | + * @return \type{\mixed} An associative array representing any existent title |
1335 | 1335 | * protection, or false if there's none. |
1336 | 1336 | */ |
1337 | 1337 | private function getTitleProtection() { |
— | — | @@ -1350,6 +1350,12 @@ |
1351 | 1351 | } |
1352 | 1352 | } |
1353 | 1353 | |
| 1354 | + /** |
| 1355 | + * Update the title protection status |
| 1356 | + * @param $create_perm \type{\string} Permission required for creation |
| 1357 | + * @param $reason \type{\string} Reason for protection |
| 1358 | + * @param $expiry \type{\string} Expiry timestamp |
| 1359 | + */ |
1354 | 1360 | public function updateTitleProtection( $create_perm, $reason, $expiry ) { |
1355 | 1361 | global $wgUser,$wgContLang; |
1356 | 1362 | |
— | — | @@ -1395,7 +1401,7 @@ |
1396 | 1402 | } |
1397 | 1403 | |
1398 | 1404 | /** |
1399 | | - * Remove any title protection (due to page existing |
| 1405 | + * Remove any title protection due to page existing |
1400 | 1406 | */ |
1401 | 1407 | public function deleteTitleProtection() { |
1402 | 1408 | $dbw = wfGetDB( DB_MASTER ); |
— | — | @@ -1406,7 +1412,7 @@ |
1407 | 1413 | |
1408 | 1414 | /** |
1409 | 1415 | * Can $wgUser edit this page? |
1410 | | - * @return boolean |
| 1416 | + * @return \type{\bool} TRUE or FALSE |
1411 | 1417 | * @deprecated use userCan('edit') |
1412 | 1418 | */ |
1413 | 1419 | public function userCanEdit( $doExpensiveQueries = true ) { |
— | — | @@ -1415,7 +1421,7 @@ |
1416 | 1422 | |
1417 | 1423 | /** |
1418 | 1424 | * Can $wgUser create this page? |
1419 | | - * @return boolean |
| 1425 | + * @return \type{\bool} TRUE or FALSE |
1420 | 1426 | * @deprecated use userCan('create') |
1421 | 1427 | */ |
1422 | 1428 | public function userCanCreate( $doExpensiveQueries = true ) { |
— | — | @@ -1424,7 +1430,7 @@ |
1425 | 1431 | |
1426 | 1432 | /** |
1427 | 1433 | * Can $wgUser move this page? |
1428 | | - * @return boolean |
| 1434 | + * @return \type{\bool} TRUE or FALSE |
1429 | 1435 | * @deprecated use userCan('move') |
1430 | 1436 | */ |
1431 | 1437 | public function userCanMove( $doExpensiveQueries = true ) { |
— | — | @@ -1435,7 +1441,7 @@ |
1436 | 1442 | * Would anybody with sufficient privileges be able to move this page? |
1437 | 1443 | * Some pages just aren't movable. |
1438 | 1444 | * |
1439 | | - * @return boolean |
| 1445 | + * @return \type{\bool} TRUE or FALSE |
1440 | 1446 | */ |
1441 | 1447 | public function isMovable() { |
1442 | 1448 | return MWNamespace::isMovable( $this->getNamespace() ) |
— | — | @@ -1444,7 +1450,7 @@ |
1445 | 1451 | |
1446 | 1452 | /** |
1447 | 1453 | * Can $wgUser read this page? |
1448 | | - * @return boolean |
| 1454 | + * @return \type{\bool} TRUE or FALSE |
1449 | 1455 | * @todo fold these checks into userCan() |
1450 | 1456 | */ |
1451 | 1457 | public function userCanRead() { |
— | — | @@ -1521,7 +1527,7 @@ |
1522 | 1528 | |
1523 | 1529 | /** |
1524 | 1530 | * Is this a talk page of some sort? |
1525 | | - * @return bool |
| 1531 | + * @return \type{\bool} TRUE or FALSE |
1526 | 1532 | */ |
1527 | 1533 | public function isTalkPage() { |
1528 | 1534 | return MWNamespace::isTalk( $this->getNamespace() ); |
— | — | @@ -1529,7 +1535,7 @@ |
1530 | 1536 | |
1531 | 1537 | /** |
1532 | 1538 | * Is this a subpage? |
1533 | | - * @return bool |
| 1539 | + * @return \type{\bool} TRUE or FALSE |
1534 | 1540 | */ |
1535 | 1541 | public function isSubpage() { |
1536 | 1542 | return MWNamespace::hasSubpages( $this->mNamespace ) |
— | — | @@ -1539,7 +1545,7 @@ |
1540 | 1546 | |
1541 | 1547 | /** |
1542 | 1548 | * Does this have subpages? (Warning, usually requires an extra DB query.) |
1543 | | - * @return bool |
| 1549 | + * @return \type{\bool} TRUE or FALSE |
1544 | 1550 | */ |
1545 | 1551 | public function hasSubpages() { |
1546 | 1552 | if( !MWNamespace::hasSubpages( $this->mNamespace ) ) { |
— | — | @@ -1567,7 +1573,7 @@ |
1568 | 1574 | * Could this page contain custom CSS or JavaScript, based |
1569 | 1575 | * on the title? |
1570 | 1576 | * |
1571 | | - * @return bool |
| 1577 | + * @return \type{\bool} TRUE or FALSE |
1572 | 1578 | */ |
1573 | 1579 | public function isCssOrJsPage() { |
1574 | 1580 | return $this->mNamespace == NS_MEDIAWIKI |
— | — | @@ -1576,7 +1582,7 @@ |
1577 | 1583 | |
1578 | 1584 | /** |
1579 | 1585 | * Is this a .css or .js subpage of a user page? |
1580 | | - * @return bool |
| 1586 | + * @return \type{\bool} TRUE or FALSE |
1581 | 1587 | */ |
1582 | 1588 | public function isCssJsSubpage() { |
1583 | 1589 | return ( NS_USER == $this->mNamespace and preg_match("/\\/.*\\.(?:css|js)$/", $this->mTextform ) ); |
— | — | @@ -1584,6 +1590,7 @@ |
1585 | 1591 | /** |
1586 | 1592 | * Is this a *valid* .css or .js subpage of a user page? |
1587 | 1593 | * Check that the corresponding skin exists |
| 1594 | + * @return \type{\bool} TRUE or FALSE |
1588 | 1595 | */ |
1589 | 1596 | public function isValidCssJsSubpage() { |
1590 | 1597 | if ( $this->isCssJsSubpage() ) { |
— | — | @@ -1603,14 +1610,14 @@ |
1604 | 1611 | } |
1605 | 1612 | /** |
1606 | 1613 | * Is this a .css subpage of a user page? |
1607 | | - * @return bool |
| 1614 | + * @return \type{\bool} TRUE or FALSE |
1608 | 1615 | */ |
1609 | 1616 | public function isCssSubpage() { |
1610 | 1617 | return ( NS_USER == $this->mNamespace && preg_match("/\\/.*\\.css$/", $this->mTextform ) ); |
1611 | 1618 | } |
1612 | 1619 | /** |
1613 | 1620 | * Is this a .js subpage of a user page? |
1614 | | - * @return bool |
| 1621 | + * @return \type{\bool} TRUE or FALSE |
1615 | 1622 | */ |
1616 | 1623 | public function isJsSubpage() { |
1617 | 1624 | return ( NS_USER == $this->mNamespace && preg_match("/\\/.*\\.js$/", $this->mTextform ) ); |
— | — | @@ -1619,7 +1626,7 @@ |
1620 | 1627 | * Protect css/js subpages of user pages: can $wgUser edit |
1621 | 1628 | * this page? |
1622 | 1629 | * |
1623 | | - * @return boolean |
| 1630 | + * @return \type{\bool} TRUE or FALSE |
1624 | 1631 | * @todo XXX: this might be better using restrictions |
1625 | 1632 | */ |
1626 | 1633 | public function userCanEditCssJsSubpage() { |
— | — | @@ -1630,7 +1637,7 @@ |
1631 | 1638 | /** |
1632 | 1639 | * Cascading protection: Return true if cascading restrictions apply to this page, false if not. |
1633 | 1640 | * |
1634 | | - * @return bool If the page is subject to cascading restrictions. |
| 1641 | + * @return \type{\bool} If the page is subject to cascading restrictions. |
1635 | 1642 | */ |
1636 | 1643 | public function isCascadeProtected() { |
1637 | 1644 | list( $sources, /* $restrictions */ ) = $this->getCascadeProtectionSources( false ); |
— | — | @@ -1640,10 +1647,10 @@ |
1641 | 1648 | /** |
1642 | 1649 | * Cascading protection: Get the source of any cascading restrictions on this page. |
1643 | 1650 | * |
1644 | | - * @param $get_pages bool Whether or not to retrieve the actual pages that the restrictions have come from. |
1645 | | - * @return array( mixed title array, restriction array) |
1646 | | - * Array of the Title objects of the pages from which cascading restrictions have come, false for none, or true if such restrictions exist, but $get_pages was not set. |
1647 | | - * The restriction array is an array of each type, each of which contains an array of unique groups |
| 1651 | + * @param $get_pages \type{\bool} Whether or not to retrieve the actual pages that the restrictions have come from. |
| 1652 | + * @return \arrayof{mixed title array, restriction array} Array of the Title objects of the pages from |
| 1653 | + * which cascading restrictions have come, false for none, or true if such restrictions exist, but $get_pages was not set. |
| 1654 | + * The restriction array is an array of each type, each of which contains an array of unique groups. |
1648 | 1655 | */ |
1649 | 1656 | public function getCascadeProtectionSources( $get_pages = true ) { |
1650 | 1657 | global $wgRestrictionTypes; |
— | — | @@ -1739,7 +1746,7 @@ |
1740 | 1747 | |
1741 | 1748 | /** |
1742 | 1749 | * Loads a string into mRestrictions array |
1743 | | - * @param resource $res restrictions as an SQL result. |
| 1750 | + * @param $res \type{Resource} restrictions as an SQL result. |
1744 | 1751 | */ |
1745 | 1752 | private function loadRestrictionsFromRow( $res, $oldFashionedRestrictions = NULL ) { |
1746 | 1753 | global $wgRestrictionTypes; |
— | — | @@ -1812,6 +1819,9 @@ |
1813 | 1820 | $this->mRestrictionsLoaded = true; |
1814 | 1821 | } |
1815 | 1822 | |
| 1823 | + /** |
| 1824 | + * Load restrictions from the page_restrictions table |
| 1825 | + */ |
1816 | 1826 | public function loadRestrictions( $oldFashionedRestrictions = NULL ) { |
1817 | 1827 | if( !$this->mRestrictionsLoaded ) { |
1818 | 1828 | if ($this->exists()) { |
— | — | @@ -1862,8 +1872,8 @@ |
1863 | 1873 | /** |
1864 | 1874 | * Accessor/initialisation for mRestrictions |
1865 | 1875 | * |
1866 | | - * @param string $action action that permission needs to be checked for |
1867 | | - * @return array the array of groups allowed to edit this article |
| 1876 | + * @param $action \type{\string} action that permission needs to be checked for |
| 1877 | + * @return \arrayof{\string} the array of groups allowed to edit this article |
1868 | 1878 | */ |
1869 | 1879 | public function getRestrictions( $action ) { |
1870 | 1880 | if( !$this->mRestrictionsLoaded ) { |
— | — | @@ -1876,7 +1886,7 @@ |
1877 | 1887 | |
1878 | 1888 | /** |
1879 | 1889 | * Is there a version of this page in the deletion archive? |
1880 | | - * @return int the number of archived revisions |
| 1890 | + * @return \type{\int} the number of archived revisions |
1881 | 1891 | */ |
1882 | 1892 | public function isDeleted() { |
1883 | 1893 | $fname = 'Title::isDeleted'; |
— | — | @@ -1897,9 +1907,9 @@ |
1898 | 1908 | /** |
1899 | 1909 | * Get the article ID for this Title from the link cache, |
1900 | 1910 | * adding it if necessary |
1901 | | - * @param int $flags a bit field; may be GAID_FOR_UPDATE to select |
| 1911 | + * @param $flags \type{\int} a bit field; may be GAID_FOR_UPDATE to select |
1902 | 1912 | * for update |
1903 | | - * @return int the ID |
| 1913 | + * @return \type{\int} the ID |
1904 | 1914 | */ |
1905 | 1915 | public function getArticleID( $flags = 0 ) { |
1906 | 1916 | $linkCache = LinkCache::singleton(); |
— | — | @@ -1918,8 +1928,8 @@ |
1919 | 1929 | /** |
1920 | 1930 | * Is this an article that is a redirect page? |
1921 | 1931 | * Uses link cache, adding it if necessary |
1922 | | - * @param int $flags a bit field; may be GAID_FOR_UPDATE to select for update |
1923 | | - * @return bool |
| 1932 | + * @param $flags \type{\int} a bit field; may be GAID_FOR_UPDATE to select for update |
| 1933 | + * @return \type{\bool} |
1924 | 1934 | */ |
1925 | 1935 | public function isRedirect( $flags = 0 ) { |
1926 | 1936 | if( !is_null($this->mRedirect) ) |
— | — | @@ -1938,8 +1948,8 @@ |
1939 | 1949 | /** |
1940 | 1950 | * What is the length of this page? |
1941 | 1951 | * Uses link cache, adding it if necessary |
1942 | | - * @param int $flags a bit field; may be GAID_FOR_UPDATE to select for update |
1943 | | - * @return bool |
| 1952 | + * @param $flags \type{\int} a bit field; may be GAID_FOR_UPDATE to select for update |
| 1953 | + * @return \type{\bool} |
1944 | 1954 | */ |
1945 | 1955 | public function getLength( $flags = 0 ) { |
1946 | 1956 | if( $this->mLength != -1 ) |
— | — | @@ -1957,8 +1967,8 @@ |
1958 | 1968 | |
1959 | 1969 | /** |
1960 | 1970 | * What is the page_latest field for this page? |
1961 | | - * @param int $flags a bit field; may be GAID_FOR_UPDATE to select for update |
1962 | | - * @return int |
| 1971 | + * @param $flags \type{\int} a bit field; may be GAID_FOR_UPDATE to select for update |
| 1972 | + * @return \type{\int} |
1963 | 1973 | */ |
1964 | 1974 | public function getLatestRevID( $flags = 0 ) { |
1965 | 1975 | if ($this->mLatestID !== false) |
— | — | @@ -1979,7 +1989,7 @@ |
1980 | 1990 | * loading of the new page_id. It's also called from |
1981 | 1991 | * Article::doDeleteArticle() |
1982 | 1992 | * |
1983 | | - * @param int $newid the new Article ID |
| 1993 | + * @param $newid \type{\int} the new Article ID |
1984 | 1994 | */ |
1985 | 1995 | public function resetArticleID( $newid ) { |
1986 | 1996 | $linkCache = LinkCache::singleton(); |
— | — | @@ -1993,7 +2003,7 @@ |
1994 | 2004 | |
1995 | 2005 | /** |
1996 | 2006 | * Updates page_touched for this page; called from LinksUpdate.php |
1997 | | - * @return bool true if the update succeded |
| 2007 | + * @return \type{\bool} true if the update succeded |
1998 | 2008 | */ |
1999 | 2009 | public function invalidateCache() { |
2000 | 2010 | global $wgUseFileCache; |
— | — | @@ -2024,8 +2034,8 @@ |
2025 | 2035 | * Prefix some arbitrary text with the namespace or interwiki prefix |
2026 | 2036 | * of this object |
2027 | 2037 | * |
2028 | | - * @param string $name the text |
2029 | | - * @return string the prefixed text |
| 2038 | + * @param $name \type{\string} the text |
| 2039 | + * @return \type{\string} the prefixed text |
2030 | 2040 | * @private |
2031 | 2041 | */ |
2032 | 2042 | /* private */ function prefix( $name ) { |
— | — | @@ -2047,7 +2057,7 @@ |
2048 | 2058 | * removes illegal characters, splits off the interwiki and |
2049 | 2059 | * namespace prefixes, sets the other forms, and canonicalizes |
2050 | 2060 | * everything. |
2051 | | - * @return bool true on success |
| 2061 | + * @return \type{\bool} true on success |
2052 | 2062 | */ |
2053 | 2063 | private function secureAndSplit() { |
2054 | 2064 | global $wgContLang, $wgLocalInterwiki, $wgCapitalLinks; |
— | — | @@ -2258,7 +2268,7 @@ |
2259 | 2269 | * are immutable. The reason this is here is because it's better than setting the |
2260 | 2270 | * members directly, which is what Linker::formatComment was doing previously. |
2261 | 2271 | * |
2262 | | - * @param string $fragment text |
| 2272 | + * @param $fragment \type{\string} text |
2263 | 2273 | * @todo clarify whether access is supposed to be public (was marked as "kind of public") |
2264 | 2274 | */ |
2265 | 2275 | public function setFragment( $fragment ) { |
— | — | @@ -2267,7 +2277,7 @@ |
2268 | 2278 | |
2269 | 2279 | /** |
2270 | 2280 | * Get a Title object associated with the talk page of this article |
2271 | | - * @return Title the object for the talk page |
| 2281 | + * @return \type{Title} the object for the talk page |
2272 | 2282 | */ |
2273 | 2283 | public function getTalkPage() { |
2274 | 2284 | return Title::makeTitle( MWNamespace::getTalk( $this->getNamespace() ), $this->getDBkey() ); |
— | — | @@ -2277,7 +2287,7 @@ |
2278 | 2288 | * Get a title object associated with the subject page of this |
2279 | 2289 | * talk page |
2280 | 2290 | * |
2281 | | - * @return Title the object for the subject page |
| 2291 | + * @return \type{Title} the object for the subject page |
2282 | 2292 | */ |
2283 | 2293 | public function getSubjectPage() { |
2284 | 2294 | return Title::makeTitle( MWNamespace::getSubject( $this->getNamespace() ), $this->getDBkey() ); |
— | — | @@ -2290,8 +2300,8 @@ |
2291 | 2301 | * WARNING: do not use this function on arbitrary user-supplied titles! |
2292 | 2302 | * On heavily-used templates it will max out the memory. |
2293 | 2303 | * |
2294 | | - * @param string $options may be FOR UPDATE |
2295 | | - * @return array the Title objects linking here |
| 2304 | + * @param $options \type{\string} may be FOR UPDATE |
| 2305 | + * @return \arrayof{Title} the Title objects linking here |
2296 | 2306 | */ |
2297 | 2307 | public function getLinksTo( $options = '', $table = 'pagelinks', $prefix = 'pl' ) { |
2298 | 2308 | $linkCache = LinkCache::singleton(); |
— | — | @@ -2331,8 +2341,8 @@ |
2332 | 2342 | * WARNING: do not use this function on arbitrary user-supplied titles! |
2333 | 2343 | * On heavily-used templates it will max out the memory. |
2334 | 2344 | * |
2335 | | - * @param string $options may be FOR UPDATE |
2336 | | - * @return array the Title objects linking here |
| 2345 | + * @param $options \type{\string} may be FOR UPDATE |
| 2346 | + * @return \arrayof{Title} the Title objects linking here |
2337 | 2347 | */ |
2338 | 2348 | public function getTemplateLinksTo( $options = '' ) { |
2339 | 2349 | return $this->getLinksTo( $options, 'templatelinks', 'tl' ); |
— | — | @@ -2342,8 +2352,8 @@ |
2343 | 2353 | * Get an array of Title objects referring to non-existent articles linked from this page |
2344 | 2354 | * |
2345 | 2355 | * @todo check if needed (used only in SpecialBrokenRedirects.php, and should use redirect table in this case) |
2346 | | - * @param string $options may be FOR UPDATE |
2347 | | - * @return array the Title objects |
| 2356 | + * @param $options \type{\string} may be FOR UPDATE |
| 2357 | + * @return \arrayof{Title} the Title objects |
2348 | 2358 | */ |
2349 | 2359 | public function getBrokenLinksFrom( $options = '' ) { |
2350 | 2360 | if ( $this->getArticleId() == 0 ) { |
— | — | @@ -2386,7 +2396,7 @@ |
2387 | 2397 | * Get a list of URLs to purge from the Squid cache when this |
2388 | 2398 | * page changes |
2389 | 2399 | * |
2390 | | - * @return array the URLs |
| 2400 | + * @return \arrayof{\string} the URLs |
2391 | 2401 | */ |
2392 | 2402 | public function getSquidURLs() { |
2393 | 2403 | global $wgContLang; |
— | — | @@ -2408,6 +2418,9 @@ |
2409 | 2419 | return $urls; |
2410 | 2420 | } |
2411 | 2421 | |
| 2422 | + /** |
| 2423 | + * Purge all applicable Squid URLs |
| 2424 | + */ |
2412 | 2425 | public function purgeSquid() { |
2413 | 2426 | global $wgUseSquid; |
2414 | 2427 | if ( $wgUseSquid ) { |
— | — | @@ -2419,7 +2432,7 @@ |
2420 | 2433 | |
2421 | 2434 | /** |
2422 | 2435 | * Move this page without authentication |
2423 | | - * @param Title &$nt the new page Title |
| 2436 | + * @param &$nt \type{Title} the new page Title |
2424 | 2437 | */ |
2425 | 2438 | public function moveNoAuth( &$nt ) { |
2426 | 2439 | return $this->moveTo( $nt, false ); |
— | — | @@ -2428,11 +2441,11 @@ |
2429 | 2442 | /** |
2430 | 2443 | * Check whether a given move operation would be valid. |
2431 | 2444 | * Returns true if ok, or a getUserPermissionsErrors()-like array otherwise |
2432 | | - * @param Title &$nt the new title |
2433 | | - * @param bool $auth indicates whether $wgUser's permissions |
| 2445 | + * @param &$nt \type{Title} the new title |
| 2446 | + * @param $auth \type{\bool} indicates whether $wgUser's permissions |
2434 | 2447 | * should be checked |
2435 | | - * @param string $reason is the log summary of the move, used for spam checking |
2436 | | - * @return mixed True on success, getUserPermissionsErrors()-like array on failure |
| 2448 | + * @param $reason \type{\string} is the log summary of the move, used for spam checking |
| 2449 | + * @return \type{\mixed} True on success, getUserPermissionsErrors()-like array on failure |
2437 | 2450 | */ |
2438 | 2451 | public function isValidMoveOperation( &$nt, $auth = true, $reason = '' ) { |
2439 | 2452 | $errors = array(); |
— | — | @@ -2513,13 +2526,13 @@ |
2514 | 2527 | |
2515 | 2528 | /** |
2516 | 2529 | * Move a title to a new location |
2517 | | - * @param Title &$nt the new title |
2518 | | - * @param bool $auth indicates whether $wgUser's permissions |
| 2530 | + * @param &$nt \type{Title} the new title |
| 2531 | + * @param $auth \type{\bool} indicates whether $wgUser's permissions |
2519 | 2532 | * should be checked |
2520 | | - * @param string $reason The reason for the move |
2521 | | - * @param bool $createRedirect Whether to create a redirect from the old title to the new title. |
| 2533 | + * @param $reason \type{\string} The reason for the move |
| 2534 | + * @param $createRedirect \type{\bool} Whether to create a redirect from the old title to the new title. |
2522 | 2535 | * Ignored if the user doesn't have the suppressredirect right. |
2523 | | - * @return mixed true on success, getUserPermissionsErrors()-like array on failure |
| 2536 | + * @return \type{\mixed} true on success, getUserPermissionsErrors()-like array on failure |
2524 | 2537 | */ |
2525 | 2538 | public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true ) { |
2526 | 2539 | $err = $this->isValidMoveOperation( $nt, $auth, $reason ); |
— | — | @@ -2615,10 +2628,10 @@ |
2616 | 2629 | * Move page to a title which is at present a redirect to the |
2617 | 2630 | * source page |
2618 | 2631 | * |
2619 | | - * @param Title &$nt the page to move to, which should currently |
| 2632 | + * @param &$nt \type{Title} the page to move to, which should currently |
2620 | 2633 | * be a redirect |
2621 | | - * @param string $reason The reason for the move |
2622 | | - * @param bool $createRedirect Whether to leave a redirect at the old title. |
| 2634 | + * @param $reason \type{\string} The reason for the move |
| 2635 | + * @param $createRedirect \type{\bool} Whether to leave a redirect at the old title. |
2623 | 2636 | * Ignored if the user doesn't have the suppressredirect right |
2624 | 2637 | */ |
2625 | 2638 | private function moveOverExistingRedirect( &$nt, $reason = '', $createRedirect = true ) { |
— | — | @@ -2733,9 +2746,9 @@ |
2734 | 2747 | |
2735 | 2748 | /** |
2736 | 2749 | * Move page to non-existing title. |
2737 | | - * @param Title &$nt the new Title |
2738 | | - * @param string $reason The reason for the move |
2739 | | - * @param bool $createRedirect Whether to create a redirect from the old title to the new title |
| 2750 | + * @param &$nt \type{Title} the new Title |
| 2751 | + * @param $reason \type{\string} The reason for the move |
| 2752 | + * @param $createRedirect \type{\bool} Whether to create a redirect from the old title to the new title |
2740 | 2753 | * Ignored if the user doesn't have the suppressredirect right |
2741 | 2754 | */ |
2742 | 2755 | private function moveToNewTitle( &$nt, $reason = '', $createRedirect = true ) { |
— | — | @@ -2830,7 +2843,8 @@ |
2831 | 2844 | * Checks if $this can be moved to a given Title |
2832 | 2845 | * - Selects for update, so don't call it unless you mean business |
2833 | 2846 | * |
2834 | | - * @param Title &$nt the new title to check |
| 2847 | + * @param &$nt \type{Title} the new title to check |
| 2848 | + * @return \type{\bool} TRUE or FALSE |
2835 | 2849 | */ |
2836 | 2850 | public function isValidMoveTarget( $nt ) { |
2837 | 2851 | |
— | — | @@ -2893,7 +2907,7 @@ |
2894 | 2908 | /** |
2895 | 2909 | * Can this title be added to a user's watchlist? |
2896 | 2910 | * |
2897 | | - * @return bool |
| 2911 | + * @return \type{\bool} TRUE or FALSE |
2898 | 2912 | */ |
2899 | 2913 | public function isWatchable() { |
2900 | 2914 | return !$this->isExternal() |
— | — | @@ -2904,7 +2918,7 @@ |
2905 | 2919 | * Get categories to which this Title belongs and return an array of |
2906 | 2920 | * categories' names. |
2907 | 2921 | * |
2908 | | - * @return array an array of parents in the form: |
| 2922 | + * @return \type{\array} array an array of parents in the form: |
2909 | 2923 | * $parent => $currentarticle |
2910 | 2924 | */ |
2911 | 2925 | public function getParentCategories() { |
— | — | @@ -2935,8 +2949,8 @@ |
2936 | 2950 | |
2937 | 2951 | /** |
2938 | 2952 | * Get a tree of parent categories |
2939 | | - * @param array $children an array with the children in the keys, to check for circular refs |
2940 | | - * @return array |
| 2953 | + * @param $children \type{\array} an array with the children in the keys, to check for circular refs |
| 2954 | + * @return \type{\array} Tree of parent categories |
2941 | 2955 | */ |
2942 | 2956 | public function getParentCategoryTree( $children = array() ) { |
2943 | 2957 | $stack = array(); |
— | — | @@ -2965,7 +2979,7 @@ |
2966 | 2980 | * Get an associative array for selecting this title from |
2967 | 2981 | * the "page" table |
2968 | 2982 | * |
2969 | | - * @return array |
| 2983 | + * @return \type{\array} Selection array |
2970 | 2984 | */ |
2971 | 2985 | public function pageCond() { |
2972 | 2986 | return array( 'page_namespace' => $this->mNamespace, 'page_title' => $this->mDbkeyform ); |
— | — | @@ -2974,9 +2988,9 @@ |
2975 | 2989 | /** |
2976 | 2990 | * Get the revision ID of the previous revision |
2977 | 2991 | * |
2978 | | - * @param integer $revId Revision ID. Get the revision that was before this one. |
2979 | | - * @param integer $flags, GAID_FOR_UPDATE |
2980 | | - * @return integer $oldrevision|false |
| 2992 | + * @param $revId \type{\int} Revision ID. Get the revision that was before this one. |
| 2993 | + * @param $flags \type{\int} GAID_FOR_UPDATE |
| 2994 | + * @return \twotypes{\int,\bool} Old revision ID, or FALSE if none exists |
2981 | 2995 | */ |
2982 | 2996 | public function getPreviousRevisionID( $revId, $flags=0 ) { |
2983 | 2997 | $db = ($flags & GAID_FOR_UPDATE) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
— | — | @@ -2993,9 +3007,9 @@ |
2994 | 3008 | /** |
2995 | 3009 | * Get the revision ID of the next revision |
2996 | 3010 | * |
2997 | | - * @param integer $revId Revision ID. Get the revision that was after this one. |
2998 | | - * @param integer $flags, GAID_FOR_UPDATE |
2999 | | - * @return integer $oldrevision|false |
| 3011 | + * @param $revId \type{\int} Revision ID. Get the revision that was after this one. |
| 3012 | + * @param $flags \type{\int} GAID_FOR_UPDATE |
| 3013 | + * @return \twotypes{\int,\bool} Next revision ID, or FALSE if none exists |
3000 | 3014 | */ |
3001 | 3015 | public function getNextRevisionID( $revId, $flags=0 ) { |
3002 | 3016 | $db = ($flags & GAID_FOR_UPDATE) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
— | — | @@ -3013,9 +3027,9 @@ |
3014 | 3028 | * Get the number of revisions between the given revision IDs. |
3015 | 3029 | * Used for diffs and other things that really need it. |
3016 | 3030 | * |
3017 | | - * @param integer $old Revision ID. |
3018 | | - * @param integer $new Revision ID. |
3019 | | - * @return integer Number of revisions between these IDs. |
| 3031 | + * @param $old \type{\int} Revision ID. |
| 3032 | + * @param $new \type{\int} Revision ID. |
| 3033 | + * @return \type{\int} Number of revisions between these IDs. |
3020 | 3034 | */ |
3021 | 3035 | public function countRevisionsBetween( $old, $new ) { |
3022 | 3036 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -3030,8 +3044,8 @@ |
3031 | 3045 | /** |
3032 | 3046 | * Compare with another title. |
3033 | 3047 | * |
3034 | | - * @param Title $title |
3035 | | - * @return bool |
| 3048 | + * @param \type{Title} $title |
| 3049 | + * @return \type{\bool} TRUE or FALSE |
3036 | 3050 | */ |
3037 | 3051 | public function equals( Title $title ) { |
3038 | 3052 | // Note: === is necessary for proper matching of number-like titles. |
— | — | @@ -3054,7 +3068,7 @@ |
3055 | 3069 | /** |
3056 | 3070 | * Return a string representation of this title |
3057 | 3071 | * |
3058 | | - * @return string |
| 3072 | + * @return \type{\string} String representation of this title |
3059 | 3073 | */ |
3060 | 3074 | public function __toString() { |
3061 | 3075 | return $this->getPrefixedText(); |
— | — | @@ -3062,7 +3076,7 @@ |
3063 | 3077 | |
3064 | 3078 | /** |
3065 | 3079 | * Check if page exists |
3066 | | - * @return bool |
| 3080 | + * @return \type{\bool} TRUE or FALSE |
3067 | 3081 | */ |
3068 | 3082 | public function exists() { |
3069 | 3083 | return $this->getArticleId() != 0; |
— | — | @@ -3072,7 +3086,7 @@ |
3073 | 3087 | * Do we know that this title definitely exists, or should we otherwise |
3074 | 3088 | * consider that it exists? |
3075 | 3089 | * |
3076 | | - * @return bool |
| 3090 | + * @return \type{\bool} TRUE or FALSE |
3077 | 3091 | */ |
3078 | 3092 | public function isAlwaysKnown() { |
3079 | 3093 | // If the page is form Mediawiki:message/lang, calling wfMsgWeirdKey causes |
— | — | @@ -3103,6 +3117,7 @@ |
3104 | 3118 | |
3105 | 3119 | /** |
3106 | 3120 | * Get the last touched timestamp |
| 3121 | + * @return \type{\string} Last touched timestamp |
3107 | 3122 | */ |
3108 | 3123 | public function getTouched() { |
3109 | 3124 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -3115,6 +3130,10 @@ |
3116 | 3131 | return $touched; |
3117 | 3132 | } |
3118 | 3133 | |
| 3134 | + /** |
| 3135 | + * Get the trackback URL for this page |
| 3136 | + * @return \type{\string} Trackback URL |
| 3137 | + */ |
3119 | 3138 | public function trackbackURL() { |
3120 | 3139 | global $wgTitle, $wgScriptPath, $wgServer; |
3121 | 3140 | |
— | — | @@ -3122,6 +3141,10 @@ |
3123 | 3142 | . htmlspecialchars(urlencode($wgTitle->getPrefixedDBkey())); |
3124 | 3143 | } |
3125 | 3144 | |
| 3145 | + /** |
| 3146 | + * Get the trackback RDF for this page |
| 3147 | + * @return \type{\string} Trackback RDF |
| 3148 | + */ |
3126 | 3149 | public function trackbackRDF() { |
3127 | 3150 | $url = htmlspecialchars($this->getFullURL()); |
3128 | 3151 | $title = htmlspecialchars($this->getText()); |
— | — | @@ -3147,7 +3170,7 @@ |
3148 | 3171 | |
3149 | 3172 | /** |
3150 | 3173 | * Generate strings used for xml 'id' names in monobook tabs |
3151 | | - * @return string |
| 3174 | + * @return \type{\string} XML 'id' name |
3152 | 3175 | */ |
3153 | 3176 | public function getNamespaceKey() { |
3154 | 3177 | global $wgContLang; |
— | — | @@ -3187,7 +3210,7 @@ |
3188 | 3211 | |
3189 | 3212 | /** |
3190 | 3213 | * Returns true if this title resolves to the named special page |
3191 | | - * @param string $name The special page name |
| 3214 | + * @param $name \type{\string} The special page name |
3192 | 3215 | */ |
3193 | 3216 | public function isSpecial( $name ) { |
3194 | 3217 | if ( $this->getNamespace() == NS_SPECIAL ) { |
— | — | @@ -3201,7 +3224,7 @@ |
3202 | 3225 | |
3203 | 3226 | /** |
3204 | 3227 | * If the Title refers to a special page alias which is not the local default, |
3205 | | - * returns a new Title which points to the local default. Otherwise, returns $this. |
| 3228 | + * @return \type{Title} A new Title which points to the local default. Otherwise, returns $this. |
3206 | 3229 | */ |
3207 | 3230 | public function fixSpecialName() { |
3208 | 3231 | if ( $this->getNamespace() == NS_SPECIAL ) { |
— | — | @@ -3221,12 +3244,19 @@ |
3222 | 3245 | * In other words, is this a content page, for the purposes of calculating |
3223 | 3246 | * statistics, etc? |
3224 | 3247 | * |
3225 | | - * @return bool |
| 3248 | + * @return \type{\bool} TRUE or FALSE |
3226 | 3249 | */ |
3227 | 3250 | public function isContentPage() { |
3228 | 3251 | return MWNamespace::isContent( $this->getNamespace() ); |
3229 | 3252 | } |
3230 | 3253 | |
| 3254 | + /** |
| 3255 | + * Get all extant redirects to this Title |
| 3256 | + * |
| 3257 | + * @param $ns \twotypes{\int,\null} Single namespace to consider; |
| 3258 | + * NULL to consider all namespaces |
| 3259 | + * @return \arrayof{Title} Redirects to this title |
| 3260 | + */ |
3231 | 3261 | public function getRedirectsHere( $ns = null ) { |
3232 | 3262 | $redirs = array(); |
3233 | 3263 | |
Index: trunk/phase3/maintenance/Doxyfile |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | PROJECT_NAME = MediaWiki |
18 | 18 | PROJECT_NUMBER = {{CURRENT_VERSION}} |
19 | 19 | OUTPUT_DIRECTORY = {{OUTPUT_DIRECTORY}} |
20 | | -CREATE_SUBDIRS = YES |
| 20 | +CREATE_SUBDIRS = NO |
21 | 21 | OUTPUT_LANGUAGE = English |
22 | 22 | BRIEF_MEMBER_DESC = YES |
23 | 23 | REPEAT_BRIEF = YES |
— | — | @@ -290,4 +290,5 @@ |
291 | 291 | "int=\integer" \ |
292 | 292 | "string=String" \ |
293 | 293 | "str=\string" \ |
| 294 | + "array=Array" \ |
294 | 295 | "mixed=Mixed" |