<?php
/**
* An example script that updates PEAR::XML_RPC using PEAR_PackageUpdate
* with a Web front end.
*
* @author Laurent Laville
* @package PEAR_PackageUpdate_Web
* @version $Id:$
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @copyright 2006 Laurent Laville
*/
require_once 'PEAR/PackageUpdate.php';
// Create a Web package updater for the XML_RPC package on the pear channel.
$ppu = PEAR_PackageUpdate::factory('Web', 'XML_RPC', 'pear');
// Make sure the updater was created properly.
if ($ppu === false) {
echo "Could not create updater.\n";
echo "You might want to check for and install updates manually.\n";
die();
}
// Check to see if any updates are availble.
if ($ppu->checkUpdate()) {
// If updates are available, present the user with the option to update.
if ($ppu->presentUpdate()) {
// Update the package.
$ppu->update();
$ppu->forceRestart();
}
}
// Check for errors.
if ($ppu->hasErrors()) {
$ppu->errorDialog();
}
print 'still alive';
?>