r96569 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96568‎ | r96569 | r96570 >
Date:14:53, 8 September 2011
Author:demon
Status:ok
Tags:
Comment:
Show a more useful message when someone tries enabling profileinfo but hasn't created the table yet
Modified paths:
  • /trunk/phase3/profileinfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/profileinfo.php
@@ -78,6 +78,17 @@
7979 exit( 1 );
8080 }
8181
 82+$dbr = wfGetDB( DB_SLAVE );
 83+
 84+if( !$dbr->tableExists( 'profileinfo' ) ) {
 85+ echo "<p>No 'profileinfo' table exists, so we can't show you anything.</p>\n";
 86+ echo "<p>If you want to log profiling data, create the table using "
 87+ . "<tt>maintenance/archives/patch-profiling.sql</tt> and enable "
 88+ . "<tt>\$wgProfileToDatabase</tt>.</p>\n";
 89+ echo "</body></html>";
 90+ exit( 1 );
 91+}
 92+
8293 $expand = array();
8394 if ( isset( $_REQUEST['expand'] ) )
8495 foreach( explode( ',', $_REQUEST['expand'] ) as $f )
@@ -218,8 +229,6 @@
219230 if ( isset( $_REQUEST['sort'] ) && in_array( $_REQUEST['sort'], $sorts ) )
220231 $sort = $_REQUEST['sort'];
221232
222 -
223 -$dbr = wfGetDB( DB_SLAVE );
224233 $res = $dbr->select( 'profiling', '*', array(), 'profileinfo.php', array( 'ORDER BY' => 'pf_name ASC' ) );
225234
226235 if (isset( $_REQUEST['filter'] ) )

Status & tagging log