Index: trunk/phase3/includes/db/DatabaseOracle.php |
— | — | @@ -697,11 +697,11 @@ |
698 | 698 | FROM all_sequences asq, all_tab_columns atc |
699 | 699 | WHERE decode(atc.table_name, '{$this->mTablePrefix}MWUSER', '{$this->mTablePrefix}USER', atc.table_name) || '_' || |
700 | 700 | 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}')" ); |
703 | 703 | |
704 | 704 | while ( ( $row = $result->fetchRow() ) !== false ) { |
705 | | - $this->sequenceData[$this->tableName( $row[1] )] = array( |
| 705 | + $this->sequenceData[$row[1]] = array( |
706 | 706 | 'sequence' => $row[0], |
707 | 707 | 'column' => $row[2] |
708 | 708 | ); |
— | — | @@ -1172,6 +1172,24 @@ |
1173 | 1173 | if ( is_array($conds) ) { |
1174 | 1174 | $conds = $this->wrapConditionsForWhere( $table, $conds ); |
1175 | 1175 | } |
| 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 | + } |
1176 | 1194 | return parent::delete( $table, $conds, $fname ); |
1177 | 1195 | } |
1178 | 1196 | |