From 018e6d5f3ded22c50a9bac336295d442a649c42e Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Thu, 8 Sep 2011 14:53:07 +0000 Subject: [PATCH] Show a more useful message when someone tries enabling profileinfo but hasn't created the table yet --- profileinfo.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/profileinfo.php b/profileinfo.php index 3117db31fd..b47033a723 100644 --- a/profileinfo.php +++ b/profileinfo.php @@ -78,6 +78,17 @@ if ( !$wgEnableProfileInfo ) { exit( 1 ); } +$dbr = wfGetDB( DB_SLAVE ); + +if( !$dbr->tableExists( 'profileinfo' ) ) { + echo "

No 'profileinfo' table exists, so we can't show you anything.

\n"; + echo "

If you want to log profiling data, create the table using " + . "maintenance/archives/patch-profiling.sql and enable " + . "\$wgProfileToDatabase.

\n"; + echo ""; + exit( 1 ); +} + $expand = array(); if ( isset( $_REQUEST['expand'] ) ) foreach( explode( ',', $_REQUEST['expand'] ) as $f ) @@ -218,8 +229,6 @@ $sort = 'time'; if ( isset( $_REQUEST['sort'] ) && in_array( $_REQUEST['sort'], $sorts ) ) $sort = $_REQUEST['sort']; - -$dbr = wfGetDB( DB_SLAVE ); $res = $dbr->select( 'profiling', '*', array(), 'profileinfo.php', array( 'ORDER BY' => 'pf_name ASC' ) ); if (isset( $_REQUEST['filter'] ) ) -- 2.20.1