cvs: pear /PEAR_PackageUpdate/examples withoutFrontend.php

From: Date: Tue, 13 Feb 2007 10:22:53 +0000
Subject: cvs: pear /PEAR_PackageUpdate/examples withoutFrontend.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-44654@lists.php.net to get a copy of this message
farell Tue Feb 13 10:22:53 2007 UTC Modified files: /pear/PEAR_PackageUpdate/examples withoutFrontend.php Log: clarify error-handling by an example (related to bug #10079) http://cvs.php.net/viewvc.cgi/pear/PEAR_PackageUpdate/examples/withoutFrontend.php?r1=1.3&r2=1.4&diff_format=u Index: pear/PEAR_PackageUpdate/examples/withoutFrontend.php diff -u pear/PEAR_PackageUpdate/examples/withoutFrontend.php:1.3 pear/PEAR_PackageUpdate/examples/withoutFrontend.php:1.4 --- pear/PEAR_PackageUpdate/examples/withoutFrontend.php:1.3 Thu Jan 11 09:55:37 2007 +++ pear/PEAR_PackageUpdate/examples/withoutFrontend.php Tue Feb 13 10:22:53 2007 @@ -3,7 +3,7 @@ * Always keep your application up-to-date with the most recent and stable version * of PEAR::Log package. * - * @version $Id: withoutFrontend.php,v 1.3 2007/01/11 09:55:37 farell Exp $ + * @version $Id: withoutFrontend.php,v 1.4 2007/02/13 10:22:53 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package PEAR_PackageUpdate * @access public @@ -36,7 +36,7 @@ } // Check for updates of PEAR::Log package though pear.php.net channel -$ppu =& PEAR_PackageUpdate::factory('Null', 'Log', 'pear'); +$ppu =& PEAR_PackageUpdate::factory('Null', 'Log', 'peer'); if ($ppu !== false) { // Check for new stable version $ppu->setMinimumState(PEAR_PACKAGEUPDATE_STATE_STABLE); @@ -52,6 +52,19 @@ } } +// Check for errors. +if ($ppu->hasErrors()) { + $error = $ppu->popError(); + echo "<b>Error occured when trying to update: PEAR::Log package</b> <br />\n"; + echo "<b>Message:</b> " . $error['message'] ."<br />\n"; + echo "<hr /><i>Context:</i><br />\n"; + echo "<b>File:</b> " . $error['context']['file'] ."<br />\n"; + echo "<b>Line:</b> " . $error['context']['line'] ."<br />\n"; + echo "<b>Function:</b> " . $error['context']['function'] ."<br />\n"; + echo "<b>Class:</b> " . $error['context']['class'] ."<br />\n"; + exit(); +} + // your application code goes here ... print 'Hello World'; ?> \ No newline at end of file

« previous php.pear.cvs (#44654) next »