From: Siebrand Mazeland Date: Wed, 20 Nov 2013 17:20:36 +0000 (+0100) Subject: Update formatting on includes/deferred/ X-Git-Tag: 1.31.0-rc.0~17984^2~1 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/modifier.php?a=commitdiff_plain;h=368a95dc658bada230ba8f163e8e9f85e99c8263;p=lhc%2Fweb%2Fwiklou.git Update formatting on includes/deferred/ Change-Id: Id3f143eae3781b26dcbc3ba63a566b7a6006c0cc --- diff --git a/includes/deferred/CallableUpdate.php b/includes/deferred/CallableUpdate.php index 6eb5541393..c52bb7dbe4 100644 --- a/includes/deferred/CallableUpdate.php +++ b/includes/deferred/CallableUpdate.php @@ -4,7 +4,6 @@ * Deferrable Update for closure/callback */ class MWCallableUpdate implements DeferrableUpdate { - /** * @var closure/callabck */ @@ -26,5 +25,4 @@ class MWCallableUpdate implements DeferrableUpdate { public function doUpdate() { call_user_func( $this->callback ); } - } diff --git a/includes/deferred/DataUpdate.php b/includes/deferred/DataUpdate.php index 7b9ac2811d..986a1f7558 100644 --- a/includes/deferred/DataUpdate.php +++ b/includes/deferred/DataUpdate.php @@ -30,7 +30,6 @@ * subclasses can override the beginTransaction() and commitTransaction() methods. */ abstract class DataUpdate implements DeferrableUpdate { - /** * Constructor */ @@ -122,5 +121,4 @@ abstract class DataUpdate implements DeferrableUpdate { throw $exception; // rethrow after cleanup } } - } diff --git a/includes/deferred/DeferredUpdates.php b/includes/deferred/DeferredUpdates.php index c385f138e9..053b7f6815 100644 --- a/includes/deferred/DeferredUpdates.php +++ b/includes/deferred/DeferredUpdates.php @@ -89,6 +89,7 @@ class DeferredUpdates { // No need to get master connections in case of empty updates array if ( !count( $updates ) ) { wfProfileOut( __METHOD__ ); + return; } diff --git a/includes/deferred/HTMLCacheUpdate.php b/includes/deferred/HTMLCacheUpdate.php index 4147424c2a..8c91347948 100644 --- a/includes/deferred/HTMLCacheUpdate.php +++ b/includes/deferred/HTMLCacheUpdate.php @@ -61,7 +61,7 @@ class HTMLCacheUpdate implements DeferrableUpdate { JobQueueGroup::singleton()->deduplicateRootJob( $job ); } else { // few backlinks ($count might be off even if 0) $dbw = wfGetDB( DB_MASTER ); - $dbw->onTransactionIdle( function() use ( $job ) { + $dbw->onTransactionIdle( function () use ( $job ) { $job->run(); // just do the purge query now } ); } diff --git a/includes/deferred/LinksUpdate.php b/includes/deferred/LinksUpdate.php index fdd0e3c116..00d26eef70 100644 --- a/includes/deferred/LinksUpdate.php +++ b/includes/deferred/LinksUpdate.php @@ -26,22 +26,21 @@ * @todo document (e.g. one-sentence top-level class description). */ class LinksUpdate extends SqlDataUpdate { - // @todo make members protected, but make sure extensions don't break - public $mId, //!< Page ID of the article linked from - $mTitle, //!< Title object of the article linked from - $mParserOutput, //!< Parser output - $mLinks, //!< Map of title strings to IDs for the links in the document - $mImages, //!< DB keys of the images used, in the array key only - $mTemplates, //!< Map of title strings to IDs for the template references, including broken ones - $mExternals, //!< URLs of external links, array key only - $mCategories, //!< Map of category names to sort keys - $mInterlangs, //!< Map of language codes to titles - $mProperties, //!< Map of arbitrary name to value - $mDb, //!< Database connection reference - $mOptions, //!< SELECT options to be used (array) - $mRecursive; //!< Whether to queue jobs for recursive updates + public $mId, //!< Page ID of the article linked from + $mTitle, //!< Title object of the article linked from + $mParserOutput, //!< Parser output + $mLinks, //!< Map of title strings to IDs for the links in the document + $mImages, //!< DB keys of the images used, in the array key only + $mTemplates, //!< Map of title strings to IDs for the template references, including broken ones + $mExternals, //!< URLs of external links, array key only + $mCategories, //!< Map of category names to sort keys + $mInterlangs, //!< Map of language codes to titles + $mProperties, //!< Map of arbitrary name to value + $mDb, //!< Database connection reference + $mOptions, //!< SELECT options to be used (array) + $mRecursive; //!< Whether to queue jobs for recursive updates /** * @var null|array Added links if calculated. @@ -330,6 +329,7 @@ class LinksUpdate extends SqlDataUpdate { ); } } + return $arr; } @@ -350,6 +350,7 @@ class LinksUpdate extends SqlDataUpdate { ); } } + return $arr; } @@ -368,6 +369,7 @@ class LinksUpdate extends SqlDataUpdate { 'il_to' => $iname ); } + return $arr; } @@ -388,6 +390,7 @@ class LinksUpdate extends SqlDataUpdate { ); } } + return $arr; } @@ -432,6 +435,7 @@ class LinksUpdate extends SqlDataUpdate { 'cl_type' => $type, ); } + return $arr; } @@ -452,6 +456,7 @@ class LinksUpdate extends SqlDataUpdate { 'll_title' => $title ); } + return $arr; } @@ -470,6 +475,7 @@ class LinksUpdate extends SqlDataUpdate { 'pp_value' => $value, ); } + return $arr; } @@ -491,6 +497,7 @@ class LinksUpdate extends SqlDataUpdate { ); } } + return $arr; } @@ -509,6 +516,7 @@ class LinksUpdate extends SqlDataUpdate { $del[$ns] = $existing[$ns]; } } + return $del; } @@ -527,6 +535,7 @@ class LinksUpdate extends SqlDataUpdate { $del[$ns] = $existing[$ns]; } } + return $del; } @@ -594,6 +603,7 @@ class LinksUpdate extends SqlDataUpdate { $del[$prefix] = $existing[$prefix]; } } + return $del; } @@ -612,6 +622,7 @@ class LinksUpdate extends SqlDataUpdate { } $arr[$row->pl_namespace][$row->pl_title] = 1; } + return $arr; } @@ -630,6 +641,7 @@ class LinksUpdate extends SqlDataUpdate { } $arr[$row->tl_namespace][$row->tl_title] = 1; } + return $arr; } @@ -645,6 +657,7 @@ class LinksUpdate extends SqlDataUpdate { foreach ( $res as $row ) { $arr[$row->il_to] = 1; } + return $arr; } @@ -660,6 +673,7 @@ class LinksUpdate extends SqlDataUpdate { foreach ( $res as $row ) { $arr[$row->el_to] = 1; } + return $arr; } @@ -675,6 +689,7 @@ class LinksUpdate extends SqlDataUpdate { foreach ( $res as $row ) { $arr[$row->cl_to] = $row->cl_sortkey_prefix; } + return $arr; } @@ -691,6 +706,7 @@ class LinksUpdate extends SqlDataUpdate { foreach ( $res as $row ) { $arr[$row->ll_lang] = $row->ll_title; } + return $arr; } @@ -708,6 +724,7 @@ class LinksUpdate extends SqlDataUpdate { } $arr[$row->iwl_prefix][$row->iwl_title] = 1; } + return $arr; } @@ -723,6 +740,7 @@ class LinksUpdate extends SqlDataUpdate { foreach ( $res as $row ) { $arr[$row->pp_propname] = $row->pp_value; } + return $arr; } @@ -783,8 +801,9 @@ class LinksUpdate extends SqlDataUpdate { } $result = array(); foreach ( $this->linkInsertions as $insertion ) { - $result[] = Title::makeTitle( $insertion[ 'pl_namespace' ], $insertion[ 'pl_title' ] ); + $result[] = Title::makeTitle( $insertion['pl_namespace'], $insertion['pl_title'] ); } + return $result; } @@ -803,6 +822,7 @@ class LinksUpdate extends SqlDataUpdate { $result[] = Title::makeTitle( $ns, $title ); } } + return $result; } } @@ -811,8 +831,7 @@ class LinksUpdate extends SqlDataUpdate { * Update object handling the cleanup of links tables after a page was deleted. **/ class LinksDeletionUpdate extends SqlDataUpdate { - - protected $mPage; //!< WikiPage the wikipage that was deleted + protected $mPage; //!< WikiPage the wikipage that was deleted /** * Constructor diff --git a/includes/deferred/SearchUpdate.php b/includes/deferred/SearchUpdate.php index 82a413e920..85cc5e76fe 100644 --- a/includes/deferred/SearchUpdate.php +++ b/includes/deferred/SearchUpdate.php @@ -180,6 +180,7 @@ class SearchUpdate implements DeferrableUpdate { # Strip wiki '' and ''' $text = preg_replace( "/''[']*/", " ", $text ); wfProfileOut( __METHOD__ . '-regexps' ); + return $text; } } diff --git a/includes/deferred/SiteStatsUpdate.php b/includes/deferred/SiteStatsUpdate.php index 09ff87dd3b..10511eec24 100644 --- a/includes/deferred/SiteStatsUpdate.php +++ b/includes/deferred/SiteStatsUpdate.php @@ -85,6 +85,7 @@ class SiteStatsUpdate implements DeferrableUpdate { || !$dbw->lock( $lockKey, __METHOD__, 1 ) // 1 sec timeout ) { $this->doUpdatePendingDeltas(); + return; } $pd = $this->getPendingDeltas(); @@ -143,6 +144,7 @@ class SiteStatsUpdate implements DeferrableUpdate { array( 'ss_row_id' => 1 ), __METHOD__ ); + return $activeUsers; } @@ -216,8 +218,8 @@ class SiteStatsUpdate implements DeferrableUpdate { $pending = array(); foreach ( array( 'ss_total_views', 'ss_total_edits', - 'ss_good_articles', 'ss_total_pages', 'ss_users', 'ss_images' ) as $type ) - { + 'ss_good_articles', 'ss_total_pages', 'ss_users', 'ss_images' ) as $type + ) { // Get pending increments and pending decrements $pending[$type]['+'] = (int)$wgMemc->get( $this->getTypeCacheKey( $type, '+' ) ); $pending[$type]['-'] = (int)$wgMemc->get( $this->getTypeCacheKey( $type, '-' ) ); @@ -242,4 +244,3 @@ class SiteStatsUpdate implements DeferrableUpdate { } } } - diff --git a/includes/deferred/SqlDataUpdate.php b/includes/deferred/SqlDataUpdate.php index 51188d85c9..c98c1fd7f4 100644 --- a/includes/deferred/SqlDataUpdate.php +++ b/includes/deferred/SqlDataUpdate.php @@ -31,11 +31,10 @@ * the beginTransaction() and commitTransaction() methods. */ abstract class SqlDataUpdate extends DataUpdate { + protected $mDb; //!< Database connection reference + protected $mOptions; //!< SELECT options to be used (array) - protected $mDb; //!< Database connection reference - protected $mOptions; //!< SELECT options to be used (array) - - private $mHasTransaction; //!< bool whether a transaction is open on this object (internal use only!) + private $mHasTransaction; //!< bool whether a transaction is open on this object (internal use only!) protected $mUseTransaction; //!< bool whether this update should be wrapped in a transaction /** @@ -148,5 +147,4 @@ abstract class SqlDataUpdate extends DataUpdate { ), __METHOD__ ); } - } diff --git a/includes/deferred/SquidUpdate.php b/includes/deferred/SquidUpdate.php index 71afeba924..59347d630c 100644 --- a/includes/deferred/SquidUpdate.php +++ b/includes/deferred/SquidUpdate.php @@ -26,7 +26,6 @@ * @ingroup Cache */ class SquidUpdate { - /** * Collection of URLs to purge. * @var array @@ -83,6 +82,7 @@ class SquidUpdate { } wfProfileOut( __METHOD__ ); + return new SquidUpdate( $blurlArr ); } @@ -102,6 +102,7 @@ class SquidUpdate { break; } } + return new SquidUpdate( $urlArr ); } @@ -111,6 +112,7 @@ class SquidUpdate { */ public static function newSimplePurge( Title $title ) { $urlArr = $title->getSquidURLs(); + return new SquidUpdate( $urlArr ); } @@ -194,11 +196,12 @@ class SquidUpdate { // pfsockopen doesn't work because we need set_sock_opt $conn = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP ); - if ( ! $conn ) { + if ( !$conn ) { $errstr = socket_strerror( socket_last_error() ); wfDebugLog( 'squid', __METHOD__ . ": Error opening UDP socket: $errstr\n" ); wfProfileOut( __METHOD__ ); + return; } @@ -295,6 +298,7 @@ class SquidUpdate { return $routing; } } + return false; } } diff --git a/includes/deferred/ViewCountUpdate.php b/includes/deferred/ViewCountUpdate.php index 22a4649364..6863918451 100644 --- a/includes/deferred/ViewCountUpdate.php +++ b/includes/deferred/ViewCountUpdate.php @@ -49,6 +49,7 @@ class ViewCountUpdate implements DeferrableUpdate { if ( $wgHitcounterUpdateFreq <= 1 || $dbw->getType() == 'sqlite' ) { $dbw->update( 'page', array( 'page_counter = page_counter + 1' ), array( 'page_id' => $this->id ), __METHOD__ ); + return; } @@ -59,7 +60,8 @@ class ViewCountUpdate implements DeferrableUpdate { if ( rand() % $checkfreq == 0 && $dbw->lastErrno() == 0 ) { $this->collect(); } - } catch ( DBError $e ) {} + } catch ( DBError $e ) { + } } protected function collect() {