1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
|
<?xml version="1.0" encoding="iso-8859-1"?>
<chapter xml:id="chapter-scripts" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Automatization with scripts</title>
<para>
The PHP manual is very big and the PHP sources change every day. To help the
documentation writers work, we have developed a couple of scripts during
the last years. Below you will find a list of the scripts, as well a short
explanation and usage tips for each one.
</para>
<sect1 xml:id="scripts.aspell.php">
<title>aspell.php</title>
<para>
This script can be used to escape or unescape manual files for use with
<command>aspell</command>. Escaping moves the contents of tags with
non-English texts (like <literal><type></literal>,
<literal><parameter></literal> or <literal><function></literal>)
to the attribute <literal>aspell</literal> so the Aspell will ignore them.
Unescaping is the opposite process.
</para>
<para>
File <filename>en.pws</filename> contains words not included in the Aspell
dictionary but valid in the PHP manual and can be used as the personal
dictionary.
</para>
</sect1>
<sect1 xml:id="scripts.check-references.php">
<title>check-references.php</title>
<para>
This script tries to parse the PHP sources and compares the facts about
function parameters (their count, types, optionally and the need of
passing them as reference) with the documentation. Only easily parsable
functions from Zend, extensions, PECL and SAPI sources are checked.
</para>
<para>
Used rules are not absolutely precise, they are rather heuristics. Thus not
everything printed automatically denotes errors and sources should be
always read by a human before modifying the documentation. If the sources
correspond to the documentation and this script still produces error,
function should be added to one of <varname>$difficult_*</varname> arrays
defined in the beginning of this script.
</para>
</sect1>
<sect1 xml:id="scripts.diff-en-rev.php">
<title>diff_en_rev.php</title>
<para>
One of the scripts helping translators.
</para>
<para>
It prints a diff between the current English version and the translated
version of a file. It uses the <literal><!-- EN-Revision
--></literal> tag to determine the translated version. If the local
English file has different revision, <command>svn diff</command> is
executed to obtain the list of changes.
</para>
<para>
It is possible to pass a directory name instead of file name. In this case,
list of modified files in the directory is printed.
</para>
</sect1>
<sect1 xml:id="scripts.extensions.xml.php">
<title>extensions.xml.php</title>
<para>
The <filename>extensions.xml.php</filename> script creates the <link
xlink:href="&url.extension.cat;">extension categorization appendix</link>. It
collects the data from the reference.xml files and updates the
<filename>en/appendices/extensions.xml</filename> file.
</para>
<para>
The tags supported for the <filename>reference/*/reference.xml</filename>
files include:
<table>
<title/>
<tgroup cols="2">
<thead>
<row>
<entry>Tag</entry>
<entry>Explanation</entry>
</row>
</thead>
<tbody>
<row>
<entry><!-- Purpose: xx --></entry>
<entry>
<para>
The purpose of the extension, specified by an ID. There are several
IDs available, which can be consulted in the
<filename>en/extensions.ent</filename> file. They look like
<literal>database.vendors</literal> or <literal>xml</literal>.
</para>
<para>
If none of the available categories fits your extension, you can
create a new one. To do so, you must add a new entity in the
<filename>en/extensions.ent</filename> file, like:
<literal><!ENTITY extcat.purpose.xml '<title>XML
Manipulation</title>'></literal>. After this, you still
need to edit <filename>en/appendices/extensions.xml</filename> and
create a new section for your ID, by copying an already existent
section. This isn't done automatically to allow you to choose the
order of the sections.
</para>
</entry>
</row>
<row>
<entry><!-- Membership: xx, yy --></entry>
<entry>
This tag can have multiple values, that should be separated by commas.
Valid values include: <literal>core</literal> (for PHP core
extensions, like the strings or date extension),
<literal>pecl</literal> (if the extension lives in PECL),
<literal>bundled</literal> (if the extension is bundled with the main
PHP distribution), and <literal>external</literal> (if the extension
relies on external - and not bundled - libraries).
</entry>
</row>
<row>
<entry><!-- State: xx --></entry>
<entry>
This tag is optional and can only have two values, either
<literal>deprecated</literal> or <literal>experimental</literal>.
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<note>
<para>
If you mark an extension as deprecated and if it is very old and unusable,
you shouldn't add the purpose and membership tags, so that the extension
doesn't appear in the appendix (to avoid confusing users).
</para>
</note>
<para>
The script should warn you for missing tags or even bogus values, although
it won't report any XML errors. So, you have the responsibility to run
<command>make test</command> before running this script. Failing to do so,
may lead to unexpected results.
</para>
<note>
<para>
This script requires PHP >= 5 with SimpleXML.
</para>
</note>
</sect1>
<sect1 xml:id="scripts.html-syntax.php">
<title>html_syntax.php</title>
<para>
This script is used in the build process to syntax highlight PHP examples
both for the online and downloadable manuals.
</para>
</sect1>
<sect1 xml:id="scripts.iniupdate">
<title>iniupdate/*.php</title>
<para>
The <filename>iniupdate</filename> directory contains a set of scripts that
are used to generate the <filename>en/appendices/ini.xml</filename> table.
They also update the information that is dispersed in the
<filename>en/reference/*/ini.xml</filename> files.
</para>
<para>
To use this script, you must download all the PHP 4, 5 and 6 sources (which
will take a long time), so that the script can create a DB with the history
of the changes between the versions. To do that, you can just run the
<command>./update-all</command> script. If you are using the 'functable'
script as well, you may just create a symlink to its sources, as the
sources are the same :) The rest of the process is explained in the README
file.
</para>
<para>
The core of the scripts is in <filename>ini_search_lib.php</filename>, and
it is very regex based. The main regexes work correctly, although some
heuristics are used to catch the <function>cfg_get_*</function> uses. The
<filename>generate_changelog.php</filename> is used to generate the
changelog (based on the data previously collected in the DB).
</para>
<note>
<para>
This script requires PHP >= 5 with SQLite.
</para>
</note>
</sect1>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"howto.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
|