Page MenuHomePhabricator

profileinfo.php.patch

Authored By
bzimport
Nov 21 2014, 9:21 PM
Size
1 KB
Referenced Files
None
Subscribers
None

profileinfo.php.patch

Index: profileinfo.php
===================================================================
--- profileinfo.php (revision 16383)
+++ profileinfo.php (working copy)
@@ -48,7 +48,8 @@
define( 'MW_NO_SETUP', 1 );
require_once( './includes/WebStart.php' );
-require_once("./AdminSettings.php");
+require_once('./AdminSettings.php');
+require_once( 'includes/Setup.php' );
if (!$wgEnableProfileInfo) {
wfDie("disabled");
@@ -149,14 +150,8 @@
if (isset($_REQUEST['sort']) && in_array($_REQUEST['sort'], $sorts))
$sort = $_REQUEST['sort'];
-$dbh = mysql_connect($wgDBserver, $wgDBadminuser, $wgDBadminpassword)
- or wfDie("mysql server failed: " . mysql_error());
-mysql_select_db($wgDBname, $dbh) or wfDie(mysql_error($dbh));
-$res = mysql_query("
- SELECT pf_count, pf_time, pf_name
- FROM profiling
- ORDER BY pf_name ASC
-", $dbh) or wfDie("query failed: " . mysql_error());
+$dbh = wfGetDB(DB_MASTER);
+$res = $dbh->doQuery("SELECT pf_count, pf_time, pf_name FROM profiling ORDER BY pf_name ASC");
if (isset($_REQUEST['filter']))
$filter = $_REQUEST['filter'];
@@ -198,7 +193,7 @@
$sqltotal = 0.0;
$last = false;
-while (($o = mysql_fetch_object($res)) !== false) {
+while (($o = $dbh->fetchRow($res)) !== false) {
$next = new profile_point($o->pf_name, $o->pf_count, $o->pf_time);
$totaltime += $next->time();
if ($last !== false) {
@@ -235,8 +230,8 @@
<p>Total time: <tt><?php printf("%5.02f", $totaltime) ?></p>
<?php
-mysql_free_result($res);
-mysql_close($dbh);
+$dbh->freeResult($res);
+$dbh->close();
?>
</body>

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2665
Default Alt Text
profileinfo.php.patch (1 KB)

Event Timeline