|
@@ -15,6 +15,7 @@ use SixShop\System\Model\ExtensionConfigModel;
|
|
|
use SixShop\System\Model\ExtensionModel;
|
|
use SixShop\System\Model\ExtensionModel;
|
|
|
use think\db\Query;
|
|
use think\db\Query;
|
|
|
use think\exception\ValidateException;
|
|
use think\exception\ValidateException;
|
|
|
|
|
+use think\facade\Cache;
|
|
|
use think\facade\Db;
|
|
use think\facade\Db;
|
|
|
use think\facade\Event;
|
|
use think\facade\Event;
|
|
|
use think\facade\Log;
|
|
use think\facade\Log;
|
|
@@ -180,7 +181,11 @@ class ExtensionManager extends Service
|
|
|
*/
|
|
*/
|
|
|
public function disable(string $extensionID): void
|
|
public function disable(string $extensionID): void
|
|
|
{
|
|
{
|
|
|
- $extensionModel = ExtensionModel::where(['id' => $extensionID])->findOrFail();
|
|
|
|
|
|
|
+ $extensionModel = ExtensionModel::where(['id' => $extensionID])->findOrEmpty();
|
|
|
|
|
+ if ($extensionModel->isEmpty()) {
|
|
|
|
|
+ Cache::delete(sprintf(ExtensionModel::EXTENSION_INFO_CACHE_KEY, $extensionID));
|
|
|
|
|
+ throw new RuntimeException("{$extensionID}扩展不存在");
|
|
|
|
|
+ }
|
|
|
if ($extensionModel->status != ExtensionStatusEnum::ENABLED) {
|
|
if ($extensionModel->status != ExtensionStatusEnum::ENABLED) {
|
|
|
throw new RuntimeException("{$extensionID}扩展未启用");
|
|
throw new RuntimeException("{$extensionID}扩展未启用");
|
|
|
}
|
|
}
|