cvs: pear-core /PEAR/Command Config.php

From: Date: Fri, 26 Nov 2004 22:08:57 +0000
Subject: cvs: pear-core /PEAR/Command Config.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-cvs+get-26558@lists.php.net to get a copy of this message
cellog Fri Nov 26 17:08:57 2004 EDT Modified files: /pear-core/PEAR/Command Config.php Log: make sure the file isn't created if there are errors http://cvs.php.net/diff.php/pear-core/PEAR/Command/Config.php?r1=1.38&r2=1.39&ty=u Index: pear-core/PEAR/Command/Config.php diff -u pear-core/PEAR/Command/Config.php:1.38 pear-core/PEAR/Command/Config.php:1.39 --- pear-core/PEAR/Command/Config.php:1.38 Fri Nov 26 16:54:59 2004 +++ pear-core/PEAR/Command/Config.php Fri Nov 26 17:08:57 2004 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Config.php,v 1.38 2004/11/26 21:54:59 cellog Exp $ +// $Id: Config.php,v 1.39 2004/11/26 22:08:57 cellog Exp $ require_once "PEAR/Command/Common.php"; require_once "PEAR/Config.php"; @@ -279,16 +279,9 @@ function doConfigCreate($command, $options, $params) { if (count($params) != 2) { - return PEAR::raiseError('There must be two parameters, root path and filename, for ' . - 'config-create'); + return PEAR::raiseError('config-create: must have 2 parameters, root path and ' . + 'filename to save as'); } - if (!file_exists($params[1])) { - if (!@touch($params[1])) { - return PEAR::raiseError('Could not create "' . $params[1] . '"'); - } - } - $params[1] = realpath($params[1]); - $config = &new PEAR_Config($params[1]); $root = $params[0]; // Clean up the DIRECTORY_SEPARATOR mess $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR; @@ -299,6 +292,13 @@ return PEAR::raiseError('Root directory must be an absolute path beginning with "/", ' . 'was: "' . $root . '"'); } + if (!file_exists($params[1])) { + if (!@touch($params[1])) { + return PEAR::raiseError('Could not create "' . $params[1] . '"'); + } + } + $params[1] = realpath($params[1]); + $config = &new PEAR_Config($params[1]); if ($root{strlen($root) - 1} == '/') { $root = substr($root, 0, strlen($root) - 1); }

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