Opened 2 years ago

Closed 23 months ago

#3021 closed Bug (fixed)

Refactor Upgrader to ensure the new code is reloaded after overwriting old files

Reported by: vipsoft Owned by: vipsoft
Priority: major Milestone: Piwik 1.8
Component: Core Keywords:
Cc: Sensitive: no

Description (last modified by vipsoft)

I hate #1331 workarounds. It's uglifying the #1713 improvements.

We need to make a cleaner break. We need to force a new browser request so that we aren't loading new classes while instances of old classes are in memory.

Change History (17)

comment:1 Changed 2 years ago by vipsoft (robocoder)

(In [5988]) refs #1331, refs #3021 - remove #1331 hacks

comment:2 Changed 2 years ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from new to closed

(In [5991]) fixes #3021, refs #1331 - adds Piwik_View_OneClickDone

During a Piwik software update, there will be instances of old classes
loaded in memory. This is problematic as we will start to instantiate
new classes which may not be backward compatible. This class provides
a clean bridge/transition by forcing a new request.

This class needs to be self-contained, with no external dependencies.

comment:3 Changed 2 years ago by matt (mattab)

Every time I updated wordpress I noticed they were doing this and thought "we should do it too" :)

Great idea, well done!! This will save a lot of pain in the future.

comment:4 Changed 2 years ago by matt (mattab)

(in the right ticket this time)
Review/questions:

  • Did you test auto-updating from 1.7.1 to trunk?
  • Did you test auto-updating from trunk to an imaginative next release?
  • Did you check that errors/warning are reported when there are some?

Thanks!

comment:5 Changed 2 years ago by vipsoft (robocoder)

I tested 1.0 to trunk.

I instrumented the errors for testing. (Limited time)

We'll be able to test the other scenarios when I get Selenium running on dev6. (I have it working locally.) I've also done some work with Behat/Mink but will defer that until the switch to phpunit.

comment:6 Changed 2 years ago by matt (mattab)

Selenium running on dev6. (I have it working locally.)

Excellent news!!

I've also done some work with Behat/Mink but will defer that until the switch to phpunit.

Sounds fun too!

I have looked quickly and it looks interesting. Do you plan to integrate this to improve our current test coverage, or at first to update existing webtests and make it easier to write new web tests?

Tests

Testing the case "Update from trunk to fake next release" is important too (as I assume it triggers different code path)

comment:7 Changed 2 years ago by matt (mattab)

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening until confirmation that trunk -> fake 1.8 update works

comment:8 Changed 2 years ago by vipsoft (robocoder)

(In [6008]) refs #3021 - form tweaks

comment:9 Changed 2 years ago by vipsoft (robocoder)

(In [6009]) refs #3021 - fix button

comment:10 Changed 2 years ago by vipsoft (robocoder)

  • Description modified (diff)

Behat/Mink testing won't improve test coverage. Its main benefit is enabling a more natural language for writing acceptance tests.

We've unfortunately lost a lot of web test coverage due to WebTest + jQuery/jQuery-UI incompatibilities. Replacing WebTest with Selenium will be my priority after #3030.

comment:11 Changed 2 years ago by matt (mattab)

Todo before closing this ticket:

  • test "Update from trunk to fake next release" is important too (as I assume it triggers different code path)

@vipsoft Is there any other pending task? thx

comment:12 Changed 2 years ago by matt (mattab)

For testing auto update easily, see #3071

comment:13 Changed 2 years ago by matt (mattab)

  • Milestone changed from 1.7.x - Piwik 1.7.x to 1.7.2 - Piwik 1.7.2

comment:14 Changed 2 years ago by matt (mattab)

I tested an automatic upgrade from 1.7.1 to 1.8-rc2 but after 1min20, after it unpacked, etc. it redirected to login screen with errors "Login / password not provided"... there was no summary of the auto update. Maybe auto upgrade is partially broken (the UI feedback part) but files seemt o have downloaded and overwrite OK.

comment:15 Changed 2 years ago by matt (mattab)

(In [6404]) Fixes #3071 New config setting to Allow automatic upgrades to Beta or RC releases
[Debug]
allow_upgrades_to_beta = 0

practical to test for Auto upgrades or for users & devs Refs #3021

comment:16 Changed 23 months ago by matt (mattab)

  • Priority changed from normal to major
  • Summary changed from CoreUpdater: instances of old classes loaded while loading new classes to Refactor Upgrader to ensure the new code is reloaded after overwriting old files

Great work on this one Anthon, clean & few code for an elegant solution to a recurrent issue. Now we don't need the ugly is_class() calls? :)

comment:17 Changed 23 months ago by matt (mattab)

  • Resolution set to fixed
  • Status changed from reopened to closed

I did a test upgrading from rc4 to rc5 and it worked fine. not sure what hapened in my test before.

It will feel safer with the webtest from 1.0 upgrade ;)

Note: See TracTickets for help on using tickets.