Changeset View
Changeset View
Standalone View
Standalone View
src/applications/console/plugin/DarkConsoleServicesPlugin.php
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | foreach ($log as $key => $entry) { | ||||
if ($entry['type'] != 'query') { | if ($entry['type'] != 'query') { | ||||
continue; | continue; | ||||
} | } | ||||
// For each SELECT query, go issue an EXPLAIN on it so we can flag stuff | // For each SELECT query, go issue an EXPLAIN on it so we can flag stuff | ||||
// causing table scans, etc. | // causing table scans, etc. | ||||
if (preg_match('/^\s*SELECT\b/i', $entry['query'])) { | if (preg_match('/^\s*SELECT\b/i', $entry['query'])) { | ||||
$conn = PhabricatorEnv::newObjectFromConfig( | $conn = PhabricatorDatabaseRef::newRawConnection($entry['config']); | ||||
'mysql.implementation', | |||||
array($entry['config'])); | |||||
try { | try { | ||||
$explain = queryfx_all( | $explain = queryfx_all( | ||||
$conn, | $conn, | ||||
'EXPLAIN %Q', | 'EXPLAIN %Q', | ||||
$entry['query']); | $entry['query']); | ||||
$badness = 0; | $badness = 0; | ||||
$size = 1; | $size = 1; | ||||
▲ Show 20 Lines • Show All 224 Lines • Show Last 20 Lines |