Index: trunk/phase3/includes/RecentChange.php |
— | — | @@ -113,6 +113,11 @@ |
114 | 114 | $this->mAttribs['rc_cur_time'] = $dbw->timestamp($this->mAttribs['rc_cur_time']); |
115 | 115 | $this->mAttribs['rc_id'] = $dbw->nextSequenceValue( 'rc_rc_id_seq' ); |
116 | 116 | |
| 117 | + ## If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL |
| 118 | + if ( $dbw->cascadingDeletes() and $this->mAttribs['rc_cur_id']==0 ) { |
| 119 | + unset ( $this->mAttribs['rc_cur_id'] ); |
| 120 | + } |
| 121 | + |
117 | 122 | # Insert new row |
118 | 123 | $dbw->insert( 'recentchanges', $this->mAttribs, $fname ); |
119 | 124 | |