Bearsampp 2026.9.23
Loading...
Searching...
No Matches
PEAR_Installer_Role_Cfg Class Reference
Inheritance diagram for PEAR_Installer_Role_Cfg:
Collaboration diagram for PEAR_Installer_Role_Cfg:

Public Member Functions

 processInstallation ($pkg, $atts, $file, $tmp_path, $layer=null)
 setup (&$installer, $pkg, $atts, $file)
Public Member Functions inherited from PEAR_Installer_Role_Common
 __construct (&$config)
 getInfo ($role)
 getLocationConfig ()
 isExecutable ()
 isExtension ()
 isInstallable ()

Data Fields

 $installer
 $md5 = null
Data Fields inherited from PEAR_Installer_Role_Common
 $config

Detailed Description

Definition at line 26 of file Cfg.php.

Member Function Documentation

◆ processInstallation()

processInstallation ( $pkg,
$atts,
$file,
$tmp_path,
$layer = null )

This is called for each file to set up the directories and files

Parameters
PEAR_PackageFile_v1|PEAR_PackageFile_v2
arrayattributes from the <file> tag
stringfile name
Returns
array an array consisting of:

1 the original, pre-baseinstalldir installation directory 2 the final installation directory 3 the full path to the final location of the file 4 the location of the pre-installation file

Reimplemented from PEAR_Installer_Role_Common.

Definition at line 60 of file Cfg.php.

61 {
62 $test = parent::processInstallation($pkg, $atts, $file, $tmp_path, $layer);
63 if (@file_exists($test[2]) && @file_exists($test[3])) {
64 $md5 = md5_file($test[2]);
65 // configuration has already been installed, check for mods
66 if ($md5 !== $this->md5 && $md5 !== md5_file($test[3])) {
67 // configuration has been modified, so save our version as
68 // configfile-version
69 $old = $test[2];
70 $test[2] .= '.new-' . $pkg->getVersion();
71 // backup original and re-install it
72 PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
73 $tmpcfg = $this->config->get('temp_dir');
74 $newloc = System::mkdir(array('-p', $tmpcfg));
75 if (!$newloc) {
76 // try temp_dir
77 $newloc = System::mktemp(array('-d'));
78 if (!$newloc || PEAR::isError($newloc)) {
79 PEAR::popErrorHandling();
80 return PEAR::raiseError('Could not save existing configuration file '.
81 $old . ', unable to install. Please set temp_dir ' .
82 'configuration variable to a writeable location and try again');
83 }
84 } else {
85 $newloc = $tmpcfg;
86 }
87
88 $temp_file = $newloc . DIRECTORY_SEPARATOR . uniqid('savefile');
89 if (!@copy($old, $temp_file)) {
90 PEAR::popErrorHandling();
91 return PEAR::raiseError('Could not save existing configuration file '.
92 $old . ', unable to install. Please set temp_dir ' .
93 'configuration variable to a writeable location and try again');
94 }
95
96 PEAR::popErrorHandling();
97 $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");
98 $this->installer->addFileOperation('rename', array($temp_file, $old, false));
99 $this->installer->addFileOperation('delete', array($temp_file));
100 }
101 }
102
103 return $test;
104 }
const PEAR_ERROR_RETURN
Definition PEAR.php:24
static mktemp($args=null)
Definition System.php:395

References $md5, and PEAR_ERROR_RETURN.

◆ setup()

setup ( & $installer,
$pkg,
$atts,
$file )

Do any unusual setup here

Parameters
PEAR_Installer
PEAR_PackageFile_v2
arrayfile attributes
stringfile name

Reimplemented from PEAR_Installer_Role_Common.

Definition at line 47 of file Cfg.php.

48 {
49 $this->installer = &$installer;
50 $reg = &$this->installer->config->getRegistry();
51 $package = $reg->getPackage($pkg->getPackage(), $pkg->getChannel());
52 if ($package) {
53 $filelist = $package->getFilelist();
54 if (isset($filelist[$file]) && isset($filelist[$file]['md5sum'])) {
55 $this->md5 = $filelist[$file]['md5sum'];
56 }
57 }
58 }

References $installer.

Field Documentation

◆ $installer

$installer

Definition at line 31 of file Cfg.php.

Referenced by setup().

◆ $md5

$md5 = null

Definition at line 38 of file Cfg.php.

Referenced by processInstallation().


The documentation for this class was generated from the following file:
  • E:/Bearsampp-development/sandbox/core/libs/php/pear/pear/PEAR/Installer/Role/Cfg.php