|
@@ -3,9 +3,11 @@ declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace SixShop\System;
|
|
namespace SixShop\System;
|
|
|
|
|
|
|
|
|
|
+use Composer\InstalledVersions;
|
|
|
use RuntimeException;
|
|
use RuntimeException;
|
|
|
use SixShop\Core\Contracts\ExtensionInterface;
|
|
use SixShop\Core\Contracts\ExtensionInterface;
|
|
|
use SixShop\Core\Helper;
|
|
use SixShop\Core\Helper;
|
|
|
|
|
+use SixShop\Core\Service\CoreService;
|
|
|
use SixShop\Payment\Contracts\PaymentExtensionInterface;
|
|
use SixShop\Payment\Contracts\PaymentExtensionInterface;
|
|
|
use SixShop\System\Config\ExtensionConfig;
|
|
use SixShop\System\Config\ExtensionConfig;
|
|
|
use SixShop\System\Enum\ExtensionStatusEnum;
|
|
use SixShop\System\Enum\ExtensionStatusEnum;
|
|
@@ -289,8 +291,18 @@ class ExtensionManager extends Service
|
|
|
return app(Migrate::class, [$this->app, $id])->getMigrationList();
|
|
return app(Migrate::class, [$this->app, $id])->getMigrationList();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function refresh(string $id)
|
|
|
|
|
|
|
+ public function refresh(string $id): void
|
|
|
{
|
|
{
|
|
|
- // 更新版本信息 todo
|
|
|
|
|
|
|
+ // 获取当前版本更新版本信息
|
|
|
|
|
+ $currentVersion = '0.0.0';
|
|
|
|
|
+ if (isset(CoreService::$extensionComposerMap[$id])) {
|
|
|
|
|
+ $packageName = CoreService::$extensionComposerMap[$id]['name'];
|
|
|
|
|
+ $currentVersion = InstalledVersions::getPrettyVersion($packageName);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ ExtensionModel::where([
|
|
|
|
|
+ ['id', '=', $id],
|
|
|
|
|
+ ['version','<>', $currentVersion],
|
|
|
|
|
+ ])->update(['version' => $currentVersion]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|