Auto Update

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Auto Update

Post by kettle_drum »

Hey all,

I have just finished developing a fairly large system that will be rolled out about 10-20 times a month to different clients and im already having trouble with updating the live code and am looking for any ideas/solutions that could be used to automatically update each site without manually uploading the new files.

The users are mainly not technical and so i dont really want the user to have to click a button within their admin area to activate the update but rather remotely update the code from an admin system on our end.

I of course have access to all the sites data via ftp/ssh so there is no trouble in uploading the new files etc so i could simply upload the files to all the sites and have done - but some updates may effect database structure and content so there will also need to be some kind of SQL file executed to provided these updates.

Any ideas on how to best do this? Or how have you done it on previous projects? Know of any open source systems that use a similar method to update the content?

I'd welcome any comments or ideas.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

could upload the SQL file to them as well, along with a script that can execute that file and return a success result to your server. You'd them probably delete the update SQL and script.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Re: Auto Update

Post by Roja »

kettle_drum wrote: Any ideas on how to best do this? Or how have you done it on previous projects? Know of any open source systems that use a similar method to update the content?
Using Adodb's xml schema, you can send xml files that contain both sql data *and* schema changes. Adodb handles the whole thing transparently for the most part, changing any tables that need to be changed based on the schema.

That way, using just xml and a simple "update" page, you can update anything db-related.

Beyond that, ie, updating program code, is a little harder. Because so many sites vary in the user and permissions of apache (some running cgi, some running suphp, some running module) you either set the permissions to allow the webserver to overwrite the files (dangerous/bad), or make a directory that can accept drop in replacements (somewhat tricky).
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Although i can't provide good examples anymore, but i believe ADOdb XML functionality was a major PITA..

Although i'm not very familiar with it, and i think it will take a week or 2 before it's released, you might want to have a look at the new PEAR (1.4) installer and use that for distribution of your files, think remote install..)
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

timvw wrote:Although i can't provide good examples anymore, but i believe ADOdb XML functionality was a major PITA..
I've used it for about a year, and I can say that there is *one* place that I've found that to be 100% true: Cross-DB support.

Oddly, while adodb itself is built explicitly for cross-db support, I've run into dozens of problems with xml-schema's behavior on postgres. It was developed by different authors, and its not really being maintained, so unfortunately, that portion truly causes me serious pain.

With that said, on pure mysql, its *fanstastic*, and I honestly can't imagine an easier way to do sql-as-xml, from data to schema, all in under 50 lines (for the implementation, not the library itself) generally.

Its been bliss!
Post Reply