<?php
 
/**
 
 * An example script that try to update 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';
 
 
 
define('PEAR_PACKAGEUPDATE_DATA_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR );
 
 
 
// Create a Web package updater for the XML_RPC package on an unkown channel.
 
$ppu = PEAR_PackageUpdate::factory('Web', 'XML_RPC', '');
 
 
 
// 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(true); // with context details
 
#    $ppu->errorDialog(false); // without context
 
}
 
 
 
print 'still alive';
 
?>