<?php
 require_once 'PEAR/Task/Postinstallscript.php'; class PEAR_Task_Postinstallscript_rw extends PEAR_Task_Postinstallscript { var $_pkg; function PEAR_Task_Postinstallscript_rw(&$pkg, &$config, &$logger, $fileXml) { parent::PEAR_Task_Common($config, $logger, PEAR_TASK_PACKAGE); $this->_contents = $fileXml; $this->_pkg = &$pkg; $this->_params = array(); } function validate() { return $this->validateXml($this->_pkg, $this->_params, $this->config, $this->_contents); } function getName() { return 'postinstallscript'; } function addParamGroup($id, $params = false, $instructions = false) { if ($params && isset($params[0]) && !isset($params[1])) { $params = $params[0]; } $stuff = array( $this->_pkg->getTasksNs() . ':id' => $id, ); if ($instructions) { $stuff[$this->_pkg->getTasksNs() . ':instructions'] = $instructions; } if ($params) { $stuff[$this->_pkg->getTasksNs() . ':param'] = $params; } $this->_params[$this->_pkg->getTasksNs() . ':paramgroup'][] = $stuff; } function addConditionTypeGroup($id, $oldgroup, $param, $value, $conditiontype = '=', $params = false, $instructions = false) { if ($params && isset($params[0]) && !isset($params[1])) { $params = $params[0]; } $stuff = array( $this->_pkg->getTasksNs() . ':id' => $id, ); if ($instructions) { $stuff[$this->_pkg->getTasksNs() . ':instructions'] = $instructions; } $stuff[$this->_pkg->getTasksNs() . ':name'] = $oldgroup . '::' . $param; $stuff[$this->_pkg->getTasksNs() . ':conditiontype'] = $conditiontype; $stuff[$this->_pkg->getTasksNs() . ':value'] = $value; if ($params) { $stuff[$this->_pkg->getTasksNs() . ':param'] = $params; } $this->_params[$this->_pkg->getTasksNs() . ':paramgroup'][] = $stuff; } function getXml() { return $this->_params; } function getParam($name, $prompt, $type = 'string', $default = null) { if ($default !== null) { return array( $this->_pkg->getTasksNs() . ':name' => $name, $this->_pkg->getTasksNs() . ':prompt' => $prompt, $this->_pkg->getTasksNs() . ':type' => $type, $this->_pkg->getTasksNs() . ':default' => $default ); } return array( $this->_pkg->getTasksNs() . ':name' => $name, $this->_pkg->getTasksNs() . ':prompt' => $prompt, $this->_pkg->getTasksNs() . ':type' => $type, ); } } ?>