Skip to content

Commit ef3d869

Browse files
committed
Merge pull request rlerdorf#32 from rlerdorf/revert-29-master
Revert "Update opcache.php"
2 parents f3af630 + 5ac86ca commit ef3d869

File tree

1 file changed

+26
-30
lines changed

1 file changed

+26
-30
lines changed

opcache.php

+26-30
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ public function getWastedMemoryPercentage()
224224
return number_format($this->_status['memory_usage']['current_wasted_percentage'], 2);
225225
}
226226

227-
public function getD3ScriptsJson()
227+
public function getD3Scripts()
228228
{
229-
return json_encode($this->_d3Scripts);
229+
return $this->_d3Scripts;
230230
}
231231

232232
private function _processPartition($value, $name = null)
@@ -281,15 +281,15 @@ private function _arrayPset(&$array, $key, $value)
281281
$array[array_shift($keys)] = $value;
282282
return $array;
283283
}
284-
285-
public static function printStats()
286-
{
287-
$dataModel = new self();
288-
return <<<HERE
289-
<!DOCTYPE html><meta charset="utf-8">
284+
285+
}
286+
287+
$dataModel = new OpCacheDataModel();
288+
?>
289+
<!DOCTYPE html>
290+
<meta charset="utf-8">
290291
<html>
291-
<head>
292-
<title>{$dataModel->getPageTitle()}</title>
292+
<head>
293293
<style>
294294
body {
295295
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
@@ -458,10 +458,8 @@ public static function printStats()
458458
cursor: pointer;
459459
}
460460
</style>
461-
462461
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.0.1/d3.v3.min.js"></script>
463462
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
464-
465463
<script>
466464
var hidden = {};
467465
function toggleVisible(head, row) {
@@ -476,11 +474,12 @@ function toggleVisible(head, row) {
476474
}
477475
}
478476
</script>
479-
480-
</head>
481-
<body>
477+
<title><?php echo $dataModel->getPageTitle(); ?></title>
478+
</head>
479+
480+
<body>
482481
<div id="container">
483-
<h1>{$dataModel->getPageTitle()}</h1>
482+
<h1><?php echo $dataModel->getPageTitle(); ?></h1>
484483

485484
<div class="tabs">
486485

@@ -489,7 +488,7 @@ function toggleVisible(head, row) {
489488
<label for="tab-status">Status</label>
490489
<div class="content">
491490
<table>
492-
{$dataModel->getStatusDataRows()}
491+
<?php echo $dataModel->getStatusDataRows(); ?>
493492
</table>
494493
</div>
495494
</div>
@@ -499,22 +498,22 @@ function toggleVisible(head, row) {
499498
<label for="tab-config">Configuration</label>
500499
<div class="content">
501500
<table>
502-
{$dataModel->getConfigDataRows()}
501+
<?php echo $dataModel->getConfigDataRows(); ?>
503502
</table>
504503
</div>
505504
</div>
506505

507506
<div class="tab">
508507
<input type="radio" id="tab-scripts" name="tab-group-1">
509-
<label for="tab-scripts">Scripts ({$dataModel->getScriptStatusCount()})</label>
508+
<label for="tab-scripts">Scripts (<?php echo $dataModel->getScriptStatusCount(); ?>)</label>
510509
<div class="content">
511510
<table style="font-size:0.8em;">
512511
<tr>
513512
<th width="10%">Hits</th>
514513
<th width="20%">Memory</th>
515514
<th width="70%">Path</th>
516515
</tr>
517-
{$dataModel->getScriptStatusRows()}
516+
<?php echo $dataModel->getScriptStatusRows(); ?>
518517
</table>
519518
</div>
520519
</div>
@@ -543,7 +542,7 @@ function toggleVisible(head, row) {
543542
<div id="partition"></div>
544543

545544
<script>
546-
var dataset = {$dataModel->getGraphDataSetJson()};
545+
var dataset = <?php echo $dataModel->getGraphDataSetJson(); ?>
547546

548547
var width = 400,
549548
height = 400,
@@ -577,10 +576,10 @@ function toggleVisible(head, row) {
577576
function set_text(t) {
578577
if (t === "memory") {
579578
d3.select("#stats").html(
580-
"<table><tr><th style='background:#B41F1F;'>Used</th><td>{$dataModel->getHumanUsedMemory()}</td></tr>"+
581-
"<tr><th style='background:#1FB437;'>Free</th><td>{$dataModel->getHumanFreeMemory()}</td></tr>"+
582-
"<tr><th style='background:#ff7f0e;' rowspan=\"2\">Wasted</th><td>{$dataModel->getHumanWastedMemory()}</td></tr>"+
583-
"<tr><td>{$dataModel->getWastedMemoryPercentage()}%</td></tr></table>"
579+
"<table><tr><th style='background:#B41F1F;'>Used</th><td><?php echo $dataModel->getHumanUsedMemory()?></td></tr>"+
580+
"<tr><th style='background:#1FB437;'>Free</th><td><?php echo $dataModel->getHumanFreeMemory()?></td></tr>"+
581+
"<tr><th style='background:#ff7f0e;' rowspan=\"2\">Wasted</th><td><?php echo $dataModel->getHumanWastedMemory()?></td></tr>"+
582+
"<tr><td><?php echo $dataModel->getWastedMemoryPercentage()?>%</td></tr></table>"
584583
);
585584
} else if (t === "keys") {
586585
d3.select("#stats").html(
@@ -659,7 +658,7 @@ function format_value(value) {
659658
var partition = d3.layout.partition()
660659
.value(function(d) { return d.size; });
661660

662-
root = {$dataModel->getD3ScriptsJson()};
661+
root = JSON.parse('<?php echo json_encode($dataModel->getD3Scripts()); ?>');
663662

664663
var g = vis.selectAll("g")
665664
.data(partition.nodes(root))
@@ -741,8 +740,5 @@ function handleVisualisationToggle(close) {
741740

742741
});
743742
</script>
744-
</body>
743+
</body>
745744
</html>
746-
HERE;
747-
}
748-
}

0 commit comments

Comments
 (0)