|
|
@ -64,7 +64,7 @@ class DefaultController extends Controller |
|
|
|
|
|
|
|
|
|
|
|
public function actionToolbar($tag) |
|
|
|
public function actionToolbar($tag) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$this->loadData($tag); |
|
|
|
$this->loadData($tag, 3); |
|
|
|
return $this->renderPartial('toolbar', [ |
|
|
|
return $this->renderPartial('toolbar', [ |
|
|
|
'tag' => $tag, |
|
|
|
'tag' => $tag, |
|
|
|
'panels' => $this->module->panels, |
|
|
|
'panels' => $this->module->panels, |
|
|
@ -78,9 +78,12 @@ class DefaultController extends Controller |
|
|
|
|
|
|
|
|
|
|
|
private $_manifest; |
|
|
|
private $_manifest; |
|
|
|
|
|
|
|
|
|
|
|
protected function getManifest() |
|
|
|
protected function getManifest($forceReload = false) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ($this->_manifest === null) { |
|
|
|
if ($this->_manifest === null || $forceReload) { |
|
|
|
|
|
|
|
if ($forceReload) { |
|
|
|
|
|
|
|
clearstatcache(); |
|
|
|
|
|
|
|
} |
|
|
|
$indexFile = $this->module->dataPath . '/index.data'; |
|
|
|
$indexFile = $this->module->dataPath . '/index.data'; |
|
|
|
if (is_file($indexFile)) { |
|
|
|
if (is_file($indexFile)) { |
|
|
|
$this->_manifest = array_reverse(unserialize(file_get_contents($indexFile)), true); |
|
|
|
$this->_manifest = array_reverse(unserialize(file_get_contents($indexFile)), true); |
|
|
@ -91,9 +94,13 @@ class DefaultController extends Controller |
|
|
|
return $this->_manifest; |
|
|
|
return $this->_manifest; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function loadData($tag) |
|
|
|
public function loadData($tag, $maxRetry = 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$manifest = $this->getManifest(); |
|
|
|
// retry loading debug data because the debug data is logged in shutdown function |
|
|
|
|
|
|
|
// which may be delayed in some environment if xdebug is enabled. |
|
|
|
|
|
|
|
// See: https://github.com/yiisoft/yii2/issues/1504 |
|
|
|
|
|
|
|
for ($retry = 0; $retry <= $maxRetry; ++$retry) { |
|
|
|
|
|
|
|
$manifest = $this->getManifest($retry > 0); |
|
|
|
if (isset($manifest[$tag])) { |
|
|
|
if (isset($manifest[$tag])) { |
|
|
|
$dataFile = $this->module->dataPath . "/$tag.data"; |
|
|
|
$dataFile = $this->module->dataPath . "/$tag.data"; |
|
|
|
$data = unserialize(file_get_contents($dataFile)); |
|
|
|
$data = unserialize(file_get_contents($dataFile)); |
|
|
@ -107,8 +114,10 @@ class DefaultController extends Controller |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$this->summary = $data['summary']; |
|
|
|
$this->summary = $data['summary']; |
|
|
|
} else { |
|
|
|
return; |
|
|
|
throw new NotFoundHttpException("Unable to find debug data tagged with '$tag'."); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw new NotFoundHttpException("Unable to find debug data tagged with '$tag'."); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|