Jump to content

Module: ProcessWire Core Upgrade


ryan

Recommended Posts

I've been working on a module to make it really simple to upgrade ProcessWire from one version to another. Especially as a way to make it easy to upgrade from PW 2.4 to 2.5, or to upgrade from one dev version to another. This tool supports upgrading between any branches of ProcessWire (currently we only have master and dev on GitHub). It will also let you downgrade your ProcessWire version, though no reason to do that.

The module keeps up-to-date directly with GitHub, so it works as a long-term tool for every upgrade if you want it to. It works best if your file system is writable. However, if it isn't, the tool can still be used. It will still download the upgrade files to the server and then tell you where to move them. I should also mention that this module is somewhat inspired by a similar module Nico built awhile back called AutoUpgrade.

So far I've used this tool to upgrade this site (processwire.com), the skyscrapers site, and the modules site (modules.processwire.com). Before releasing this officially in the modules directory, or suggesting it for production use, I'd like to get some help testing. If anyone has availability to help test this on non-production sites, your help is appreciated. It can be downloaded from GitHub here. As a bonus, it will also be a good opportunity to help test PW 2.5! :) Thanks in advance.

What I'd really like to do as the next step with this is make it support upgrade by FTP. That would provide a nicer and safer solution for those that don't have writable file systems on their servers. 

This tool should be compatible with ProcessWire versions as far back as 2.3.4. I will also update it to support older versions than that if there's demand for it. 

post-2-0-15553500-1410207449_thumb.png

post-2-0-54532600-1410207477_thumb.png

post-2-0-26501000-1410207495_thumb.png

post-2-0-29143600-1410207509_thumb.png

post-2-0-39841700-1410207525_thumb.png

  • Like 37
Link to comment
Share on other sites

Hey Ryan - looks great.

A couple of comments so far - I think there really needs to be some kind of progress indicator (real or fake) because that download takes quite a while on slow connections - I was on a work VPN when I tested and it was several minutes.

Also when I when to install (http://pwtest.dev/admin/setup/core-upgrade/prepare), I got a: Unable to open ZIP file, error code: 19

The dev.zip (15.4MB) exists in ProcessWireUpgrade, but it is corrupt. I feel like I have had this issue with something else PW recently too - can't remember what the issue is off the top of my head though.

Link to comment
Share on other sites

Couple of bits of wording jump to mind.

Perhaps:

Instead of "the found version....."

have: "The available version is the same as your current installation"

Instead of "we recommend you make another backup on your own too...."

Have: "For additional safety, we recommend creating an independant database backup, for instance with PhpMyAdmin"

Good tool though! :)

  • Like 6
Link to comment
Share on other sites

Thanks for testing it out Joss and Adrian. 

I've updated the phrases with your language Joss.

Adrian, I'm guessing your PHP timed out. I meant to have a set_time_limit in there to prevent that, but didn't have it there yet. It's now there. As for download time, it's taking between 2-3 seconds here, server-to-server, and I'm thinking that's likely typical for web servers which is more the intended environment for this tool. But if more people are finding the download slow, we can definitely look further at things like progress bars or some kind of dancing icons or something  >:D:-*

Link to comment
Share on other sites

Adrian, I'm guessing your PHP timed out. I meant to have a set_time_limit in there to prevent that, but didn't have it there yet.

Just tried again without VPN and it downloaded in 12 seconds and no problem unzipping this time!

  • Like 1
Link to comment
Share on other sites

Worked beautifully for me. Just tried it on my new ProcessWire blog and updated it from 2.4.12 to 2.4.18.

Took approx 20 seconds from download of Zip to install and upgrade. No errors. Admin and site working great.

My first blog post after upgrading was about the new upgrade Module. Now, that's circular :)

  • Like 5
Link to comment
Share on other sites

Just upgraded a 2.3.5 installation locally, with apparently complete success.

Just a couple of very, very minor observations -

  1. I only noticed it after I had clicked the button to continue, but there was (I think) a somewhat unstyled 'Abort' (or whatever - it was grey in my admin theme) button at top left when confirming the choice of branch to install.
  2. I was initially slightly surprised that I was logged out without noticing a warning, although completely understandably. Just thought that this might worry less experienced users (or I missed the warning).
Link to comment
Share on other sites

Would love to have an indication within the admin that there was an update available.

A simple icon in the footer could suffice. See the pink circle in footer of attached mockup

Suggest it's only visible to users with correct permissions and reflects status of stable branch.

post-1166-0-80267200-1410264613_thumb.pn

  • Like 5
Link to comment
Share on other sites

Ryan: this looks really cool. Haven't tried it out yet, but it should be useful, especially for my own projects :)

I was wondering is if you'd consider adding a check for potential issues with 3rd party modules, i.e. if there's a module that hasn't been marked as compatible with the new version? As far as I know, this info isn't cached locally (at least at the moment), and not all 3rd party modules are in the modules directory, so it might get complicated, but it'd be nice to see a list of modules that could potentially cause trouble before updating.

