r71826 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71825‎ | r71826 | r71827 >
Date:23:38, 27 August 2010
Author:kaldari
Status:ok
Tags:
Comment:
fixing message typo, switching from select to selectRow, removing unneccessary transaction
Modified paths:
  • /trunk/extensions/CentralNotice/SpecialCentralNotice.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php
@@ -1166,14 +1166,15 @@
11671167
11681168 // Start/end don't line up
11691169 if ( $start > $end || $end < $start ) {
1170 - $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-invalid-date-range3' );
1171 - return;
 1170+ $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-invalid-date-range' );
 1171+ return;
11721172 }
11731173
11741174 // Invalid campaign name
1175 - $res = $dbr->select( 'cn_notices', 'not_name', array( 'not_name' => $noticeName ) );
1176 - if ( $dbr->numRows( $res ) < 1 ) {
 1175+ $row = $dbr->selectRow( 'cn_notices', 'not_name', array( 'not_name' => $noticeName ) );
 1176+ if ( !$row ) {
11771177 $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'centralnotice-notice-doesnt-exist' );
 1178+ return;
11781179 }
11791180
11801181 // Overlap over a date within the same project and language
@@ -1181,7 +1182,6 @@
11821183 $endDate = $dbr->timestamp( $end );
11831184
11841185 $dbw = wfGetDB( DB_MASTER );
1185 - $dbw->begin();
11861186 $res = $dbw->update( 'cn_notices',
11871187 array(
11881188 'not_start' => $startDate,
@@ -1189,7 +1189,6 @@
11901190 ),
11911191 array( 'not_name' => $noticeName )
11921192 );
1193 - $dbw->commit();
11941193 }
11951194
11961195 function updateLock( $noticeName, $isLocked ) {

Status & tagging log