Re: svn: /pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/PackageFile/ Commands.php

From: Date: Sat, 26 Feb 2011 15:01:08 +0000
Subject: Re: svn: /pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/PackageFile/ Commands.php
References: 1  Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-9748@lists.php.net to get a copy of this message
Excellent, thank you! On Fri, Feb 25, 2011 at 10:34 PM, Daniel O'Connor <clockwerx@php.net> wrote: > clockwerx                                Sat, 26 Feb 2011 04:34:53 +0000 > > Revision: ?J, > ÒM9È@××Âf®b.http://svn.php.net/viewvc?view=revision&revision=308702 > > Log: > Prevent fatal errors when only a package2.xml is present, ala XML_RPC2 > > Changed paths: >    U   pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/PackageFile/Commands.php > > Modified: pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/PackageFile/Commands.php > =================================================================== > --- pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/PackageFile/Commands.php    2011-02-26 > 01:33:54 UTC (rev 308701) > +++ pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/PackageFile/Commands.php    2011-02-26 > 04:34:53 UTC (rev 308702) > @@ -151,31 +151,45 @@ >         echo "done\n"; >     } > > +    /** @todo Consider simply injecting the Package object as appropriate */ >     function package($frontend, $args, $options) >     { > -        $package = false; > -        if (!isset($args['packagexml'])) { > +        $path = getcwd() . DIRECTORY_SEPARATOR; > +        $package = new \PEAR2\Pyrus\Package(null); > + > + > +        if (!isset($args['packagexml']) && !file_exists($path . > 'package.xml') && !file_exists($path . 'package2.xml')) { > +            throw new \PEAR2\Pyrus\PackageFile\Exception("No package.xml or > package2.xml found in " . $path); > +        } > + > +        if (isset($args['packagexml'])) { > +            $package = new \PEAR2\Pyrus\Package($args['packagexml']); > +        } else { >             // first try ./package.xml > -            if (file_exists('package.xml')) { > +            if (file_exists($path . 'package.xml')) { >                 try { > -                    $package = new \PEAR2\Pyrus\Package(getcwd() . > DIRECTORY_SEPARATOR . 'package.xml'); > +                    $package = new \PEAR2\Pyrus\Package($path . > 'package.xml'); >                 } catch (\PEAR2\Pyrus\PackageFile\Exception $e) { >                     if ($e->getCode() != -3) { >                         throw $e; >                     } > > -                    if (!file_exists('package2.xml')) { > +                    if (!file_exists($path . 'package2.xml')) { >                         throw $e; >                     } > > -                    $package = new \PEAR2\Pyrus\Package(getcwd() . > DIRECTORY_SEPARATOR . 'package2.xml'); > +                    $package = new \PEAR2\Pyrus\Package($path . > 'package2.xml'); >                     // now the creator knows to do the magic of > package2.xml/package.xml >                     $package->thisIsOldAndCrustyCompatible(); >                 } >             } > -        } else { > -            $package = new \PEAR2\Pyrus\Package($args['packagexml']); > + > +            // Alternatively; there's only a package2.xml > +            if (file_exists($path . 'package2.xml') && > !file_exists($path . 'package.xml')) { > +                $package = new \PEAR2\Pyrus\Package($path . 'package2.xml'); > +            } >         } > + >         if ($package->isNewPackage()) { >             if (!$options['phar'] && !$options['zip'] > && !$options['tar'] && !$options['tgz']) { >                 // try tgz first > > > -- > PEAR Core List Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Brett Bieber University of Nebraska-Lincoln

« previous php.pear.core (#9748) next »