cvs: peardoc /en/guide/developers/package2 tasks.xml
| From: | Greg Beaver | Date: | Sat, 19 Mar 2005 01:18:04 +0000 |
| Subject: | cvs: peardoc /en/guide/developers/package2 tasks.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-5694@lists.php.net to get a copy of this message | ||
cellog Fri Mar 18 20:18:04 2005 EDT
Modified files:
/peardoc/en/guide/developers/package2 tasks.xml
Log:
finish xml docs for <tasks:postinstallscript>
http://cvs.php.net/diff.php/peardoc/en/guide/developers/package2/tasks.xml?r1=1.2&r2=1.3&ty=u
Index: peardoc/en/guide/developers/package2/tasks.xml
diff -u peardoc/en/guide/developers/package2/tasks.xml:1.2
peardoc/en/guide/developers/package2/tasks.xml:1.3
--- peardoc/en/guide/developers/package2/tasks.xml:1.2 Mon Mar 14 00:07:12 2005
+++ peardoc/en/guide/developers/package2/tasks.xml Fri Mar 18 20:18:04 2005
@@ -1,4 +1,4 @@
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<refentry id="guide.developers.package2.tasks">
<refnamediv>
<refname>tasks for <file>s</refname>
@@ -96,7 +96,113 @@
<postinstallscript> tag.
</para>
<para>
- Note: documentation is not yet finished for postinstallscript, but will be soon.
+ Here is the xml representing a simple post-install script with parameters:
+ </para>
+ <para>
+ <programlisting role="xml">
+ <![CDATA[
+<tasks:postinstallscript>
+ <paramgroup>
+ <id>first</id>
+ <param>
+ <name>test</name>
+ <prompt>Testing Thingy</prompt>
+ <type>string</type>
+ </param>
+ </paramgroup>
+</tasks:postinstallscript>
+ ]]>
+ </programlisting>
+ </para>
+ <para>
+ Note that the only type recognized at this stage is "string" but others will
follow.
+ A more complex example follows:
+ </para>
+ <para>
+ <programlisting role="xml">
+ <![CDATA[
+<tasks:postinstallscript>
+ <paramgroup>
+ <id>first</id>
+ <param>
+ <name>test</name>
+ <prompt>Testing Thingy</prompt>
+ <type>string</type>
+ <default>hi</default>
+ </param>
+ <param>
+ <name>test2</name>
+ <prompt>Testing Thingy 2</prompt>
+ <type>string</type>
+ </param>
+ </paramgroup>
+ <paramgroup>
+ <id>second</id>
+ <name>first::test</name>
+ <conditiontype>preg_match</conditiontype>
+ <value>g+</value>
+ <param>
+ <name>test</name>
+ <prompt>Testing Thingy a</prompt>
+ <type>string</type>
+ <default>hi</default>
+ </param>
+ <param>
+ <name>test2</name>
+ <prompt>Testing Thingy b</prompt>
+ <type>string</type>
+ </param>
+ </paramgroup>
+</tasks:postinstallscript>
+ ]]>
+ </programlisting>
+ </para>
+ <para>
+ This post-installation script has two parameter groups. After the first group is processed,
+ the second group is processed (naturally). However, in this case, the second group is a
+ conditional parameter group. A conditional parameter group examines the user input from
+ previous parameter groups and only displays its parameter prompts if a single parameter
+ fits a test. The condition is defined by three tags, <name>,
<conditiontype>,
+ and <value>. Note that all three tags are required or xml validation will fail.
+ </para>
+ <para>
+ <name> is the parameter name from a previous parameter group. The format of name
is
+ groupID::parameterName, so as you see above, "first::test" refers to the
+ <param> first from the <paramgroup> test.
+ </para>
+ <para>
+ <conditiontype> determines how the parameter input function will process the
value of
+ the parameter specified in <name>, and can be one of three values,
"=" "!="
+ or "preg_match".
+ </para>
+ <para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ =: This (obviously) tests whether the parameters value is equal to the <value>
tag
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ !=: This (obviously) tests whether the parameters value is not equal to the
<value> tag
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ preg_match: This uses the content of the <value> tag as if it were the stuff
between
+ / and / in a <ulink
url="&url.php;preg_match"><function>preg_match</function></ulink>
+ function call. Do NOT include // brackets in
+ the regular expression. In the <paramgroup> second, the value
"g+" will become:
+ <programlisting role="php">
+ <![CDATA[
+<?php
+preg_match('/g+/', first::test value)
+?>
+ ]]>
+ </programlisting>
+ </para>
+ </listitem>
+ </itemizedlist>
</para>
</refsect2>
</refsect1>