-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathstat.xml
249 lines (235 loc) · 6.25 KB
/
stat.xml
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 8b5940cadeb4f1c8492f4a7f70743a2be807cf39 Maintainer: seros Status: ready -->
<!-- Reviewed: no -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.stat">
<refnamediv>
<refname>stat</refname>
<refpurpose>Da información acerca de un fichero</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>stat</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
Reúne las estadísticas del fichero nombrado por
<parameter>filename</parameter>. Si <parameter>filename</parameter> es un
enlace simbólico, las estadísticas son las del fichero mismo, no las del enlace simbólico.
</para>
<para>
<function>lstat</function> es idéntica a <function>stat</function>
excepto que está basada en el estado de los enlaces simbólicos.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
Ruta del fichero.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<table>
<title>Formato del resultado de <function>stat</function> y
<function>fstat</function></title>
<tgroup cols="3">
<thead>
<row>
<entry>Numérico</entry>
<entry>Asociativo</entry>
<entry>Descripción</entry>
</row>
</thead>
<tbody>
<row>
<entry>0</entry>
<entry>dev</entry>
<entry>número de dispositivo</entry>
</row>
<row>
<entry>1</entry>
<entry>ino</entry>
<entry>número de i-nodo *</entry>
</row>
<row>
<entry>2</entry>
<entry>mode</entry>
<entry>modo de protección del i-nodo</entry>
</row>
<row>
<entry>3</entry>
<entry>nlink</entry>
<entry>número de enlaces</entry>
</row>
<row>
<entry>4</entry>
<entry>uid</entry>
<entry>ID de usuario del propietario *</entry>
</row>
<row>
<entry>5</entry>
<entry>gid</entry>
<entry>ID de grupo del propietario *</entry>
</row>
<row>
<entry>6</entry>
<entry>rdev</entry>
<entry>tipo de dispositivo, si es un dispositivo i-nodo</entry>
</row>
<row>
<entry>7</entry>
<entry>size</entry>
<entry>tamaño en bytes</entry>
</row>
<row>
<entry>8</entry>
<entry>atime</entry>
<entry>momento del último acceso (tiempo Unix)</entry>
</row>
<row>
<entry>9</entry>
<entry>mtime</entry>
<entry>momento de la última modificación (tiempo Unix)</entry>
</row>
<row>
<entry>10</entry>
<entry>ctime</entry>
<entry>momento de la última modificación del i-nodo (tiempo Unix)</entry>
</row>
<row>
<entry>11</entry>
<entry>blksize</entry>
<entry>tamaño del bloque E/S del sistema de ficheros **</entry>
</row>
<row>
<entry>12</entry>
<entry>blocks</entry>
<entry>número de bloques de 512 bytes asignados **</entry>
</row>
</tbody>
</tgroup>
</table>
* en Windows esto siempre será 0.
</para>
<para>
** Sólo válido para sistemas que soportan el tipo st_blksize type - otros
sistemas (p.ej. Windows) devuelven -1.
</para>
<para>
En caso de que se produzca un error, <function>stat</function> devuelve &false;.
</para>
&fs.file.32bit;
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
Si falla, se emite un <constant>E_WARNING</constant>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Ejemplo de <function>stat</function></title>
<programlisting role="php">
<![CDATA[
<?php
/* Obtener las estadísticas de un fichero */
$estadísticas = stat('C:\php\php.exe');
/*
* Imprime el momento de acceso del fichero,
* esto es lo mismo que llamar a fileatime()
*/
echo 'Momento de acceso: ' . $estadísticas['atime'];
/*
* Imprime el momento de modificación del fichero,
* esto es lo mismo que llamar a filemtime()
*/
echo 'Momento de modificación: ' . $estadísticas['mtime'];
/* Imprime el número de dispositivo */
echo 'Número de dispositivo: ' . $estadísticas['dev'];
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Usar la información de <function>stat</function> junto con <function>touch</function></title>
<programlisting role="php">
<![CDATA[
<?php
/* Obtener las estadísticas del fichero */
$estadísticas = @stat('C:\php\php.exe');
/* ¿Falló al obtener la información de stat? */
if(!$estadísticas) {
echo 'La llamada a stat() falló...';
} else {
/*
* Queremos que el tiempo de acceso sea 1 semana
* después que el tiempo de acceso actual.
*/
$atime = $estadísticas['atime'] + 604800;
/* Afectar el fichero */
if(!@touch('fichero.txt', time(), $atime)) {
echo 'Falló al afectar el fichero...';
} else {
echo 'touch() devolvió con éxito...';
}
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
¬e.filesystem-time-res;
¬e.clearstatcache;
&tip.fopen-wrapper.stat;
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>lstat</function></member>
<member><function>fstat</function></member>
<member><function>filemtime</function></member>
<member><function>filegroup</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- 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:"~/.phpdoc/manual.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
-->