File: PackageUpdate.php
Source Location: /PEAR_PackageUpdate-0.4.2/PackageUpdate.php
Page Details:
A package to make adding self updating functionality to other packages easy.
The package allows a developer to add a few lines of code to their existing packages and have the ability to update their package automatically. This auto-update ability allows users to stay up to date much more easily than requiring them to update manually. This package keeps track of user preferences such as "don't remind me again". This package is designed to be a backend to different front ends written for this package. For example, this package can be used to drive a PHP-GTK 2, CLI or web front end. The API for this package should be flexible enough to allow any type of front end to be used and also to allow the package to be used directly in another package without a front end driver. The interface for this package must allow for the following functionality: - allow user to confirm or cancel upgrade
- download and install the package
- don't ask again
- don't ask until next release
- only ask for state XXXX or higher
- update channel automatically
- PHP-GTK/CLI apps must exit to allow classes to reload
- web front end could send headers to reload certain page
This class is simply a wrapper for PEAR classes that actually do the work.EXAMPLE: <?php
class Goo {
function __construct()
{
// Check for updates...
require_once 'PEAR/PackageUpdate.php';
$ppu =& PEAR_PackageUpdate::factory('Gtk2', 'Goo', 'pear');
if ($ppu !== false) {
if ($ppu->checkUpdate()) {
// Use a dialog window to ask permission to update.
if ($ppu->presentUpdate()) {
if ($ppu->update()) {
// If the update succeeded, the application should
// be restarted.
$ppu->forceRestart();
}
}
}
}
// ...
}
// ...
}
?>
PEAR_PACKAGEUPDATE_ERROR_INVALIDPREF [line 106]
PEAR_PACKAGEUPDATE_ERROR_INVALIDSTATE [line 105]
PEAR_PACKAGEUPDATE_ERROR_INVALIDTYPE [line 104]
PEAR_PACKAGEUPDATE_ERROR_NOCHANNEL [line 97]
PEAR_PACKAGEUPDATE_ERROR_NOINFO [line 98]
PEAR_PACKAGEUPDATE_ERROR_NONEXISTENTDRIVER [line 107]
PEAR_PACKAGEUPDATE_ERROR_NOPACKAGE [line 96]
PEAR_PACKAGEUPDATE_ERROR_NOTINSTALLED [line 99]
PEAR_PACKAGEUPDATE_ERROR_PREFFILE_CORRUPTED [line 103]
PEAR_PACKAGEUPDATE_ERROR_PREFFILE_READACCESS [line 100]
PEAR_PACKAGEUPDATE_ERROR_PREFFILE_WRITEACCESS [line 101]
PEAR_PACKAGEUPDATE_ERROR_PREFFILE_WRITEERROR [line 102]
PEAR_PACKAGEUPDATE_PREF_NEXTRELEASE [line 80]
PEAR_PACKAGEUPDATE_PREF_NOUPDATES [line 79]
PEAR_PACKAGEUPDATE_PREF_STATE [line 82]
PEAR_PACKAGEUPDATE_PREF_TYPE [line 81]
PEAR_PACKAGEUPDATE_STATE_ALPHA [line 86]
PEAR_PACKAGEUPDATE_STATE_BETA [line 87]
PEAR_PACKAGEUPDATE_STATE_DEVEL [line 85]
PEAR_PACKAGEUPDATE_STATE_STABLE [line 88]
PEAR_PACKAGEUPDATE_TYPE_BUG [line 91]
PEAR_PACKAGEUPDATE_TYPE_MAJOR [line 93]
PEAR_PACKAGEUPDATE_TYPE_MINOR [line 92]
Documentation generated on Mon, 11 Mar 2019 14:39:30 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|