mirror of
https://github.com/php/doc-es.git
synced 2026-03-26 00:12:06 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@327478 c90b9560-bf6c-de11-be94-00142212c4b1
187 lines
5.6 KiB
XML
187 lines
5.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: d1d11ef7fa6e705dec67a2269204778c0e74887f Maintainer: seros Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.clearstatcache">
|
|
<refnamediv>
|
|
<refname>clearstatcache</refname>
|
|
<refpurpose>Limpia la caché de estado de un archivo</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>void</type><methodname>clearstatcache</methodname>
|
|
<methodparam choice="opt"><type>bool</type><parameter>clear_realpath_cache</parameter><initializer>false</initializer></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Cuando usa <function>stat</function>, <function>lstat</function>, o
|
|
cualquier otra función enumerada en la lista de funciones afectadas (abajo),
|
|
PHP examina la información que devuelven esas funciones para proporcionar
|
|
un rendimiento más rápido. Sin embargo, en ciertos casos, puede querer borrar la
|
|
información almacenada en caché. Por ejemplo, si el mismo archivo está siendo verificado
|
|
múltiples veces dentro de un sólo script, y ese archivo corre el peligro de
|
|
ser borrado o modificado durante la operación de ese script, puede optar por
|
|
limpiar la caché de estado. En estos casos, puede usar la función
|
|
<function>clearstatcache</function> para borrar la información
|
|
que PHP examina del archivo.
|
|
</para>
|
|
<para>
|
|
Debería observar también que PHP no examina información sobre archivos no
|
|
existentes. Por lo que si llama a <function>file_exists</function> con un archivo que
|
|
no existe, se devolverá &false; a menos que cree el archivo. Si crea
|
|
el archivo, se devolverá &true; incluso si después borra el archivo.
|
|
Sin embargo <function>unlink</function> limpia la caché automáticamente.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Esta función examina la información sobre nombres de archivos específicos, por lo que sólo
|
|
necesita llamar a <function>clearstatcache</function> si está llevando a cabo
|
|
múltiples operaciones sobre un mismo nombre de archivo y necesita que la información
|
|
sobre ese archivo en particular no sea examinada.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
Las funciones afectadas incluyen <function>stat</function>,
|
|
<function>lstat</function>,
|
|
<function>file_exists</function>,
|
|
<function>is_writable</function>,
|
|
<function>is_readable</function>,
|
|
<function>is_executable</function>,
|
|
<function>is_file</function>,
|
|
<function>is_dir</function>,
|
|
<function>is_link</function>,
|
|
<function>filectime</function>,
|
|
<function>fileatime</function>,
|
|
<function>filemtime</function>,
|
|
<function>fileinode</function>,
|
|
<function>filegroup</function>,
|
|
<function>fileowner</function>,
|
|
<function>filesize</function>,
|
|
<function>filetype</function>, y
|
|
<function>fileperms</function>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>clear_realpath_cache</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Si se limpia la caché de la ruta real o no.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>filename</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Limpia la ruta real y la caché de estadísticas para un nombre de fichero específico; solamente
|
|
se usa si <parameter>clear_realpath_cache</parameter> es &true;.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.void;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>5.3.0</entry>
|
|
<entry>
|
|
Se añadieron los parámetros opcionales <parameter>clear_realpath_cache</parameter>
|
|
y <parameter>filename</parameter>.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de <function>clearstatcache</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$archivo = 'output_log.txt';
|
|
|
|
function obtener_propietario($archivo)
|
|
{
|
|
$estadísticas = stat($archivo);
|
|
$usuario = posix_getpwuid($estadísticas['uid']);
|
|
return $usuario['name'];
|
|
}
|
|
|
|
$formato = "UID @ %s: %s\n";
|
|
|
|
printf($formato, date('r'), obtener_propietario($archivo));
|
|
|
|
chown($archivo, 'ross');
|
|
printf($formato, date('r'), obtener_propietario($archivo));
|
|
|
|
clearstatcache();
|
|
printf($formato, date('r'), obtener_propietario($archivo));
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
UID @ Sun, 12 Oct 2008 20:48:28 +0100: root
|
|
UID @ Sun, 12 Oct 2008 20:48:28 +0100: root
|
|
UID @ Sun, 12 Oct 2008 20:48:28 +0100: ross
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</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
|
|
-->
|