svn: /phpdoc/en/trunk/reference/inclued/ examples.xml ini.xml
| From: | Philip Olson | Date: | Wed, 15 Sep 2010 22:17:18 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/inclued/ examples.xml ini.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-7120@lists.php.net to get a copy of this message | ||
philip Wed, 15 Sep 2010 22:17:18 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=303409
Log:
Added an example that lists inclued files, and clarified the inclued.dumpdir description
Changed paths:
U phpdoc/en/trunk/reference/inclued/examples.xml
U phpdoc/en/trunk/reference/inclued/ini.xml
Modified: phpdoc/en/trunk/reference/inclued/examples.xml
===================================================================
--- phpdoc/en/trunk/reference/inclued/examples.xml 2010-09-15 22:11:28 UTC (rev 303408)
+++ phpdoc/en/trunk/reference/inclued/examples.xml 2010-09-15 22:17:18 UTC (rev 303409)
@@ -12,7 +12,7 @@
</para>
<para>
<example>
- <title>Getting the data from inclued</title>
+ <title>Getting the data within the PHP application itself (function)</title>
<programlisting role="php">
<![CDATA[
<?php
@@ -55,6 +55,66 @@
</programlisting>
</example>
</para>
+ <para>
+ <example>
+ <title>Listing data via inclued dumps (configuration)</title>
+ <para>
+ When using the <link
linkend="ini.inclued.dumpdir">inclued.dumpdir</link>
+ directive, files (include clues) are dumped with every request. Here's one
+ way to list those files, and <function>unserialize</function> them.
+ </para>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$path = ini_get('inclued.dumpdir');
+if ($path && is_dir($path)) {
+
+ echo "Path: $path", PHP_EOL;
+
+ $inclues = new GlobIterator($path . DIRECTORY_SEPARATOR . 'inclued*');
+
+ if ($inclues->count() === 0) {
+ echo 'No clues today', PHP_EOL;
+ exit;
+ }
+
+ foreach ($inclues as $inclue) {
+
+ echo 'Inclued file: ', $inclue->getFilename(), PHP_EOL;
+
+ $data = file_get_contents($inclue->getPathname());
+ if ($data) {
+ $inc = unserialize($data);
+ echo ' -- filename: ',
$inc['request']['SCRIPT_FILENAME'], PHP_EOL;
+ echo ' -- number of includes: ', count($inc['includes']), PHP_EOL;
+ }
+ echo PHP_EOL;
+ }
+} else {
+ echo 'I am totally clueless today.', PHP_EOL;
+}
+?>
+]]>
+ </programlisting>
+ &example.outputs.similar;
+ <screen>
+<![CDATA[
+PATH: /tmp/inclued
+Inclued file: inclued.56521.1
+ -- filename: /Users/philip/test.php
+ -- number of includes: 1
+
+Inclued file: inclued.56563.1
+ -- filename: /tmp/none.php
+ -- number of includes: 0
+
+Inclued file: inclued.56636.1
+ -- filename: /tmp/three.php
+ -- number of includes: 3
+]]>
+ </screen>
+ </example>
+ </para>
</section>
</chapter>
Modified: phpdoc/en/trunk/reference/inclued/ini.xml
===================================================================
--- phpdoc/en/trunk/reference/inclued/ini.xml 2010-09-15 22:11:28 UTC (rev 303408)
+++ phpdoc/en/trunk/reference/inclued/ini.xml 2010-09-15 22:17:18 UTC (rev 303409)
@@ -63,7 +63,9 @@
<listitem>
<para>
Location (path) to the directory that stores inclued files. If set, each
- PHP request will create a file.
+ PHP request will create a file. These files are serialized versions of
+ what <function>inclued_get_data</function> would produce, so may be
+ unserialized with <function>unserialize</function>.
</para>
<caution>
<para>