123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- <?php
- define('PEAR_TASK_ERROR_NOATTRIBS', 1);
- define('PEAR_TASK_ERROR_MISSING_ATTRIB', 2);
- define('PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE', 3);
- define('PEAR_TASK_ERROR_INVALID', 4);
- define('PEAR_TASK_PACKAGE', 1);
- define('PEAR_TASK_INSTALL', 2);
- define('PEAR_TASK_PACKAGEANDINSTALL', 3);
- class PEAR_Task_Common
- {
-
- protected $type = 'simple';
-
- public $phase = PEAR_TASK_INSTALL;
-
- protected $config;
-
- protected $registry;
-
- public $logger;
-
- protected $installphase;
-
- function __construct(&$config, &$logger, $phase)
- {
- $this->config = &$config;
- $this->registry = &$config->getRegistry();
- $this->logger = &$logger;
- $this->installphase = $phase;
- if ($this->type == 'multiple') {
- $GLOBALS['_PEAR_TASK_POSTINSTANCES'][get_class($this)][] = &$this;
- }
- }
-
- public static function validateXml($pkg, $xml, $config, $fileXml)
- {
- }
-
- public function init($xml, $fileAttributes, $lastVersion)
- {
- }
-
- public function startSession($pkg, $contents, $dest)
- {
- }
-
- public static function run($tasks)
- {
- }
-
- public static function hasPostinstallTasks()
- {
- return isset($GLOBALS['_PEAR_TASK_POSTINSTANCES']);
- }
-
- public static function runPostinstallTasks()
- {
- foreach ($GLOBALS['_PEAR_TASK_POSTINSTANCES'] as $class => $tasks) {
- $err = call_user_func(
- array($class, 'run'),
- $GLOBALS['_PEAR_TASK_POSTINSTANCES'][$class]
- );
- if ($err) {
- return PEAR_Task_Common::throwError($err);
- }
- }
- unset($GLOBALS['_PEAR_TASK_POSTINSTANCES']);
- }
-
- public function isScript()
- {
- return $this->type == 'script';
- }
- public function throwError($msg, $code = -1)
- {
- include_once 'PEAR.php';
- return PEAR::raiseError($msg, $code);
- }
- }
|