Ori.livneh has submitted this change and it was merged. Change subject: Replace replace() call with set() ......................................................................
Replace replace() call with set() * Added TODO note about atomicity (which was never there) Change-Id: Ib9907bd2e0619891784a3b91f042424935ba4cec --- M includes/ArticleMetadata.php 1 file changed, 9 insertions(+), 8 deletions(-) Approvals: Ori.livneh: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/ArticleMetadata.php b/includes/ArticleMetadata.php index d397f52..9ba723d 100644 --- a/includes/ArticleMetadata.php +++ b/includes/ArticleMetadata.php @@ -57,10 +57,11 @@ $pageId = $this->mPageId; } + // @TODO: use merge() to make this atomic foreach ( $pageId as $val ) { - $data = $wgMemc->get( $keyPrefix . '-' . $val ); + $data = $wgMemc->get( $keyPrefix . '-' . $val ); if ( $data !== false ) { - $wgMemc->replace( $keyPrefix . '-' . $val, array_merge( $data, $update ), 86400 ); + $wgMemc->set( $keyPrefix . '-' . $val, array_merge( $data, $update ), 86400 ); } } } @@ -382,17 +383,17 @@ $this->defaultMode = false; } } - + /** * Config what db to use for each component - * @param $config array + * @param $config array * example: array( 'BasicData' => DB_SLAVE, 'UserData' => DB_MASTER ) */ public function configComponentDb( $config ) { $dbMode = array( DB_MASTER, DB_SLAVE ); foreach ( $this->componentDb as $key => $value ) { if ( isset ( $config[$key] ) && in_array( $config[$key], $dbMode ) ) { - $this->componentDb[$key] = $config[$key]; + $this->componentDb[$key] = $config[$key]; } } } @@ -544,7 +545,7 @@ $articles = array(); } $this->articles = $articles; - + $this->db = wfGetDB( $componentDb ); $this->componentDb = $componentDb; @@ -725,7 +726,7 @@ $article = $this->articles[$pageId]; } else { if ( $this->componentDb === DB_MASTER ) { - $from = 'fromdbmaster'; + $from = 'fromdbmaster'; } else { $from = 'fromdb'; } @@ -753,7 +754,7 @@ $text = strip_tags( $text ); $attempt = 0; - // 10 attempts at most, the logic here is to find the first }} and + // 10 attempts at most, the logic here is to find the first }} and // find the matching {{ for that }} while ( $attempt < 10 ) { $closeCurPos = strpos( $text, '}}' ); -- To view, visit https://gerrit.wikimedia.org/r/115519 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib9907bd2e0619891784a3b91f042424935ba4cec Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/PageTriage Gerrit-Branch: master Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: Bennysitu <bennys...@gmail.com> Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits