r96087 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96086‎ | r96087 | r96088 >
Date:10:42, 2 September 2011
Author:freakolowsky
Status:ok
Tags:
Comment:
* resolved some issues with sequences and deleting of rows on referenced tables
Modified paths:
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -697,11 +697,11 @@
698698 FROM all_sequences asq, all_tab_columns atc
699699 WHERE decode(atc.table_name, '{$this->mTablePrefix}MWUSER', '{$this->mTablePrefix}USER', atc.table_name) || '_' ||
700700 atc.column_name || '_SEQ' = '{$this->mTablePrefix}' || asq.sequence_name
701 - AND asq.sequence_owner = '{$this->mDBname}'
702 - AND atc.owner = '{$this->mDBname}'" );
 701+ AND asq.sequence_owner = upper('{$this->mDBname}')
 702+ AND atc.owner = upper('{$this->mDBname}')" );
703703
704704 while ( ( $row = $result->fetchRow() ) !== false ) {
705 - $this->sequenceData[$this->tableName( $row[1] )] = array(
 705+ $this->sequenceData[$row[1]] = array(
706706 'sequence' => $row[0],
707707 'column' => $row[2]
708708 );
@@ -1172,6 +1172,24 @@
11731173 if ( is_array($conds) ) {
11741174 $conds = $this->wrapConditionsForWhere( $table, $conds );
11751175 }
 1176+ // a hack for deleting pages, users and images (which have non-nullable FKs)
 1177+ // all deletions on these tables have transactions so final failure rollbacks these updates
 1178+ $table = $this->tableName( $table );
 1179+ if ( $table == $this->tableName( 'page' ) ) {
 1180+ $this->update( 'recentchanges', array( 'rc_cur_id' => 0 ), array( 'rc_cur_id' => $conds['page_id'] ), $fname );
 1181+ } elseif ( $table == $this->tableName( 'user' ) ) {
 1182+ $this->update( 'archive', array( 'ar_user' => 0 ), array( 'ar_user' => $conds['user_id'] ), $fname );
 1183+ $this->update( 'ipblocks', array( 'ipb_user' => 0 ), array( 'ipb_user' => $conds['user_id'] ), $fname );
 1184+ $this->update( 'image', array( 'img_user' => 0 ), array( 'img_user' => $conds['user_id'] ), $fname );
 1185+ $this->update( 'oldimage', array( 'oi_user' => 0 ), array( 'oi_user' => $conds['user_id'] ), $fname );
 1186+ $this->update( 'filearchive', array( 'fa_deleted_user' => 0 ), array( 'fa_deleted_user' => $conds['user_id'] ), $fname );
 1187+ $this->update( 'filearchive', array( 'fa_user' => 0 ), array( 'fa_user' => $conds['user_id'] ), $fname );
 1188+ $this->update( 'uploadstash', array( 'us_user' => 0 ), array( 'us_user' => $conds['user_id'] ), $fname );
 1189+ $this->update( 'recentchanges', array( 'rc_user' => 0 ), array( 'rc_user' => $conds['user_id'] ), $fname );
 1190+ $this->update( 'logging', array( 'log_user' => 0 ), array( 'log_user' => $conds['user_id'] ), $fname );
 1191+ } elseif ( $table == $this->tableName( 'image' ) ) {
 1192+ $this->update( 'oldimage', array( 'oi_name' => 0 ), array( 'oi_name' => $conds['img_name'] ), $fname );
 1193+ }
11761194 return parent::delete( $table, $conds, $fname );
11771195 }
11781196

Follow-up revisions

RevisionCommit summaryAuthorDate
r965081.18: MFT r95562, r95570, r95597, r95608, r95647, r95648, r95674, r95790, r95...catrope21:56, 7 September 2011

Status & tagging log