diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2020-09-02 05:59:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-02 05:59:34 +0300 |
commit | 67d3486533579cb57c30e38074611c3ae80e9161 (patch) | |
tree | 729aa5daddd4c81f8b6b9fb6110e93e7d74b2429 | |
parent | 77930f3d6bfc0c710024d1a2838460ffa7061070 (diff) |
Create plugin.json files if needed for plugins moved from core to marketplace (#16323)
* Create plugin files on demand if needed
* Update 4.0.0-b1.php
* Update Updater.php
* Update Controller.php
-rw-r--r-- | core/Updates/4.0.0-b1.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/core/Updates/4.0.0-b1.php b/core/Updates/4.0.0-b1.php index be1bc7bcfb..127517f411 100644 --- a/core/Updates/4.0.0-b1.php +++ b/core/Updates/4.0.0-b1.php @@ -210,6 +210,50 @@ class Updates_4_0_0_b1 extends PiwikUpdates // switch to default provider if GeoIp Legacy was still in use LocationProvider::setCurrentProvider(LocationProvider\DefaultProvider::ID); } + + // eg the case when not updating from most recent Matomo 3.X and when not using the UI updater + // afterwards the should receive a notification that the plugins are outdated + self::ensureCorePluginsThatWereMovedToMarketplaceCanBeUpdated(); + } + + public static function ensureCorePluginsThatWereMovedToMarketplaceCanBeUpdated() + { + $plugins = ['Provider', 'CustomVariables']; + $pluginManager = Manager::getInstance(); + foreach ($plugins as $plugin) { + if ($pluginManager->isPluginThirdPartyAndBogus($plugin)) { + $pluginDir = Manager::getPluginDirectory($plugin); + + if (is_dir($pluginDir) && + file_exists($pluginDir . '/' . $plugin . '.php') + && !file_exists($pluginDir . '/plugin.json') + && is_writable($pluginDir)) { + file_put_contents($pluginDir . '/plugin.json', '{ + "name": "'.$plugin.'", + "description": "'.$plugin.'", + "version": "3.14.1", + "theme": false, + "require": { + "piwik": ">=3.0.0,<4.0.0-b1" + }, + "authors": [ + { + "name": "Matomo", + "email": "hello@matomo.org", + "homepage": "https:\/\/matomo.org" + } + ], + "homepage": "https:\/\/matomo.org", + "license": "GPL v3+", + "keywords": ["'.$plugin.'"] +}'); + // otherwise cached information might be used and it won't be loaded otherwise within same request + $pluginObj = $pluginManager->loadPlugin($plugin); + $pluginObj->reloadPluginInformation(); + $pluginManager->unloadPlugin($pluginObj); // prevent any events being posted to it somehow + } + } + } } protected function usesGeoIpLegacyLocationProvider() |