r46079 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46078‎ | r46079 | r46080 >
Date:18:19, 23 January 2009
Author:tparscal
Status:deferred
Tags:
Comment:
Changed saveChange to insertChange to better reflect underlying operation.
Modified paths:
  • /trunk/extensions/DataCenter/Controllers/Assets.php (modified) (history)
  • /trunk/extensions/DataCenter/Controllers/Facilities.php (modified) (history)
  • /trunk/extensions/DataCenter/Controllers/Models.php (modified) (history)
  • /trunk/extensions/DataCenter/DataCenter.db.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DataCenter/DataCenter.db.php
@@ -1020,6 +1020,7 @@
10211021 public static function getChanges(
10221022 array $options = array()
10231023 ) {
 1024+ $dbr = wfGetDB( DB_SLAVE );
10241025 return self::getRows(
10251026 'DataCenterDBChange',
10261027 'meta',
@@ -1027,19 +1028,22 @@
10281029 array_merge_recursive(
10291030 $options,
10301031 array(
1031 - 'tables' => array( 'user' ),
 1032+ 'tables' => array( $dbr->tablePrefix() . 'user' ),
10321033 'fields' => array(
1033 - 'user_name as ' .
 1034+ 'user_name as' .
10341035 self::getColumnName(
10351036 'meta', 'change', 'username'
10361037 )
10371038 ),
1038 - 'conditions' => array(
1039 - self::getColumnName(
1040 - 'meta', 'change', 'user'
1041 - ) .
1042 - ' = user_id'
1043 - ),
 1039+ 'joins' => array(
 1040+ 'user' => array(
 1041+ 'LEFT JOIN',
 1042+ 'user_id = ' .
 1043+ self::getColumnName(
 1044+ 'meta', 'change', 'user'
 1045+ )
 1046+ )
 1047+ )
10441048 )
10451049 )
10461050 );
@@ -1655,14 +1659,14 @@
16561660 }
16571661 }
16581662
1659 - public function saveChange(
 1663+ public function insertChange(
16601664 $values
16611665 ) {
16621666 if ( !is_array( $values ) ) {
16631667 return;
16641668 }
16651669 $change = DataCenterDBChange::newFromComponent( $this, $values );
1666 - $change->save();
 1670+ $change->insert();
16671671 }
16681672
16691673 /**
Index: trunk/extensions/DataCenter/Controllers/Facilities.php
@@ -58,7 +58,7 @@
5959 if ( isset( $component ) ) {
6060 $component->save();
6161 $component->saveMetaValues( $data['meta'] );
62 - $component->saveChange( $data['change'] );
 62+ $component->insertChange( $data['change'] );
6363 return true;
6464 }
6565 return false;
Index: trunk/extensions/DataCenter/Controllers/Assets.php
@@ -50,7 +50,7 @@
5151 $asset = DataCenterDBAsset::newFromType( $type, $data['row'] );
5252 $asset->save();
5353 $asset->saveMetaValues( $data['meta'] );
54 - $asset->saveChange( $data['change'] );
 54+ $asset->insertChange( $data['change'] );
5555 return true;
5656 }
5757 }
\ No newline at end of file
Index: trunk/extensions/DataCenter/Controllers/Models.php
@@ -51,7 +51,7 @@
5252 $model = DataCenterDBModel::newFromType( $type, $data['row'] );
5353 $model->save();
5454 $model->saveMetaValues( $data['meta'] );
55 - $model->saveChange( $data['change'] );
 55+ $model->insertChange( $data['change'] );
5656 return true;
5757 }
5858

Status & tagging log