cvs: peardoc /en/core system.xml
| From: | Thomas V.V.Cox | Date: | Sat, 16 Feb 2002 14:54:46 +0000 |
| Subject: | cvs: peardoc /en/core system.xml | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-2452@lists.php.net to get a copy of this message | ||
cox Sat Feb 16 09:54:46 2002 EDT
Modified files:
/peardoc/en/core system.xml
Log:
Doc enhance according to the lastest changes
Index: peardoc/en/core/system.xml
diff -u peardoc/en/core/system.xml:1.4 peardoc/en/core/system.xml:1.5
--- peardoc/en/core/system.xml:1.4 Sun Feb 10 18:00:43 2002
+++ peardoc/en/core/system.xml Sat Feb 16 09:54:45 2002
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
<reference id="core.system">
<title>PEAR System</title>
@@ -20,9 +20,29 @@
The <classname>System</classname> functions are called like there
commandline pendants
<programlisting role="php">
- System::rm('-r file1 dir1');
+ <![CDATA[
+if (!System::rm('-r file1 dir1')) {
+ print "Could not delete all the files";
+}
+ ]]>
</programlisting>
+ The arguments of the functions can be introduced as string or an array:
+ <programlisting role="php">
+ System::rm(array('-r', 'file1', 'dir1'));
+ </programlisting>
+ System works like any other PHP function and will return
+ <parameter>FALSE</parameter>,
+ when the operation could no be completed enterely or partially. System
+ won't stop when a error is found, it will try to continue. For example,
+ if you are trying to delete three files and the first one can't be deleted,
+ the next two files will be deleted but the function will return
+ <parameter>FALSE</parameter>.
</para>
+ <para>
+ Errors will be printed out using the PHP function trigger_error(), so all
+ the System methods can be silenced prefix a '@' sign before the function
+ call (for ex: @System::mkdir('-p dir1/dir2/dir3');).
+ </para>
</refsect1>
<refsect1 id="core.system.using.compatibility">
<title>Compatiblity</title>
@@ -33,7 +53,7 @@
of your operation system.
</para>
<para>
- At the moment the functions are tested under Linux and Win98. Further
+ At the moment the functions are tested under Linux and Windows. Further
reports about compatibility on other systems are welcome.
</para>
<warning>
@@ -47,7 +67,7 @@
<refsect1 id="core.system.using.manpages">
<title>Man Pages</title>
<para>
- This manual descripes the parameter of the <classname>System</classname>
+ This manual describes the parameters of the <classname>System</classname>
functions, most only a string. The arguments and options of the specific
command are <emphasis>not</emphasis> documented in the manual. Please take
a look on the man-pages on unix-like systems
@@ -92,8 +112,8 @@
<itemizedlist>
<listitem>
<para>
- <parameter>mixed</parameter> - <classname>PEAR_Error</classname> or
- <parameter>true</parameter> for success
+ <parameter>bool</parameter> - <parameter>true</parameter> or
+ <parameter>false</parameter> meaning success or not.
</para>
</listitem>
</itemizedlist>
@@ -133,8 +153,8 @@
<itemizedlist>
<listitem>
<para>
- <parameter>mixed</parameter> - <classname>PEAR_Error</classname> or
- <parameter>true</parameter> for success
+ <parameter>bool</parameter> - <parameter>true</parameter> or
+ <parameter>false</parameter> meaning success or not.
</para>
</listitem>
</itemizedlist>
@@ -150,7 +170,8 @@
<refentry id="core.system.cat">
<refnamediv>
<refname>System::cat()</refname>
- <refpurpose>concatenate files</refpurpose>
+ <refpurpose>concatenate files. It support also bash style
+ stdout redirections</refpurpose>
</refnamediv>
<refsect1 id="core.system.cat.desc">
<title>Description</title>
@@ -191,8 +212,12 @@
<title>Example</title>
<programlisting role="php">
<![CDATA[
+// Dump the contents of sample.txt and test.txt into the $var var
$var = System::cat('sample.txt test.txt');
+// Concatenate the contents of sample.txt and test.txt into final.txt
System::cat('sample.txt test.txt > final.txt');
+// Same as above but will append the contents to final.txt instead
+// of truncating it
System::cat('sample.txt test.txt >> final.txt');
]]>
</programlisting>
@@ -201,7 +226,7 @@
<refentry id="core.system.mktemp">
<refnamediv>
- <refname>System::mktemp()</refname>
+ <refname>System::mkTemp()</refname>
<refpurpose>creates temporal files or directories</refpurpose>
</refnamediv>
<refsect1 id="core.system.mktemp.desc">
@@ -235,11 +260,8 @@
<listitem>
<para>
<parameter>-t</parameter> - The target dir where the temporal
- file or dir will be created. If this param is missing by default the
- enviroment variables <parameter>TMP</parameter> on Windows or
- <parameter>TMPDIR</parameter> in Unix will be used. If these
- variables are also missing <parameter>c:\windows\temp</parameter>
- or <parameter>/tmp</parameter> will be used.
+ file or dir will be created. If this param is missing by default
+ <function>System::tmpDir</function> will be used to find it.
</para>
</listitem>
</itemizedlist>
@@ -257,7 +279,12 @@
</para>
</listitem>
</itemizedlist>
- </para>
+ </para>
+ <para>
+ The <function>mkTemp</function> will use internally
+ <function>System::tmpDir</function> to find the correct temporal
+ directory reading the properly system environment variables.
+ </para>
</refsect1>
<refsect1 id="core.system.mktemp.example">
<title>Example</title>
@@ -270,7 +297,66 @@
]]>
</programlisting>
</refsect1>
- </refentry>
+
+ </refentry>
+ <refentry id="core.system.type">
+ <refnamediv>
+ <refname>System::type()</refname>
+ <refpurpose>command for getting the full path of a program in
+ the PATH</refpurpose>
+ </refnamediv>
+ <refsect1 id="core.system.type.desc">
+ <title>Description</title>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>mixed <function>type</function></funcdef>
+ <paramdef>string <parameter>$args</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <para>
+ This command is taken from the internal bash one. It is equivalent to the "which"
+ Unix command in some systems.
+ </para>
+ <para>
+ Parameter
+ <itemizedlist>
+ <listitem>
+ <para>
+ <parameter>$string</parameter> - the program to search in the $PATH
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ Returns
+ <itemizedlist>
+ <listitem>
+ <para>
+ <parameter>mixed</parameter> - <parameter>string</parameter> the
+ full path of the given command or <parameter>false</parameter> if
+ the command wasn't found or has no execution perms.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ <ulink url="http://unixhelp.ed.ac.uk/CGI/man-cgi?type"><command>type</command>
+ man page</ulink>
+ </para>
+ </refsect1>
+ <refsect1 id="core.system.type.example">
+ <title>Example</title>
+ <programlisting role="php">
+ <![CDATA[
+// On Unix systems "grep" will be searched and in
+// Windows systems "grep.exe" instead
+$path = System::type("grep");
+// $path could contain something like "/usr/bin/grep"
+ ]]>
+ </programlisting>
+ </refsect1>
+
+ </refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables: