diff --git a/web/application/controllers/PluginsController.php b/web/application/controllers/PluginsController.php index 9570cf6..ac98755 100644 --- a/web/application/controllers/PluginsController.php +++ b/web/application/controllers/PluginsController.php @@ -62,24 +62,35 @@ public function actionInstall($id) try { - $plugin->runInstall(); - $plugin->status=!$plugin->canDisable() - ?SBPlugin::STATUS_ENABLED - :SBPlugin::STATUS_INSTALLED; - $plugin->save(); - SourceBans::log('Plugin installed', 'Plugin "' . $plugin->name . '" was installed'); + if($plugin->runInstall()!==false) + { + $result=true; + $plugin->status=!$plugin->canDisable() + ?SBPlugin::STATUS_ENABLED + :SBPlugin::STATUS_INSTALLED; + $plugin->save(); + SourceBans::log('Plugin installed', 'Plugin "' . $plugin->name . '" was installed'); + } + else + { + $result=array( + 'error' => array( + 'message' => Yii::t('sourcebans', 'Installation failed'), + ), + ); + } } catch(Exception $e) { - Yii::app()->end(CJSON::encode(array( + $result=array( 'error' => array( 'code' => $e->getCode(), 'message' => $e->getMessage(), ), - ))); + ); } - Yii::app()->end(CJSON::encode(true)); + Yii::app()->end(CJSON::encode($result)); } public function actionSettings($id) @@ -110,22 +121,33 @@ public function actionUninstall($id) try { - $plugin->runUninstall(); - $plugin->status=0; - $plugin->save(); - SourceBans::log('Plugin uninstalled', 'Plugin "' . $plugin->name . '" was uninstalled', SBLog::WARNING_TYPE); + if($plugin->runUninstall()!==false) + { + $result=true; + $plugin->status=0; + $plugin->save(); + SourceBans::log('Plugin uninstalled', 'Plugin "' . $plugin->name . '" was uninstalled', SBLog::WARNING_TYPE); + } + else + { + $result=array( + 'error' => array( + 'message' => Yii::t('sourcebans', 'Uninstallation failed'), + ), + ); + } } catch(Exception $e) { - Yii::app()->end(CJSON::encode(array( + $result=array( 'error' => array( 'code' => $e->getCode(), 'message' => $e->getMessage(), ), - ))); + ); } - Yii::app()->end(CJSON::encode(true)); + Yii::app()->end(CJSON::encode($result)); } /** diff --git a/web/application/messages/cs/sourcebans.php b/web/application/messages/cs/sourcebans.php index 170b938..8d4377d 100644 --- a/web/application/messages/cs/sourcebans.php +++ b/web/application/messages/cs/sourcebans.php @@ -97,6 +97,7 @@ 'Imported successfully' => '', 'Information' => 'Informace', 'Install' => '', + 'Installation failed' => '', 'Invoked on' => 'Uděleno dne', 'Join game' => '', 'Kick player' => '', @@ -179,6 +180,7 @@ 'Unban reason' => '', 'Unbanned by' => '', 'Uninstall' => '', + 'Uninstallation failed' => '', 'Unknown' => 'Neznámý', 'Version' => 'Verze', 'View Steam Profile' => '', diff --git a/web/application/messages/de/sourcebans.php b/web/application/messages/de/sourcebans.php index a2726be..b90a8f7 100644 --- a/web/application/messages/de/sourcebans.php +++ b/web/application/messages/de/sourcebans.php @@ -97,6 +97,7 @@ 'Imported successfully' => '', 'Information' => 'Information', 'Install' => 'Installieren', + 'Installation failed' => '', 'Invoked on' => 'Ausgesprochen am', 'Join game' => 'Verbinden', 'Kick player' => 'Spieler kicken', @@ -179,6 +180,7 @@ 'Unban reason' => 'Entbanngrund', 'Unbanned by' => '@@Entbannt von@@', 'Uninstall' => 'Deinstallieren', + 'Uninstallation failed' => '', 'Unknown' => 'Unbekannt', 'Version' => 'Version', 'View Steam Profile' => 'Steam-Profil anzeigen', diff --git a/web/application/messages/en/sourcebans.php b/web/application/messages/en/sourcebans.php index 5e5d5e2..9cf88d9 100644 --- a/web/application/messages/en/sourcebans.php +++ b/web/application/messages/en/sourcebans.php @@ -97,6 +97,7 @@ 'Imported successfully' => '', 'Information' => 'Information', 'Install' => 'Install', + 'Installation failed' => 'Installation failed', 'Invoked on' => 'Invoked on', 'Join game' => 'Join game', 'Kick player' => 'Kick player', @@ -179,6 +180,7 @@ 'Unban reason' => 'Unban reason', 'Unbanned by' => '@@Unbanned by@@', 'Uninstall' => 'Uninstall', + 'Uninstallation failed' => 'Uninstallation failed', 'Unknown' => 'Unknown', 'Version' => 'Version', 'View Steam Profile' => 'View Steam Profile', diff --git a/web/application/messages/nl/sourcebans.php b/web/application/messages/nl/sourcebans.php index 39877bd..502a3d5 100644 --- a/web/application/messages/nl/sourcebans.php +++ b/web/application/messages/nl/sourcebans.php @@ -97,6 +97,7 @@ 'Imported successfully' => 'Succesvol geïmporteerd', 'Information' => 'Informatie', 'Install' => 'Installeren', + 'Installation failed' => '', 'Invoked on' => 'Ingeroepen op', 'Join game' => 'Meespelen', 'Kick player' => 'Kick speler', @@ -179,6 +180,7 @@ 'Unban reason' => 'Unban reden', 'Unbanned by' => '@@Unbanned by@@', 'Uninstall' => 'Deïnstalleren', + 'Uninstallation failed' => '', 'Unknown' => 'Onbekend', 'Version' => 'Versie', 'View Steam Profile' => 'Steam-profiel weergeven', diff --git a/web/application/messages/ru/sourcebans.php b/web/application/messages/ru/sourcebans.php index 1a1f9e2..0ba9dd2 100644 --- a/web/application/messages/ru/sourcebans.php +++ b/web/application/messages/ru/sourcebans.php @@ -97,6 +97,7 @@ 'Imported successfully' => '', 'Information' => 'Информация', 'Install' => 'Установка', + 'Installation failed' => 'Не удалось установить', 'Invoked on' => 'Выдано', 'Join game' => 'Присоединиться', 'Kick player' => 'Отключить игрока', @@ -179,6 +180,7 @@ 'Unban reason' => 'Причина разбана', 'Unbanned by' => '@@Разбанил(а)@@', 'Uninstall' => 'Удалить', + 'Uninstallation failed' => 'Не удалось удалить', 'Unknown' => 'Неизвестно', 'Version' => 'Версия', 'View Steam Profile' => 'Посмотреть профиль Steam',