r83022 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83021‎ | r83022 | r83023 >
Date:17:16, 1 March 2011
Author:demon
Status:resolved (Comments)
Tags:
Comment:
Skip site stats insertion if theres already a row. Happens if install fails part-way and then reattempts
Modified paths:
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/Installer.php
@@ -562,15 +562,18 @@
563563 if ( !$status->isOK() ) {
564564 return $status;
565565 }
566 - $status->value->insert( 'site_stats', array(
567 - 'ss_row_id' => 1,
568 - 'ss_total_views' => 0,
569 - 'ss_total_edits' => 0,
570 - 'ss_good_articles' => 0,
571 - 'ss_total_pages' => 0,
572 - 'ss_users' => 0,
573 - 'ss_admins' => 0,
574 - 'ss_images' => 0 ) );
 566+ if( !$status->value->selectField( 'site_stats', 'ss_row_id' ) ) {
 567+ $status->value->insert( 'site_stats', array(
 568+ 'ss_row_id' => 1,
 569+ 'ss_total_views' => 0,
 570+ 'ss_total_edits' => 0,
 571+ 'ss_good_articles' => 0,
 572+ 'ss_total_pages' => 0,
 573+ 'ss_users' => 0,
 574+ 'ss_images' => 0 )
 575+ );
 576+ }
 577+
575578 return Status::newGood();
576579 }
577580

Follow-up revisions

RevisionCommit summaryAuthorDate
r83215Cleanup r83022: just use IGNOREdemon13:17, 4 March 2011

Comments

#Comment by Platonides (talk | contribs)   21:40, 1 March 2011

There's no need to do that. Just append to the insert method: __METHOD__, 'IGNORE' );

Status & tagging log