public function install($path, $source = 0)
{
$pluginBaseDir = null;
$tmp = null;
try {
$this->app->removePluginConfigCache();
Cache::clear($this->app, false);
$tmp = $this->createTempDir();
$this->unpackPluginArchive($path, $tmp);
//一旦テンポラリに展開
$this->checkPluginArchiveContent($tmp);
$config = $this->readYml($tmp . '/' . self::CONFIG_YML);
$event = $this->readYml($tmp . '/' . self::EVENT_YML);
$this->deleteFile($tmp);
// テンポラリのファイルを削除
$this->checkSamePlugin($config['code']);
// 重複していないかチェック
$pluginBaseDir = $this->calcPluginDir($config['code']);
$this->createPluginDir($pluginBaseDir);
// 本来の置き場所を作成
$this->unpackPluginArchive($path, $pluginBaseDir);
// 問題なければ本当のplugindirへ
$this->registerPlugin($config, $event, $source);
// dbにプラグイン登録
$this->app->writePluginConfigCache();
} catch (PluginException $e) {
$this->deleteDirs(array($tmp, $pluginBaseDir));
throw $e;
} catch (\Exception $e) {
// インストーラがどんなExceptionを上げるかわからないので
$this->deleteDirs(array($tmp, $pluginBaseDir));
throw $e;
}
return true;
}