Skip to content

Commit

Permalink
Use 'w' instead of deprecated 'safe'
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshartig committed Jul 5, 2014
1 parent fe61f71 commit 18ed877
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/DB/MongoConnection.php
Expand Up @@ -253,7 +253,7 @@ public function install($displayDebugOutput = false)
$keys = $indexToAdd['key'];
unset($indexToAdd['key']);
$options = $indexToAdd;
$options['safe'] = true;
$options['w'] = true;
$options['timeout'] = 300000; //5 minutes
if ($displayDebugOutput) {
echo "MongoConnection: Adding index on " . json_encode($keys) . " to collection $collName. This may take a while...\n";
Expand Down Expand Up @@ -327,7 +327,7 @@ public function storeNewUser($userID, $username = null, $password = null, $permi
);
$coll = $this->getCollection(self::COLL_USERS);
try {
$insertResult = $coll->insert($doc, array('safe' => true));
$insertResult = $coll->insert($doc, array('w' => true));
} catch (MongoCursorException $e) {
//duplicate userID already exists
if ($e->getCode() == 11000) {
Expand Down Expand Up @@ -355,7 +355,7 @@ public function modifyUserPermissions($userID, $permissions = null, $globalAdmin

$coll = $this->getCollection(self::COLL_USERS);
$update = array('$set' => $set);
$updateResult = $coll->update($query, $update, array('upsert' => false, 'multiple' => false, 'safe' => true));
$updateResult = $coll->update($query, $update, array('upsert' => false, 'multiple' => false, 'w' => true));
if (!empty($updateResult['n'])) {
return true;
}
Expand Down Expand Up @@ -389,7 +389,7 @@ public function modifyUserPassword($userID, $newPassword, $oldPassword = null)
);
$coll = $this->getCollection(self::COLL_USERS);
$update = array('$set' => $set);
$updateResult = $coll->update($query, $update, array('upsert' => false, 'multiple' => false, 'safe' => true));
$updateResult = $coll->update($query, $update, array('upsert' => false, 'multiple' => false, 'w' => true));
if (!empty($updateResult['n'])) {
return true;
}
Expand All @@ -407,7 +407,7 @@ public function modifyUserPoints($userID, $pointsToAdd = 0)
$coll = $this->getCollection(self::COLL_USERS);
$update = array('$set' => $set, '$inc' => $inc);
//todo: do findAndModify so we can get the new value of points
$updateResult = $coll->update($query, $update, array('upsert' => false, 'multiple' => false, 'safe' => true));
$updateResult = $coll->update($query, $update, array('upsert' => false, 'multiple' => false, 'w' => true));
if (empty($updateResult['n'])) {
return null;
}
Expand Down Expand Up @@ -453,7 +453,7 @@ public function storeNewLanguage($project, $displayName, $id = null, $everyonePe
);
$coll = $this->getCollection(self::COLL_TRANSLATIONS);
try {
$insertResult = $coll->insert($doc, array('safe' => true));
$insertResult = $coll->insert($doc, array('w' => true));
} catch (MongoCursorException $e) {
//duplicate language already exists
if ($e->getCode() == 11000) {
Expand Down

0 comments on commit 18ed877

Please sign in to comment.