Re: [PHP-GTK] Reload/restart php-gtk program
[email protected] ("Marc Quinton")
| Newsgroups | php.gtk.general |
|---|---|
| Message-ID | <[email protected]> |
On 8/7/07, Peter Smith <[email protected]> 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.