Fix plugin update crashing after the rows are refreshed (#2598)
Co-authored-by: Lance Pioch <git@lance.sh>
This commit is contained in:
1 parent
f81f44a004
commit
8860a5c5e5
3 files changed
+64
-3
No files matched your search
@@ -122,7 +122,7 @@ class PluginController extends ApplicationApiController
|
||||
{
|
||||
throw_unless($plugin->isUpdateAvailable(), new PanelException("Plugin doesn't need updating"));
|
||||
|
||||
$this->pluginService->updatePlugin($plugin);
|
||||
$plugin = $this->pluginService->updatePlugin($plugin);
|
||||
|
||||
return $this->response->item($plugin)
|
||||
->transformWith(PluginData::class)
|
||||
|
||||
@@ -313,7 +313,7 @@ class PluginService
|
||||
}
|
||||
|
||||
/** @throws Exception */
|
||||
public function updatePlugin(Plugin $plugin): void
|
||||
public function updatePlugin(Plugin $plugin): Plugin
|
||||
{
|
||||
$downloadUrl = $plugin->getDownloadUrlForUpdate();
|
||||
throw_unless($downloadUrl, new Exception('No download url found.'));
|
||||
@@ -321,11 +321,13 @@ class PluginService
|
||||
$this->downloadPluginFromUrl($downloadUrl, $plugin->id);
|
||||
|
||||
Plugin::refreshRows();
|
||||
$plugin = $plugin->refresh();
|
||||
$plugin = Plugin::findOrFail($plugin->id);
|
||||
|
||||
$this->installPlugin($plugin, false);
|
||||
|
||||
cache()->forget("plugins.$plugin->id.update");
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
|
||||
/** @throws Exception */
|
||||
|
||||
Reference in new issue
Block a user