r15790 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r15789‎ | r15790 | r15791 >
Date:01:13, 23 July 2006
Author:greg
Status:old
Tags:
Comment:
Use NULL instead of 0 to indicate "no page" for cases where rc_cur_id is a FK.
Modified paths:
  • /trunk/phase3/includes/RecentChange.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/RecentChange.php
@@ -113,6 +113,11 @@
114114 $this->mAttribs['rc_cur_time'] = $dbw->timestamp($this->mAttribs['rc_cur_time']);
115115 $this->mAttribs['rc_id'] = $dbw->nextSequenceValue( 'rc_rc_id_seq' );
116116
 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+
117122 # Insert new row
118123 $dbw->insert( 'recentchanges', $this->mAttribs, $fname );
119124