r63767 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63766‎ | r63767 | r63768 >
Date:12:04, 15 March 2010
Author:lhridley
Status:ok
Tags:
Comment:
Last of the preliminary documentation review and update on Article.php
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -2505,7 +2505,10 @@
25062506
25072507 /**
25082508 * Auto-generates a deletion reason
 2509+ *
25092510 * @param &$hasHistory Boolean: whether the page has a history
 2511+ * @return mixed String containing deletion reason or empty string, or boolean false
 2512+ * if no revision occurred
25102513 */
25112514 public function generateReason( &$hasHistory ) {
25122515 global $wgContLang;
@@ -2911,7 +2914,16 @@
29122915 /**
29132916 * Back-end article deletion
29142917 * Deletes the article with database consistency, writes logs, purges caches
2915 - * Returns success
 2918+ *
 2919+ * @param $reason string delete reason for deletion log
 2920+ * @param suppress bitfield
 2921+ * Revision::DELETED_TEXT
 2922+ * Revision::DELETED_COMMENT
 2923+ * Revision::DELETED_USER
 2924+ * Revision::DELETED_RESTRICTED
 2925+ * @param $id int article ID
 2926+ * @param $commit boolean defaults to true, triggers transaction end
 2927+ * @return boolean true if successful
29162928 */
29172929 public function doDeleteArticle( $reason, $suppress = false, $id = 0, $commit = true ) {
29182930 global $wgUseSquid, $wgDeferredUpdateList;
@@ -3583,7 +3595,9 @@
35843596 * This function is called right before saving the wikitext,
35853597 * so we can do things like signatures and links-in-context.
35863598 *
3587 - * @param $text String
 3599+ * @param $text String article contents
 3600+ * @return string article contents with altered wikitext markup (signatures
 3601+ * converted, {{subst:}}, templates, etc.)
35883602 */
35893603 public function preSaveTransform( $text ) {
35903604 global $wgParser, $wgUser;
@@ -3596,6 +3610,8 @@
35973611 * checkLastModified returns true if it has taken care of all
35983612 * output to the client that is necessary for this request.
35993613 * (that is, it has sent a cached version of the page)
 3614+ *
 3615+ * @return boolean true if cached version send, false otherwise
36003616 */
36013617 protected function tryFileCache() {
36023618 static $called = false;
@@ -3638,7 +3654,7 @@
36393655
36403656 /**
36413657 * Loads page_touched and returns a value indicating if it should be used
3642 - *
 3658+ * @return boolean true if not a redirect
36433659 */
36443660 public function checkTouched() {
36453661 if ( !$this->mDataLoaded ) {
@@ -3649,6 +3665,7 @@
36503666
36513667 /**
36523668 * Get the page_touched field
 3669+ * @return string containing GMT timestamp
36533670 */
36543671 public function getTouched() {
36553672 # Ensure that page data has been loaded
@@ -3660,6 +3677,7 @@
36613678
36623679 /**
36633680 * Get the page_latest field
 3681+ * @return integer rev_id of current revision
36643682 */
36653683 public function getLatest() {
36663684 if ( !$this->mDataLoaded ) {
@@ -3782,7 +3800,10 @@
37833801 $title->purgeSquid();
37843802 $title->deleteTitleProtection();
37853803 }
3786 -
 3804+
 3805+ /**
 3806+ * Clears caches when article is deleted
 3807+ */
37873808 public static function onArticleDelete( $title ) {
37883809 global $wgMessageCache;
37893810 # Update existence markers on article/talk tabs...
@@ -3912,7 +3933,7 @@
39133934 * on a given page. If page does not exist, returns false.
39143935 *
39153936 * @param $title Title object
3916 - * @return array
 3937+ * @return mixed array or boolean false
39173938 */
39183939 public function pageCountInfo( $title ) {
39193940 $id = $title->getArticleId();
@@ -4042,6 +4063,7 @@
40434064 *
40444065 * @param $text String
40454066 * @param $cache Boolean
 4067+ * @param $parserOptions mixed ParserOptions object, or boolean false
40464068 */
40474069 public function outputWikiText( $text, $cache = true, $parserOptions = false ) {
40484070 global $wgOut;
@@ -4054,6 +4076,11 @@
40554077 * This does all the heavy lifting for outputWikitext, except it returns the parser
40564078 * output instead of sending it straight to $wgOut. Makes things nice and simple for,
40574079 * say, embedding thread pages within a discussion system (LiquidThreads)
 4080+ *
 4081+ * @param $text string
 4082+ * @param $cache boolean
 4083+ * @param $parserOptions parsing options, defaults to false
 4084+ * @return string containing parsed output
40584085 */
40594086 public function getOutputFromWikitext( $text, $cache = true, $parserOptions = false ) {
40604087 global $wgParser, $wgOut, $wgEnableParserCache, $wgUseFileCache;
@@ -4089,6 +4116,7 @@
40904117
40914118 /**
40924119 * Get parser options suitable for rendering the primary article wikitext
 4120+ * @return mixed ParserOptions object or boolean false
40934121 */
40944122 public function getParserOptions() {
40954123 global $wgUser;
@@ -4099,6 +4127,12 @@
41004128 }
41014129 return $this->mParserOptions;
41024130 }
 4131+
 4132+ /**
 4133+ * Updates cascading protections
 4134+ *
 4135+ * @param $parserOutput mixedParseerOptions object, or boolean false
 4136+ **/
41034137
41044138 protected function doCascadeProtectionUpdates( $parserOutput ) {
41054139 if ( !$this->isCurrent() || wfReadOnly() || !$this->mTitle->areRestrictionsCascading() ) {
@@ -4153,7 +4187,6 @@
41544188 *
41554189 * @param $added array The names of categories that were added
41564190 * @param $deleted array The names of categories that were deleted
4157 - * @return null
41584191 */
41594192 public function updateCategoryCounts( $added, $deleted ) {
41604193 $ns = $this->mTitle->getNamespace();
@@ -4207,11 +4240,14 @@
42084241 }
42094242 }
42104243
4211 - /** Lightweight method to get the parser output for a page, checking the parser cache
 4244+ /**
 4245+ * Lightweight method to get the parser output for a page, checking the parser cache
42124246 * and so on. Doesn't consider most of the stuff that Article::view is forced to
42134247 * consider, so it's not appropriate to use there.
 4248+ *
 4249+ * @param $oldid mixed integer Revision ID or null
42144250 */
4215 - function getParserOutput( $oldid = null ) {
 4251+ public function getParserOutput( $oldid = null ) {
42164252 global $wgEnableParserCache, $wgUser, $wgOut;
42174253
42184254 // Should the parser cache be used?

Status & tagging log