-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically update all marketplace plugins when updating Piwik #10527
Conversation
@@ -123,9 +124,16 @@ public function searchForThemes($keywords, $query, $sort) | |||
return array(); | |||
} | |||
|
|||
public static function getPiwikVersion() | |||
{ | |||
return StaticContainer::get('marketplacePiwikVersion'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably not the best way to overwrite the piwik version immediately after the piwik files were updated but it will be only temporary there as we will refactor the marketplace in Piwik 3 or so
@@ -49,6 +50,11 @@ public function installOrUpdatePluginFromMarketplace() | |||
|
|||
Filesystem::deleteAllCacheOnUpdate($this->pluginName); | |||
|
|||
$plugin = PluginManager::getInstance()->getLoadedPlugin($this->pluginName); | |||
if (!empty($plugin)) { | |||
$plugin->reloadPluginInformation(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we need to make sure to reload the plugin json which contains the required piwik version etc. Otherwise plugin would be directly disabled after the update because it still holds the old update information
// we need to load the marketplace already here, otherwise it will use the new, updated file in Piwik 3 | ||
$marketplace = new MarketplaceApiClient(); | ||
require_once PIWIK_DOCUMENT_ROOT . '/plugins/CorePluginsAdmin/PluginInstaller.php'; | ||
require_once PIWIK_DOCUMENT_ROOT . '/plugins/CorePluginsAdmin/MarketplaceApiException.php'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because Piwik 3 does not include those files yet, or may not even have those files later, we need to embed the files before the new files are copied. After updating to Piwik 3 those files might otherwise not exist
@@ -23,7 +24,7 @@ | |||
"HelpMessageIntroductionWhenError": "The above is the core error message. It should help explain the cause, but if you require further help please:", | |||
"HelpMessageIntroductionWhenWarning": "The update completed successfuly, however there were issues during the process. Please read the above descriptions for details. For further help:", | |||
"HighTrafficPiwikServerEnableMaintenance": "If you manage a high traffic Piwik server, we recommend to %1$smomentarily disable visitor Tracking and put the Piwik User Interface in maintenance mode%2$s.", | |||
"IncompatbilePluginsWillBeDisabledInfo": "Note: some plugins are not compatible with Piwik %s. They will be disabled when you upgrade:", | |||
"IncompatbilePluginsWillBeDisabledInfo": "Note: some plugins are not compatible with Piwik %s. We will update them if there is an update on the Marketplace, otherwise we will be disable them when you upgrade:", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point we could check which plugins are available on the Marketplace and show a bit more customized message like which plugins we will update etc. For now I only updated the text
} | ||
|
||
try { | ||
$disabledPluginNames = $this->disableIncompatiblePlugins($newVersion); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If something goes wrong with the network when updating the plugin via the Marketplace above, we disable the plugin after all
@tsteur should this PR be against 2.x-dev? |
Yes, changed base |
* Fix depraction test: use assertDeprecatedMethodIsRemovedInPiwik3 * Fix Scheduled Reports sent one hour late in daylight saving timezones (#10443) * convert hour to send report to/from UTC, to ensure it isn't affected by daylight savings * adds update script to change existing scheduled reports to use utc time * code improvement * adds missing param * Added new event Archiving.makeNewArchiverObject to allow customising plugin archiving (#10366) * added hook to alllow plugin archiving prevention * cr code style notes * reworked PR to fit CR suggestions * added PHPDoc for hook * Event description more consistent * UI tests: minor changes * Comment out Visitor Log UI tests refs #10536 * Adds test checking if all screenshots are stored in lfs * removed screenshots not stored in lfs * readds screenshots to lfs * 2.16.3-b4 * Issue translation updates against 2.x-dev * language update * Fix bug in widget list remove where the JSON object becomes array * 2.16.3-rc1 * console command custom-piwik-js:update should work when directory is writable and file does not exist yet (#10576) * followup #10449 * Fix test (cherry picked from commit fac3d63) * Prevent chmod(): No such file or directory * Automatically update all marketplace plugins when updating Piwik (#10527) * update plugins and piwik at the same time * make sure plugins are updated with piwik * use only one try/catch * reload plugin information once it has been installed * make sure to clear caches after an update * fix ui tests * make sure to use correct php version without any extras * Additional informations passed in the hook "isExcludedVisit" (issue #10415) (#10564) * Additional informations passed in the hook "isExcludedVisit" (issue #10415) * Added better description to the new parameters * Update VisitExcluded.php * Remove two parameters not needed as better to use the Request object * Update VisitExcluded.php * remove extra two parameters in VisitExcluded constructor to prevent confusion (#10593) * Update our libs to latest #10526 * Update composer libraries to latest #10526 * Update log analytics to latest * When updating the config file failed (or when any other file is not writable...), the Updater (for core or plugins) will now automatically throw an error and cancel the update (#10423) * When updating the config file failed (or when any other file is not writable...), the Updater (for core or plugins) will now automatically throw an error and cancel the update * add integration test to check the correct exception is thrown when config not writabel * New integration test for updater * Make test better * When opening the visitor profile, do not apply the segment (#10533) * When opening the visitor profile, do not apply the segment * added ui test for profile but does work for me * next try to make ui test work * add expected screenshot * added missing doc
Needed for Piwik 3.
Otherwise user would update from Piwik 2 to Piwik 3, the plugins would not be compatible anymore and we would disable the plugins that are not compatible. Instead we update first Piwik, then update all the Marketplace plugins.
I have tested it (all day) and it worked for me.