Nao

  • Dadman with a boy
  • Posts: 16,079
On the desirability of automatic updates..?
« on January 31st, 2014, 10:12 PM »
In reply to:
http://wedge.org/pub/bugs/8393/errors-when-checking-detailed-version-info/msg293427/#msg293427

Believe it or not, it's actually in my plans... :P

However, it might require some time.
Remember when Aeva used to update its sitelist by itself every day..? Well, for a long time I've had the same idea in mind for Wedge, but with technical difficulties (notably the amount of bandwidth needed to account for version checks.)
When I heard of Github Releases, I figured, is it possible to get a URL to these files, directly..? And yes, it is. By using their well-documented API, one can do up to 60 requests per hour (or 5000 if you provide an ID token) from a certain IP, so it's a piece of cake for Github to 'accept' a daily request from even thousands of different servers, checking whether a new release was posted.
If a release is available, I can then get the URL to the zip or tarball, and then proceed to warn the user about it. Should they choose not to ignore the update, they could press a button to automatically download it to the server, and optionally (if supported), unzip it somewhere. Then, if that works, either apply the files automatically (move from tmp folder to core, assets, etc.), or offer the user to log into their site by FTP, and move the files they want to move.

Technical problems:
- This doesn't account for deleted files... But the automatic upgrade script could account for these, though, and make sure to try and delete them, if they can be harmful to Wedge.
- I don't know much about unzipping tarballs. I think there are plenty of functions for that kind of action available in Wedge, though...
- What if the automatic update process fails? Will it break a forum..?
- What if users don't have correct PHP file permissions for unzipping, etc..?

MultiformeIngegno

  • Posts: 1,337

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: On the desirability of automatic updates..?
« Reply #2, on February 1st, 2014, 12:06 AM »
I'll like your other post, not this one, because it's a GPL codebase and I can't even have a glance at it without being accused of license breach... :lol:

MultiformeIngegno

  • Posts: 1,337

Nao

  • Dadman with a boy
  • Posts: 16,079
Re: On the desirability of automatic updates..?
« Reply #4, on February 1st, 2014, 12:43 AM »
I know how to use the GitHub API... This is how commits get posted here automatically. The only reason I'd look into someone else's code is if I can't find time to write stuff myself. Otherwise, I usually find that writing the base code is usually the most enjoyable part... ;)

MultiformeIngegno

  • Posts: 1,337
Re: On the desirability of automatic updates..?
« Reply #6, on February 3rd, 2014, 07:28 PM »
Sorry if I say stupid things, I try :P
For the deleted files can't you just use the diff (I assume it's available in GitHub API) and if there are deleted files tell php to remove them. Then download the zip file from github, extract it (I think there shouldn't be any problem doing it with php..?) and replace old files (all the folder or just the ones modified, if diff file is available thought APIs). For permissions you can add a check. You first download the zip (if you don't have permissions simply it's not downloaded). Then you try to create a dummy empty file in the folder of the files the installer should replace. If it works you can proceed either removing all old files and putting new ones or just delete the ones that have been updated (from diff)..

Nao

  • Dadman with a boy
  • Posts: 16,079