cvs: phpdoc /en/reference/filesystem/functions stat.xml touch.xml
| From: | Kalle Sommer Nielsen | Date: | Sun, 31 Aug 2008 22:45:32 +0000 |
| Subject: | cvs: phpdoc /en/reference/filesystem/functions stat.xml touch.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-2125@lists.php.net to get a copy of this message | ||
kalle Sun Aug 31 22:45:32 2008 UTC
Modified files:
/phpdoc/en/reference/filesystem/functions stat.xml touch.xml
Log:
Fix examples
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/filesystem/functions/stat.xml?r1=1.23&r2=1.24&diff_format=u
Index: phpdoc/en/reference/filesystem/functions/stat.xml
diff -u phpdoc/en/reference/filesystem/functions/stat.xml:1.23
phpdoc/en/reference/filesystem/functions/stat.xml:1.24
--- phpdoc/en/reference/filesystem/functions/stat.xml:1.23 Sun Aug 31 01:30:39 2008
+++ phpdoc/en/reference/filesystem/functions/stat.xml Sun Aug 31 22:45:31 2008
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.23 $ -->
+<!-- $Revision: 1.24 $ -->
<refentry xmlns="http://docbook.org/ns/docbook"
xml:id="function.stat">
<refnamediv>
<refname>stat</refname>
@@ -207,29 +207,26 @@
/* Did we failed to get stat information ? */
if(!$stat)
{
- die('Stat call failed, aborting...');
+ echo 'Stat call failed...';
}
-
-/*
- * Like in the example for touch() we'll need to
- * set the timezone to prevent E_STRICT errors in
- * PHP 5.1+
- */
-if(function_exists('date_default_timezone_set'))
-{
- date_default_timezone_set('UTC');
-}
-
-/* We want the access time to be 1 week ago */
-$atime = $stat['atime'] + 604800;
-
-/* Touch the file */
-if(!@touch('some_file.txt', time(), $atime))
+else
{
- die('Failed to touch file...');
+ /*
+ * We want the access time to be 1 week
+ * before the current access time.
+ */
+ $atime = $stat['atime'] + 604800;
+
+ /* Touch the file */
+ if(!@touch('some_file.txt', time(), $atime))
+ {
+ echo 'Failed to touch file...';
+ }
+ else
+ {
+ echo 'Touch returned success...';
+ }
}
-
-echo 'Touch returned success...';
?>
]]>
</programlisting>
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/filesystem/functions/touch.xml?r1=1.19&r2=1.20&diff_format=u
Index: phpdoc/en/reference/filesystem/functions/touch.xml
diff -u phpdoc/en/reference/filesystem/functions/touch.xml:1.19
phpdoc/en/reference/filesystem/functions/touch.xml:1.20
--- phpdoc/en/reference/filesystem/functions/touch.xml:1.19 Sun Aug 31 01:30:39 2008
+++ phpdoc/en/reference/filesystem/functions/touch.xml Sun Aug 31 22:45:31 2008
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.19 $ -->
+<!-- $Revision: 1.20 $ -->
<refentry xmlns="http://docbook.org/ns/docbook"
xml:id="function.touch">
<refnamediv>
<refname>touch</refname>
@@ -117,16 +117,7 @@
<![CDATA[
<?php
/*
- * First set the time zone if PHP 5.1+, this will
- * prevent any E_STRICT errors.
- */
-if(function_exists('date_default_timezone_set'))
-{
- date_default_timezone_set('UTC');
-}
-
-/*
- * Next is the touch time, we'll set it to one hour
+ * This is the touch time, we'll set it to one hour
* in the past.
*/
$time = time() - 3600;
@@ -134,10 +125,12 @@
/* Touch the file */
if(!touch('some_file.txt', $time))
{
- die('Whoops, something went wrong...');
+ echo 'Whoops, something went wrong...';
+}
+else
+{
+ echo 'Touched file with success';
}
-
-echo 'Touched file with success';
?>
]]>
</programlisting>