Another thing I was wondering was whether it'd be possible to somehow handle intended additions to files such as .htaccess. If one has added own caching rules or something like that, it'd be cool if the upgrade process could keep those intact. This might require a pre-defined way (or place) for specifying such things, though, so perhaps it's not feasible..

  • Like 2
Link to comment
Share on other sites

@teppo second thing

If you check the 4th screenshot in Ryan's first post there are already some checks and options regarding for example .htaccess and index.php

Anything inside the wire dir you are not supposed to be changing anyway, so no issues there.

(i haven't tested it myself, and maybe this is not what you mean but thought i'd mention)

Link to comment
Share on other sites

@SiNNuT: I can see the option to leave .htaccess untouched, if thats what you're referring to. Not exactly the same thing, though -- more like diff/merge, perhaps?

This is a file that's intended and/or sometimes needed to be customised per site, so this would, in my opinion, make sense  :)

Link to comment
Share on other sites

Ah, i see. Just glancing over the code, the module does seem to compare based on a md5 hash and will tell you if there is a diff in .htacces and, if so, it will tell you:

"Since the <u>.htaccess</u> file may have site-specific customizations, you may " .
"consider handling that one manually, unless you know it hasn't been modified.";

But what you have in mind (diff/merge) is slightly more advanced :) If there are foolproof ways to handle this maybe would be great, but on the other hand handling such an important file as an .htaccess manually doesn't sound that bad either.

  • Like 1
Link to comment
Share on other sites

Ryan this is a great convenience! It worked well for me today (from 2.4.0).

The only thing I would suggest is merely a cosmetic thing. The page of output it generates while doing the update is a little mysterious until you scroll down. When I first looked at it I thought something might be broken. It doesn't look like the admin pages which is fine but maybe it should spit out a heading first that says "Processing upgrade:"

  • Like 2
Link to comment
Share on other sites

Some upgrades to the upgrade module. It now scans for module upgrades too, and provides notifications of upgrades that show up when superuser logs in:

Main screen: 

post-2-0-67567300-1410530449_thumb.png

Login notifications:

post-2-0-26179900-1410530435_thumb.png


Note that you have to have the latest PW (2.4.19 or hopefully 2.5 later today) in order to use the modules upgrades or login notifications. The core upgrades portion will work with old PW versions. Also the screenshot says it's called "Core Upgrade", but that's because I already had it installed. If you install it anew now, it's simply called "Upgrades". 

  • Like 10
Link to comment
Share on other sites

Works great!

Only one thing - I am worried that someone running dev will see the "Older than current" on the PW Stable row - click to /setup/upgrades/check?branch=master and run the Download Now "upgrade".

Maybe this is fine and should just be a case of reading things properly, but just thought perhaps there could be a warning about it being a downgrade?

Link to comment
Share on other sites

Sorry - more things:

  1. The entry in the modules directory goes to this broken link: http://modules.processwire.com/modules/-process-wire-upgrade/
  2. The upgrade notification on login is awesome, but being in green I don't think anyone will notice them.
  3. If someone is regularly accessing their site, they might never (or at least rarely) have to login. Especially if they are using Persistent Login module. Any chance of running the checks in the background at some interval?
Link to comment
Share on other sites

Great to have module upgrade notifications in the core - thank you!

This module may get put into the core. Not sure yet. But it does seem like something that may be useful to most PW installs, so seriously considering it once it's fully refined and has a few miles on it, etc.

Only one thing - I am worried that someone running dev will see the "Older than current" on the PW Stable row - click to /setup/upgrades/check?branch=master and run the Download Now "upgrade".

No need to worry – if you click it, the next screen tells you that it is a downgrade. Though it's perfectly fine to downgrade or upgrade between master and dev, unless using something that's only in dev. I've been doing it all week.

The upgrade notification on login is awesome, but being in green I don't think anyone will notice them. If someone is regularly accessing their site, they might never (or at least rarely) have to login. Especially if they are using Persistent Login module. Any chance of running the checks in the background at some interval?

This is consistent with how PW currently renders all system notices: at superuser login. If it's an error, it shows up red. Otherwise it shows up green. Upgrades to core or modules in PW aren't particularly important most of the time (since it isn't WordPress). It's more just an "FYI", "if you are looking for it" kind of thing. The info is always available in Setup > Upgrades. 

But I hear what you are saying and you aren't the first to say they tune out PW's green messages. Antti and I are working on a new notifications system and I expect we're going to do some great things there. This module will be one of a few we use to test the new notifications system. But until then I thought it best to keep consistent with the way PW currently does things with regard to system notices. So just wanted to mention there are some nice new things coming here, but for the overall system rather than just 1 module. 

  • Like 11
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...