<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.filesystem.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'pt_BR',
  ),
  'this' => 
  array (
    0 => 'function.umask.php',
    1 => 'umask',
    2 => 'Modificar a umask atual',
  ),
  'up' => 
  array (
    0 => 'ref.filesystem.php',
    1 => 'Fun&ccedil;&otilde;es de Filesystem',
  ),
  'prev' => 
  array (
    0 => 'function.touch.php',
    1 => 'touch',
  ),
  'next' => 
  array (
    0 => 'function.unlink.php',
    1 => 'unlink',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'pt_BR',
    'path' => 'reference/filesystem/functions/umask.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.umask" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">umask</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">umask</span> &mdash; <span class="dc-title">Modificar a umask atual</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.umask-description">
  <h3 class="title">Descrição</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>umask</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$mask</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>umask()</strong></span> modifica o umask do PHP para a
   <code class="parameter">mask</code> &amp; 0777 e retorna o umask
   antigo. Quando o PHP está sendo usado como um módulo de servidor, o umask
   é restaurado ao final de cada requisição.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.umask-parameters">
  <h3 class="title">Parâmetros</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">mask</code></dt>
     <dd>
      <p class="para">
       A nova máscara.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.umask-returnvalues">
  <h3 class="title">Valor Retornado</h3>
  <p class="para">
   Se <code class="parameter">mask</code> for <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, <span class="function"><strong>umask()</strong></span>
   simplesmente retorna a umask atual senão a umask antiga é retornada.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.umask-changelog">
  <h3 class="title">Registro de Alterações</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Versão</th>
      <th>Descrição</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">mask</code> agora pode ser nulo.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.umask-examples">
  <h3 class="title">Exemplos</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemplo #1 Exemplo da <span class="function"><strong>umask()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$umaskAntigo </span><span style="color: #007700">= </span><span style="color: #0000BB">umask</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">chmod</span><span style="color: #007700">(</span><span style="color: #DD0000">"/caminho/diretorio/arquivo.txt"</span><span style="color: #007700">, </span><span style="color: #0000BB">0755</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">umask</span><span style="color: #007700">(</span><span style="color: #0000BB">$umaskAntigo</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Checking<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">$umaskAntigo </span><span style="color: #007700">!= </span><span style="color: #0000BB">umask</span><span style="color: #007700">()) {<br />    die(</span><span style="color: #DD0000">'Ocorreu um erro ao voltar para o umask antigo'</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.umask-notes">
  <h3 class="title">Notas</h3>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <p class="para">
    Evite usar esta função em servidores web multithreaded. É melhor modificar
    as permissões do arquivo com <span class="function"><a href="function.chmod.php" class="function">chmod()</a></span> depois
    de criar o arquivo. Usando <span class="function"><strong>umask()</strong></span> pode levar a
    comportamento inesperado de scripts executados concorrentemente e do próprio
    webserver porque todos eles usam a mesma umask.
   </p>
  </p></blockquote>
 </div>


</div><?php manual_footer($setup); ?>