Re: Reload/restart php-gtk program

From: Date: Wed, 08 Aug 2007 09:58:02 +0000
Subject: Re: Reload/restart php-gtk program
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-8031@lists.php.net to get a copy of this message
On 8/7/07, Peter Smith <smithpdo@gmail.com> wrote: > > I would like to reload and restart a php-gtk program after the program has > downloaded an updated version of itself. I visualise a dialog informing the > user that an updated version has been installed and inviting him to click on > a button to restart with the updated version of the program. > How would you do this? I have a feeling the answer is painfully obvious but > I can't see it. > Peter. I have a fully functionnal php-gtk application doing that task : - check for updates in background, - if update is available, notify user with a message in statusbar, - then user only has to click Update button. - this software is locate here : http://php.classes.free.fr/php/gtk/EasyTunes/ - there is a screenshot but not some showing updates. the interesting part is method lib/FreeTunesGui.php # just after update, reload a new process (just like shell exec) ; current process give up, a new one is created protected function reload(){ $this->main_quit(); $cmd = DIR . '/easy-tunes'; $args = array(); pcntl_exec($cmd ,$args, $_ENV); } here, we restart a new process (with GUI) ; this is the shell equivalent of : exec $cmd for your information, update checking is done with lib/Update.php class. We just need to compare a file containing local version against latest version available on remote site. Software version is handled in a pure text file.

« previous php.gtk.general (#8031) next »