doublesecretagency / craft-googlemaps

Google Maps plugin for Craft CMS - Maps in minutes. Powered by the Google Maps API.
https://plugins.doublesecretagency.com/google-maps/
Other
10 stars 8 forks source link

Install issue (Craft v3.9.10) #103

Closed cole007 closed 5 months ago

cole007 commented 5 months ago

I'm trying to install Google Maps and replace Smart Maps in advance of a Craft 4 upgrade for a client site (Craft v3.9.10, Google Maps v4.0.8.1 and Smart Map v3.3.6).

However, on attempting to install via CP or console I get the following error:

Exception: No plugin exists with the handle "google-maps". (/var/www/html/deploy/vendor/craftcms/cms/src/services/Plugins.php:386)
#0 /var/www/html/deploy/vendor/doublesecretagency/craft-googlemaps/src/migrations/FromSmartMap.php(81): craft\services\Plugins->enablePlugin('google-maps')
#1 /var/www/html/deploy/vendor/doublesecretagency/craft-googlemaps/src/migrations/FromSmartMap.php(35): doublesecretagency\googlemaps\migrations\FromSmartMap::_migratePluginSettings()

Seems to be in a bit of a Catch 22 as cannot install the plugin because the plugin is not installed … Any thoughts appreciated 🙏

lindseydiloreto commented 5 months ago

After chatting on DM, we got this sorted out. It sounds like something mysterious was disabling the Google Maps plugin while it was being installed. 👽

Anyway, glad it's working now!

cole007 commented 4 months ago

Just to say hit this issue again.

It basically looks like the attempts to update the plugin config as part of a migration/install on a site with the Smart Map plugin are failing due to the Google Map plugin not yet being enabled.

A simple fix would be to force the plugin to be enabled before updating the config in the _migratePluginSettings() method of /doublesecretagency/craft-googlemaps/src/migrations/FromSmartMap.php:

// If Smart Map is not installed, bail
if (!Craft::$app->getPlugins()->isPluginEnabled('smart-map')) {
    return;
}
// ensure plugin is enabled
if (!Craft::$app->getPlugins()->isPluginEnabled('google-map')) {
    Craft::$app->getPlugins()->enablePlugin('google-maps');
}

Trying that at this end fixed the problem.

lindseydiloreto commented 4 months ago

Hi @cole007, did you ever figure out what is disabling the Google Maps plugin?

That part seems abnormal, and might be specific to something in your configuration. I haven't heard any other reports about this issue.

Do you have some old trace of a google-maps plugin already in your database?