Source for file Cfg.php
Documentation is available at Cfg.php
* PEAR_Installer_Role_Cfg
* @author Greg Beaver <cellog@php.net>
* @copyright 2007-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version CVS: $Id: Cfg.php 313023 2011-07-06 19:17:11Z dufuz $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.7.0
* @author Greg Beaver <cellog@php.net>
* @copyright 2007-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.9.4
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.7.0
* the md5 of the original file
* Do any unusual setup here
* @param PEAR_PackageFile_v2
* @param array file attributes
* @param string file name
function setup(&$installer, $pkg, $atts, $file)
$reg = &$this->installer->config->getRegistry ();
$package = $reg->getPackage ($pkg->getPackage (), $pkg->getChannel ());
$filelist = $package->getFilelist ();
if (isset ($filelist[$file]) && isset ($filelist[$file]['md5sum'])) {
$this->md5 = $filelist[$file]['md5sum'];
// configuration has already been installed, check for mods
if ($md5 !== $this->md5 && $md5 !== md5_file($test[3 ])) {
// configuration has been modified, so save our version as
$test[2 ] .= '.new-' . $pkg->getVersion ();
// backup original and re-install it
$tmpcfg = $this->config->get ('temp_dir');
$newloc = System::mkdir (array ('-p', $tmpcfg));
return PEAR::raiseError('Could not save existing configuration file '.
$old . ', unable to install. Please set temp_dir ' .
'configuration variable to a writeable location and try again');
$temp_file = $newloc . DIRECTORY_SEPARATOR . uniqid('savefile');
if (!@copy($old, $temp_file)) {
return PEAR::raiseError('Could not save existing configuration file '.
$old . ', unable to install. Please set temp_dir ' .
'configuration variable to a writeable location and try again');
$this->installer->log (0 , " WARNING: configuration file $old is being installed as $test[2], you should manually merge in changes to the existing configuration file" );
Documentation generated on Wed, 06 Jul 2011 23:30:27 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.
|