Browse Source

Don't throw exception if update() returns 0

pull/13339/head
brandonkelly 2 years ago
parent
commit
06066e00eb
No known key found for this signature in database GPG Key ID: 5E86D0CED64C7093
  1. 4
      CHANGELOG.md
  2. 8
      src/services/Plugins.php

4
CHANGELOG.md

@ -1,5 +1,9 @@
# Release Notes for Craft CMS 3.x
## Unreleased
- Fixed an error that could occur when updating a plugin with the `craft update` command, if it provided a new migration but still had the same schema version.
## 3.8.13 - 2023-05-24
- Fixed a bug where asset sources weren‘t immediately showing a source path on a clear `localStorage` cache.

8
src/services/Plugins.php

@ -837,23 +837,17 @@ class Plugins extends Component
* Updates a plugin’s stored version & schema version to match what’s Composer-installed.
*
* @param PluginInterface $plugin
* @return void
* @throws InvalidPluginException if there’s no record of the plugin in the database
* @since 3.7.13
*/
public function updatePluginVersionInfo(PluginInterface $plugin): void
{
$success = (bool)Db::update(Table::PLUGINS, [
Db::update(Table::PLUGINS, [
'version' => $plugin->getVersion(),
'schemaVersion' => $plugin->schemaVersion,
], [
'handle' => $plugin->id,
]);
if (!$success) {
throw new InvalidPluginException($plugin->id);
}
// Update our cache of the versions
$this->loadPlugins();
if (isset($this->_storedPluginInfo[$plugin->id])) {

Loading…
Cancel
Save