Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/115519
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(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageTriage
refs/changes/19/115519/1
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: newchange
Gerrit-Change-Id: Ib9907bd2e0619891784a3b91f042424935ba4cec
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PageTriage
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits