Files
php-doc-ru/reference/filesystem/functions/umask.xml
2023-12-25 10:44:35 +03:00

129 lines
3.9 KiB
XML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: ea62fb83196997032641b50fe44420305466195e Maintainer: shein Status: ready -->
<!-- Reviewed: no -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.umask">
<refnamediv>
<refname>umask</refname>
<refpurpose>Изменяет текущую маску прав доступа для вновь созданных файлов и каталогов (umask)</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>umask</methodname>
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>mask</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<para>
Функция <function>umask</function> устанавливает применяемую PHP
по умолчанию umask в значение параметра <parameter>mask</parameter> &amp; 0777 и возвращает
старую umask. Если PHP работает как серверный модуль,
umask будет восстанавливаться после окончания каждого запроса.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>mask</parameter></term>
<listitem>
<para>
Новая umask.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Если параметр <parameter>mask</parameter> равен &null;,
функция <function>umask</function> просто возвращает текущую umask,
иначе возвращается старая umask.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.0.0</entry>
<entry>
Параметр <parameter>mask</parameter> теперь может принимать значение &null;.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Пример использования функции <function>umask</function></title>
<programlisting role="php">
<![CDATA[
<?php
$old = umask(0);
chmod("/path/some_dir/some_file.txt", 0755);
umask($old);
// Проверка
if ($old != umask()) {
die('При восстановлении umask произошла ошибка');
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
Избегайте вызова этой функции на многопоточных веб-серверах.
Лучше изменить права созданного файла функцией <function>chmod</function>.
Функция <function>umask</function>
может вызвать неожиданное поведение одновременно работающих
скриптов и самого веб-сервера, т. к. они все будут использовать
одну и ту же umask.
</para>
</note>
</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
-->