Skip to content

Commit

Permalink
Merge pull request #2 from kirsenn/master
Browse files Browse the repository at this point in the history
Don't crash application if newrelic ext is missing
  • Loading branch information
bazilio91 committed Dec 24, 2015
2 parents d35d140 + 171773b commit 4d34147
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Newrelic.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,15 @@ public function init()
{
parent::init();

if ($this->enabled && Agent::isLoaded()) {
$this->name = $this->name ? $this->name : \Yii::$app->name;
$this->agent = new Agent();
$this->agent->setAppname($this->name, $this->licence);
if ($this->enabled) {
if (Agent::isLoaded()) {
$this->name = $this->name ? $this->name : \Yii::$app->name;
$this->agent = new Agent();
$this->agent->setAppname($this->name, $this->licence);
} else {
$this->enabled = false;
\Yii::$app->getLog()->getLogger()->log('Newrelic extension is not loaded', \yii\log\Logger::LEVEL_ERROR);
}
}
}
}

0 comments on commit 4d34147

Please sign in to comment.