r407 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r406‎ | r407 | r408 >
Date:01:10, 21 May 2002
Author:vibber
Status:old
Tags:
Comment:
Fix two one-character bugs in new-page cache-clearing; add some error checks
Modified paths:
  • /trunk/phpwiki/fpw/wikiPage.php (modified) (history)

Diff [purge]

Index: trunk/phpwiki/fpw/wikiPage.php
@@ -200,22 +200,23 @@
201201 $connection = getDBconnection () ;
202202 $sql = "INSERT INTO cur (cur_title, cur_ind_title)
203203 VALUES (\"$this->secureTitle\", REPLACE(\"$this->secureTitle\",'_',' '))" ;
204 - mysql_query ( $sql , $connection ) ;
 204+ if ( mysql_query ( $sql , $connection ) == 0 ) echo mysql_error () ;
205205 # since the page now exists we move all links in the table unlinked to the table linked
206206 $sql = "INSERT INTO linked ( linked_from, linked_to )
207207 SELECT unlinked_from, unlinked_to
208208 FROM unlinked
209209 WHERE unlinked_to = \"$this->secureTitle\"" ;
210 - mysql_query ( $sql , $connection ) ;
 210+ if ( mysql_query ( $sql , $connection ) == 0 ) echo mysql_error () ;
211211 $sql = "DELETE FROM unlinked WHERE unlinked_to = \"$this->secureTitle\"" ;
212 - mysql_query ( $sql , $connection ) ;
 212+ if ( mysql_query ( $sql , $connection ) == 0 ) echo mysql_error () ;
213213 # Flushing cache for all pages that linked to the empty topic
214214 if ( $useCachedPages ) {
215215 $sql1 = "SELECT DISTINCT linked_from FROM linked WHERE linked_to = \"$this->secureTitle\" " ;
216 - $result1 = mysql_query ( $sql , $connection ) ;
 216+ $result1 = mysql_query ( $sql1 , $connection ) ;
 217+ if ( $result1 == 0 ) echo mysql_error () ;
217218 while ( $s1 = mysql_fetch_object ( $result1 ) ) {
218 - $sql2 = "UPDATE cur SET cur_cache=\"\", cur_timestamp=cur_timestamp WHERE cur_title = \"%$s1->linked_from\" " ;
219 - mysql_query ( $sql2 , $connection ) ;
 219+ $sql2 = "UPDATE cur SET cur_cache=\"\", cur_timestamp=cur_timestamp WHERE cur_title = \"$s1->linked_from\" " ;
 220+ if ( mysql_query ( $sql2 , $connection ) == 0 ) echo mysql_error () ;
220221 }
221222 mysql_free_result ( $result1 );
222223 }

Status & tagging log