cvs: peardoc /en/package/php php-compatinfo.xml /en/package/php/php-compatinfo build-ers.xml
| From: | Laurent Laville | Date: | Fri, 02 Jan 2009 17:28:54 +0000 |
| Subject: | cvs: peardoc /en/package/php php-compatinfo.xml /en/package/php/php-compatinfo build-ers.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-11417@lists.php.net to get a copy of this message | ||
farell Fri Jan 2 17:28:54 2009 UTC
Added files:
/peardoc/en/package/php/php-compatinfo build-ers.xml
Modified files:
/peardoc/en/package/php php-compatinfo.xml
Log:
introduced the Exception Rules System coming with API 1.9.0 (learn and practice)
http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-compatinfo.xml?r1=1.41&r2=1.42&diff_format=u
Index: peardoc/en/package/php/php-compatinfo.xml
diff -u peardoc/en/package/php/php-compatinfo.xml:1.41
peardoc/en/package/php/php-compatinfo.xml:1.42
--- peardoc/en/package/php/php-compatinfo.xml:1.41 Fri Jan 2 15:54:43 2009
+++ peardoc/en/package/php/php-compatinfo.xml Fri Jan 2 17:28:54 2009
@@ -192,6 +192,7 @@
&package.php.php-compatinfo.command-line;
&package.php.php-compatinfo.renderer;
&package.php.php-compatinfo.build-esl;
+ &package.php.php-compatinfo.build-ers;
</chapter>
<chapter xml:id="package.php.php-compatinfo.ref">
http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-compatinfo/build-ers.xml?view=markup&rev=1.1
Index: peardoc/en/package/php/php-compatinfo/build-ers.xml
+++ peardoc/en/package/php/php-compatinfo/build-ers.xml
<?xml version="1.0" encoding="utf-8"?>
<refentry xmlns="http://docbook.org/ns/docbook"
version="lillet" xml:id="package.php.php-compatinfo.build-ers">
<refnamediv>
<refname>Build your Exception Rules System</refname>
<refpurpose>or how to fix invalid values</refpurpose>
</refnamediv>
<refsection xml:id="package.php.php-compatinfo.build-ers.why">
<info><title>Who need to fix error ?</title></info>
<para>
Since version 1.9.0, PHP_CompatInfo (aka PCI) used a full data dictionary system
based on source files (set of versions.xml) used by the PHP Manual generation itself.
</para>
<para>
Of course, if extensions files
<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/">reference</link>
(of phpdoc) changed, you have to wait a new release of PCI to see bugs/changes fixed.
</para>
<para>
If you can't wait a new PCI release, or because reference (phpdoc) files are fake
and not yet fixed, there is an alternative solution named
<emphasis role="bold">E</emphasis>xception
<emphasis role="bold">R</emphasis>ules
<emphasis role="bold">S</emphasis>ystem (aka ERS).
</para>
</refsection>
<refsection xml:id="package.php.php-compatinfo.build-ers.php4-procedure">
<info><title>Procedure to build your ERS for PHP4 users</title></info>
<para>
<important>
<para>
This procedure is not secure, because you can lose your changes if you install
a new PCI release that did not included your fixes.
</para>
</important>
</para>
<para>
End-users have to fix the wrong values in data dictionaries themself (by hand).
</para>
</refsection>
<refsection xml:id="package.php.php-compatinfo.build-ers.php5-procedure">
<info><title>Procedure to build your ERS for PHP5 users</title></info>
<para>
<important>
<para>
This procedure is pretty secure, and minimize risk to lose informations.
</para>
</important>
<note>
<para>
Version 1.9.0 of PCI used itself the ERS to fix data still missing in
phpdoc reference.
</para>
<para>
Reason: Migration from monolithic
<filename>http://cvs.php.net/viewvc.cgi/phpdoc/phpbook/phpbook-xsl/version.xml</filename>
to specific extension file
<filename>http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/*/version.xml</filename>
is not yet over !
</para>
</note>
</para>
<para>
<command>pciconf</command> CLI script build data dictionary from source below :
<orderedlist>
<listitem>
<para>
the phpdoc reference mirror files installed in PCI data directory
<filename
class="directory">@data_dir@/PHP_CompatInfo/data/phpdocref/</filename>,
where @data_dir@ identify your PEAR data directory.
</para>
</listitem>
<listitem>
<para>
a list of Exception Rules installed in
<filename class="directory">@php_dir@/scripts/pciconf/</filename>,
where @php_dir@ identify your PEAR directory.
</para>
</listitem>
</orderedlist>
</para>
<para>
Default Exception Rules are provided by a set of file s named
<filename>*_func_exception.php</filename>,
<filename>*_const_exception.php</filename>,
<filename>*_class_exception.php</filename>, where * means for the extension name
(case sensitive).
</para>
<para>
Exception Rules files have the same structure as data dictionary. Only the
array php variable name is different.
<itemizedlist>
<listitem>
<para>
<varname>$function_exceptions</varname> for the related extension functions list
</para>
</listitem>
<listitem>
<para>
<varname>$constant_exceptions</varname> for the related extension constants list
</para>
</listitem>
<listitem>
<para>
<varname>$class_exceptions</varname> for the related extension classes list
</para>
</listitem>
</itemizedlist>
</para>
<para>
<command>pciconf</command> detect presence of Exception Rules by the
<filename>exceptions.conf.php</filename> file.
</para>
<para>
This file implement a required function
<funcsynopsis>
<funcprototype>
<funcdef>mixed <function>getExceptions</function></funcdef>
<paramdef choice="req">string
<parameter>$extension</parameter></paramdef>
<paramdef choice="req">string
<parameter>$type</parameter></paramdef>
</funcprototype>
</funcsynopsis>
First argument <parameter>$extension</parameter> identify the extension name,
while second argument <parameter>$type</parameter> identify the kind of exception
(version, class, function, constant) to proceed.
</para>
<para>
If function return <constant>FALSE</constant>, that means there are no value
to apply/merge with the phpdoc base reference. Otherwise, function should return
a compatible data dictionary structure (array) what contains all news/changes
to apply.
</para>
<para>
To use your own ERS, you have to tell it to the <command>pciconf</command>
script with the --exception switch.
</para>
<para>
Example: <command>pciconf --exception /home/users/farell/myERS.php</command>
</para>
<para>
In summary:
<itemizedlist>
<listitem>
<para>
Build your own ERS to be free to fix all errors you found without to wait
a PHP Manual/PCI new version.
</para>
</listitem>
<listitem>
<para>
Use a directory acessible in your include_path to store result of
data dictionaries corresponding to your platform, and avoid to overwrite
the default PCI installation.
</para>
</listitem>
</itemizedlist>
</para>
</refsection>
</refentry>