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

Public Member Functions

 __construct (&$config)
 getInfo ($role)
 getLocationConfig ()
 isExecutable ()
 isExtension ()
 isInstallable ()
 processInstallation ($pkg, $atts, $file, $tmp_path, $layer=null)
 setup (&$installer, $pkg, $atts, $file)

Data Fields

 $config

Detailed Description

Definition at line 30 of file Common.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( & $config)
Parameters
PEAR_Config

Definition at line 41 of file Common.php.

42 {
43 $this->config = $config;
44 }

References $config.

Member Function Documentation

◆ getInfo()

getInfo ( $role)

Retrieve configuration information about a file role from its XML info

Parameters
string$roleRole Classname, as in "PEAR_Installer_Role_Data"
Returns
array

Definition at line 52 of file Common.php.

53 {
54 if (empty($GLOBALS['_PEAR_INSTALLER_ROLES'][$role])) {
55 return PEAR::raiseError('Unknown Role class: "' . $role . '"');
56 }
57 return $GLOBALS['_PEAR_INSTALLER_ROLES'][$role];
58 }
$GLOBALS['_PEAR_default_error_mode']
Definition PEAR.php:46

References $GLOBALS.

Referenced by getLocationConfig(), isExecutable(), isExtension(), isInstallable(), and processInstallation().

Here is the caller graph for this function:

◆ getLocationConfig()

getLocationConfig ( )

Get the name of the configuration variable that specifies the location of this file

Returns
string|false

Definition at line 122 of file Common.php.

123 {
124 $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' .
125 ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this)))));
126 if (PEAR::isError($roleInfo)) {
127 return $roleInfo;
128 }
129 return $roleInfo['locationconfig'];
130 }

References getInfo().

Here is the call graph for this function:

◆ isExecutable()

isExecutable ( )

Definition at line 143 of file Common.php.

144 {
145 $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' .
146 ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this)))));
147 if (PEAR::isError($roleInfo)) {
148 return $roleInfo;
149 }
150 return $roleInfo['executable'];
151 }

References getInfo().

Here is the call graph for this function:

◆ isExtension()

isExtension ( )

Definition at line 163 of file Common.php.

164 {
165 $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' .
166 ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this)))));
167 if (PEAR::isError($roleInfo)) {
168 return $roleInfo;
169 }
170 return $roleInfo['phpextension'];
171 }

References getInfo().

Here is the call graph for this function:

◆ isInstallable()

isInstallable ( )

Definition at line 153 of file Common.php.

154 {
155 $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' .
156 ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this)))));
157 if (PEAR::isError($roleInfo)) {
158 return $roleInfo;
159 }
160 return $roleInfo['installable'];
161 }

References getInfo().

Here is the call graph for this function:

◆ 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 in PEAR_Installer_Role_Cfg.

Definition at line 72 of file Common.php.

73 {
74 $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' .
75 ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this)))));
76 if (PEAR::isError($roleInfo)) {
77 return $roleInfo;
78 }
79 if (!$roleInfo['locationconfig']) {
80 return false;
81 }
82 if ($roleInfo['honorsbaseinstall']) {
83 $dest_dir = $save_destdir = $this->config->get($roleInfo['locationconfig'], $layer,
84 $pkg->getChannel());
85 if (!empty($atts['baseinstalldir'])) {
86 $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
87 }
88 } elseif ($roleInfo['unusualbaseinstall']) {
89 $dest_dir = $save_destdir = $this->config->get($roleInfo['locationconfig'],
90 $layer, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
91 if (!empty($atts['baseinstalldir'])) {
92 $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
93 }
94 } else {
95 $dest_dir = $save_destdir = $this->config->get($roleInfo['locationconfig'],
96 $layer, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
97 }
98 if (dirname($file) != '.' && empty($atts['install-as'])) {
99 $dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
100 }
101 if (empty($atts['install-as'])) {
102 $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
103 } else {
104 $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as'];
105 }
106 $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file;
107
108 // Clean up the DIRECTORY_SEPARATOR mess
109 $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
110
111 list($dest_dir, $dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!$ds2+!"),
112 array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR,
113 DIRECTORY_SEPARATOR),
114 array($dest_dir, $dest_file, $orig_file));
115 return array($save_destdir, $dest_dir, $dest_file, $orig_file);
116 }

References getInfo().

Here is the call graph for this function:

◆ setup()

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

Do any unusual setup here

Parameters
PEAR_Installer
PEAR_PackageFile_v2
arrayfile attributes
stringfile name

Reimplemented in PEAR_Installer_Role_Cfg, and PEAR_Installer_Role_Src.

Definition at line 139 of file Common.php.

140 {
141 }

Field Documentation

◆ $config

$config

Definition at line 36 of file Common.php.

Referenced by __construct().


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