cvs: peardoc /en/guide/developers/package2 tasks.xml

From: 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 &lt;file&gt;s</refname> @@ -96,7 +96,113 @@ &lt;postinstallscript&gt; 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 &quot;string&quot; 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, &lt;name&gt;, &lt;conditiontype&gt;, + and &lt;value&gt;. Note that all three tags are required or xml validation will fail. + </para> + <para> + &lt;name&gt; is the parameter name from a previous parameter group. The format of name is + groupID::parameterName, so as you see above, &quot;first::test&quot; refers to the + &lt;param&gt; first from the &lt;paramgroup&gt; test. + </para> + <para> + &lt;conditiontype&gt; determines how the parameter input function will process the value of + the parameter specified in &lt;name&gt;, and can be one of three values, &quot;=&quot; &quot;!=&quot; + or &quot;preg_match&quot;. + </para> + <para> + <itemizedlist> + <listitem> + <para> + =: This (obviously) tests whether the parameters value is equal to the &lt;value&gt; tag + </para> + </listitem> + <listitem> + <para> + !=: This (obviously) tests whether the parameters value is not equal to the &lt;value&gt; tag + </para> + </listitem> + <listitem> + <para> + preg_match: This uses the content of the &lt;value&gt; 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 &lt;paramgroup&gt; second, the value &quot;g+&quot; will become: + <programlisting role="php"> + <![CDATA[ +<?php +preg_match('/g+/', first::test value) +?> + ]]> + </programlisting> + </para> + </listitem> + </itemizedlist> </para> </refsect2> </refsect1>

« previous php.pear.doc (#5694) next »