Skip to content

Commit

Permalink
Dev: Don't use active record when saving plugin load error
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Oct 9, 2018
1 parent c90db21 commit 9b90261
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions application/models/Plugin.php
Expand Up @@ -47,9 +47,14 @@ public function tableName()
*/
public function setLoadError(array $error)
{
$this->load_error = 1;
$this->load_error_message = $error['message'] . ' ' . $error['file'];
return $this->update();
// NB: Don't use ActiveRecord here, since it will trigger events and
// load the plugin system all over again.
// TODO: Works on all SQL systems?
$sql = sprintf(
"UPDATE {{plugins}} SET load_error = 1, load_error_message = '%s' WHERE id = " . $this->id,
addslashes($error['message'] . ' ' . $error['file'])
);
return \Yii::app()->db->createCommand($sql)->execute();
}

/**
Expand Down

0 comments on commit 9b90261

Please sign in to comment.