Bearsampp 2026.9.23
Loading...
Searching...
No Matches
Common.php
Go to the documentation of this file.
1<?php
18define('PEAR_TASK_ERROR_NOATTRIBS', 1);
19define('PEAR_TASK_ERROR_MISSING_ATTRIB', 2);
20define('PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE', 3);
21define('PEAR_TASK_ERROR_INVALID', 4);
23define('PEAR_TASK_PACKAGE', 1);
24define('PEAR_TASK_INSTALL', 2);
25define('PEAR_TASK_PACKAGEANDINSTALL', 3);
56{
68 protected $type = 'simple';
76 protected $config;
80 protected $registry;
84 public $logger;
88 protected $installphase;
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 }
103
121 public static function validateXml($pkg, $xml, $config, $fileXml)
122 {
123 }
124
133 public function init($xml, $fileAttributes, $lastVersion)
134 {
135 }
136
152 public function startSession($pkg, $contents, $dest)
153 {
154 }
155
163 public static function run($tasks)
164 {
165 }
166
170 public static function hasPostinstallTasks()
171 {
172 return isset($GLOBALS['_PEAR_TASK_POSTINSTANCES']);
173 }
174
178 public static function runPostinstallTasks()
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 }
191
196 public function isScript()
197 {
198 return $this->type == 'script';
199 }
200
201 public function throwError($msg, $code = -1)
202 {
203 include_once 'PEAR.php';
204
205 return PEAR::raiseError($msg, $code);
206 }
207}
$GLOBALS['_PEAR_default_error_mode']
Definition PEAR.php:46
const PEAR_TASK_INSTALL
Definition Common.php:24
init($xml, $fileAttributes, $lastVersion)
Definition Common.php:133
static hasPostinstallTasks()
Definition Common.php:170
startSession($pkg, $contents, $dest)
Definition Common.php:152
static validateXml($pkg, $xml, $config, $fileXml)
Definition Common.php:121
static runPostinstallTasks()
Definition Common.php:178
throwError($msg, $code=-1)
Definition Common.php:201
__construct(&$config, &$logger, $phase)
Definition Common.php:93
static run($tasks)
Definition Common.php:163