cvs: pear-core /PEAR/Task/Postinstallscript rw.php
| From: | Greg Beaver | Date: | Wed, 19 Oct 2005 04:33:11 +0000 |
| Subject: | cvs: pear-core /PEAR/Task/Postinstallscript rw.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-35701@lists.php.net to get a copy of this message | ||
cellog Wed Oct 19 00:33:11 2005 EDT
Modified files:
/pear-core/PEAR/Task/Postinstallscript rw.php
Log:
add doc comments.
eek. addConditionTypeGroup never actually worked
http://cvs.php.net/diff.php/pear-core/PEAR/Task/Postinstallscript/rw.php?r1=1.7&r2=1.8&ty=u
Index: pear-core/PEAR/Task/Postinstallscript/rw.php
diff -u pear-core/PEAR/Task/Postinstallscript/rw.php:1.7
pear-core/PEAR/Task/Postinstallscript/rw.php:1.8
--- pear-core/PEAR/Task/Postinstallscript/rw.php:1.7 Wed Oct 19 00:16:13 2005
+++ pear-core/PEAR/Task/Postinstallscript/rw.php Wed Oct 19 00:33:09 2005
@@ -15,7 +15,7 @@
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: rw.php,v 1.7 2005/10/19 04:16:13 cellog Exp $
+ * @version CVS: $Id: rw.php,v 1.8 2005/10/19 04:33:09 cellog Exp $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a10
*/
@@ -70,19 +70,22 @@
}
/**
- * add a <paramgroup> to the post-install script
- *
+ * add a simple <paramgroup> to the post-install script
+ *
* Order is significant, so call this method in the same
* sequence the users should see the paramgroups. The $params
* parameter should either be the result of a call to {@link getParam()}
* or an array of calls to getParam().
- * @param string $id
- * @param array $params
+ *
+ * Use {@link addConditionTypeGroup()} to add a <paramgroup> containing
+ * a <conditiontype> tag
+ * @param string $id <paramgroup> id as seen by the script
+ * @param array|false $params array of getParam() calls, or false for no params
* @param string|false $instructions
*/
- function addParamGroup($id, $params, $instructions = false)
+ function addParamGroup($id, $params = false, $instructions = false)
{
- if (isset($params[0]) && !isset($params[1])) {
+ if ($params && isset($params[0]) && !isset($params[1])) {
$params = $params[0];
}
$stuff =
@@ -92,23 +95,50 @@
if ($instructions) {
$stuff[$this->_pkg->getTasksNs() . ':instructions'] = $instructions;
}
- $stuff[$this->_pkg->getTasksNs() . ':param'] = $params;
+ if ($params) {
+ $stuff[$this->_pkg->getTasksNs() . ':param'] = $params;
+ }
$this->_params[$this->_pkg->getTasksNs() . ':paramgroup'][] = $stuff;
}
- function addConditionTypeGroup($id, $oldgroup, $param, $value, $conditiontype = '=')
+ /**
+ * add a complex <paramgroup> to the post-install script with conditions
+ *
+ * This inserts a <paramgroup> with
+ *
+ * Order is significant, so call this method in the same
+ * sequence the users should see the paramgroups. The $params
+ * parameter should either be the result of a call to {@link getParam()}
+ * or an array of calls to getParam().
+ *
+ * Use {@link addParamGroup()} to add a simple <paramgroup>
+ *
+ * @param string $id <paramgroup> id as seen by the script
+ * @param string $oldgroup <paramgroup> id of the section referenced by
+ * <conditiontype>
+ * @param string $param name of the <param> from the older section referenced
+ * by <contitiontype>
+ * @param string $value value to match of the parameter
+ * @param string $conditiontype one of '=', '!=', 'preg_match'
+ * @param array|false $params array of getParam() calls, or false for no params
+ */
+ function addConditionTypeGroup($id, $oldgroup, $param, $value, $conditiontype = '=',
+ $params = false)
{
- if (isset($params[0]) && !isset($params[1])) {
+ if ($params && isset($params[0]) && !isset($params[1])) {
$params = $params[0];
}
- $this->_params[] =
+ $stuff =
array(
$this->_pkg->getTasksNs() . ':id' => $id,
$this->_pkg->getTasksNs() . ':name' => $oldgroup .
'::' . $param,
$this->_pkg->getTasksNs() . ':conditiontype' => $conditiontype,
$this->_pkg->getTasksNs() . ':value' => $value,
- $this->_pkg->getTasksNs() . ':param' => $params,
);
+ if ($params) {
+ $stuff[$this->_pkg->getTasksNs() . ':param'] = $params;
+ }
+ $this->_params[] = $stuff;
}
function getXml()