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

Public Member Functions

 __construct (&$config, &$logger, $phase)
 init ($xml, $fileAttributes, $lastVersion)
 isScript ()
 startSession ($pkg, $contents, $dest)
 throwError ($msg, $code=-1)

Static Public Member Functions

static hasPostinstallTasks ()
static run ($tasks)
static runPostinstallTasks ()
static validateXml ($pkg, $xml, $config, $fileXml)

Data Fields

 $logger
 $phase = PEAR_TASK_INSTALL

Protected Attributes

 $config
 $installphase
 $registry
 $type = 'simple'

Detailed Description

Definition at line 55 of file Common.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( & $config,
& $logger,
$phase )
Parameters
PEAR_Config
PEAR_Common

Definition at line 93 of file Common.php.

94 {
95 $this->config = &$config;
96 $this->registry = &$config->getRegistry();
97 $this->logger = &$logger;
98 $this->installphase = $phase;
99 if ($this->type == 'multiple') {
100 $GLOBALS['_PEAR_TASK_POSTINSTANCES'][get_class($this)][] = &$this;
101 }
102 }
$GLOBALS['_PEAR_default_error_mode']
Definition PEAR.php:46

References $config, $GLOBALS, $logger, and $phase.

Member Function Documentation

◆ hasPostinstallTasks()

hasPostinstallTasks ( )
static

@final

Definition at line 170 of file Common.php.

171 {
172 return isset($GLOBALS['_PEAR_TASK_POSTINSTANCES']);
173 }

References $GLOBALS.

Referenced by PEAR_Installer\install().

Here is the caller graph for this function:

◆ init()

init ( $xml,
$fileAttributes,
$lastVersion )

Initialize a task instance with the parameters

Parameters
arrayraw, parsed xml
arrayattributes from the <file> tag containing this task
string|nulllast installed version of this package @abstract

Reimplemented in PEAR_Task_Postinstallscript, PEAR_Task_Replace, PEAR_Task_Unixeol, and PEAR_Task_Windowseol.

Definition at line 133 of file Common.php.

134 {
135 }

◆ isScript()

isScript ( )

Determines whether a role is a script

Returns
bool

Definition at line 196 of file Common.php.

197 {
198 return $this->type == 'script';
199 }

◆ run()

run ( $tasks)
static

This method is used to process each of the tasks for a particular multiple class type. Simple tasks need not implement this method.

Parameters
arrayan array of tasks @access protected

Reimplemented in PEAR_Task_Postinstallscript.

Definition at line 163 of file Common.php.

164 {
165 }

◆ runPostinstallTasks()

runPostinstallTasks ( )
static

@final

Definition at line 178 of file Common.php.

179 {
180 foreach ($GLOBALS['_PEAR_TASK_POSTINSTANCES'] as $class => $tasks) {
181 $err = call_user_func(
182 array($class, 'run'),
183 $GLOBALS['_PEAR_TASK_POSTINSTANCES'][$class]
184 );
185 if ($err) {
186 return PEAR_Task_Common::throwError($err);
187 }
188 }
189 unset($GLOBALS['_PEAR_TASK_POSTINSTANCES']);
190 }
throwError($msg, $code=-1)
Definition Common.php:201

References $GLOBALS, and throwError().

Referenced by PEAR_Installer\install().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ startSession()

startSession ( $pkg,
$contents,
$dest )

Begin a task processing session. All multiple tasks will be processed after each file has been successfully installed, all simple tasks should perform their task here and return any errors using the custom throwError() method to allow forward compatibility

This method MUST NOT write out any changes to disk

Parameters
PEAR_PackageFile_v2
stringfile contents
stringthe eventual final file location (informational only)
Returns
string|false|PEAR_Error false to skip this file, PEAR_Error to fail (use $this->throwError), otherwise return the new contents @abstract

Reimplemented in PEAR_Task_Postinstallscript, PEAR_Task_Replace, PEAR_Task_Unixeol, and PEAR_Task_Windowseol.

Definition at line 152 of file Common.php.

153 {
154 }

◆ throwError()

throwError ( $msg,
$code = -1 )

Definition at line 201 of file Common.php.

202 {
203 include_once 'PEAR.php';
204
205 return PEAR::raiseError($msg, $code);
206 }

Referenced by runPostinstallTasks(), and PEAR_Task_Postinstallscript\startSession().

Here is the caller graph for this function:

◆ validateXml()

validateXml ( $pkg,
$xml,
$config,
$fileXml )
static

Validate the basic contents of a task tag.

Parameters
PEAR_PackageFile_v2
array
PEAR_Config
arraythe entire parsed <file> tag
Returns
true|array On error, return an array in format: array(PEAR_TASK_ERROR_???[, param1][, param2][, ...])

For PEAR_TASK_ERROR_MISSING_ATTRIB, pass the attribute name in For PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, pass the attribute name and an array of legal values in

@abstract

Reimplemented in PEAR_Task_Postinstallscript, PEAR_Task_Replace, PEAR_Task_Unixeol, and PEAR_Task_Windowseol.

Definition at line 121 of file Common.php.

122 {
123 }

References $config.

Field Documentation

◆ $config

◆ $installphase

$installphase
protected

@access protected

Definition at line 88 of file Common.php.

◆ $logger

◆ $phase

Determines which install phase this task is executed under

Definition at line 72 of file Common.php.

Referenced by __construct().

◆ $registry

$registry
protected

@access protected

Definition at line 80 of file Common.php.

◆ $type

$type = 'simple'
protected

Valid types for this version are 'simple' and 'multiple'

  • simple tasks operate on the contents of a file and write out changes to disk
  • multiple tasks operate on the contents of many files and write out the changes directly to disk

Child task classes must override this property.

@access protected

Definition at line 68 of file Common.php.


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