<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.gearmanclient.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'gearmanclient.dostatus.php',
    1 => 'GearmanClient::doStatus',
    2 => 'Get the status for the running task',
  ),
  'up' => 
  array (
    0 => 'class.gearmanclient.php',
    1 => 'GearmanClient',
  ),
  'prev' => 
  array (
    0 => 'gearmanclient.donormal.php',
    1 => 'GearmanClient::doNormal',
  ),
  'next' => 
  array (
    0 => 'gearmanclient.echo.php',
    1 => 'GearmanClient::echo',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/gearman/gearmanclient/dostatus.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="gearmanclient.dostatus" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">GearmanClient::doStatus</h1>
  <p class="verinfo">(PECL gearman &gt;= 0.5.0)</p><p class="refpurpose"><span class="refname">GearmanClient::doStatus</span> &mdash; <span class="dc-title">Get the status for the running task</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-gearmanclient.dostatus-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>GearmanClient::doStatus</strong></span>(): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="para rdfs-comment">
   Returns the status for the running task.  This should be used between repeated
   <span class="methodname"><a href="gearmanclient.donormal.php" class="methodname">GearmanClient::doNormal()</a></span> calls.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-gearmanclient.dostatus-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">У цієї функції немає
параметрів.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-gearmanclient.dostatus-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   An array representing the percentage completion given as a fraction, with the
   first element the numerator and the second element the denomintor.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-gearmanclient.dostatus-examples">
  <h3 class="title">Приклади</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Приклад #1 Get the status of a long running job</strong></p>
    <div class="example-contents"><p>
     The worker in this example has an artificial delay added during processing of the
     string to be reversed.  After each delay it calls <span class="methodname"><a href="gearmanjob.status.php" class="methodname">GearmanJob::status()</a></span>
     which the client then picks up.
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">"Starting\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000"># Create our client object.<br /></span><span style="color: #0000BB">$gmclient</span><span style="color: #007700">= new </span><span style="color: #0000BB">GearmanClient</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000"># Add default server (localhost).<br /></span><span style="color: #0000BB">$gmclient</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addServer</span><span style="color: #007700">();<br /><br />echo </span><span style="color: #DD0000">"Sending job\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000"># Send reverse job<br /></span><span style="color: #007700">do<br />{<br />  </span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #0000BB">$gmclient</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">doNormal</span><span style="color: #007700">(</span><span style="color: #DD0000">"reverse"</span><span style="color: #007700">, </span><span style="color: #DD0000">"Hello!"</span><span style="color: #007700">);<br /><br />  </span><span style="color: #FF8000"># Check for various return packets and errors.<br />  </span><span style="color: #007700">switch(</span><span style="color: #0000BB">$gmclient</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">returnCode</span><span style="color: #007700">())<br />  {<br />    case </span><span style="color: #0000BB">GEARMAN_WORK_DATA</span><span style="color: #007700">:<br />      break;<br />    case </span><span style="color: #0000BB">GEARMAN_WORK_STATUS</span><span style="color: #007700">:<br />      </span><span style="color: #FF8000"># get the current job status<br />      </span><span style="color: #007700">list(</span><span style="color: #0000BB">$numerator</span><span style="color: #007700">, </span><span style="color: #0000BB">$denominator</span><span style="color: #007700">)= </span><span style="color: #0000BB">$gmclient</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">doStatus</span><span style="color: #007700">();<br />      echo </span><span style="color: #DD0000">"Status: </span><span style="color: #0000BB">$numerator</span><span style="color: #DD0000">/</span><span style="color: #0000BB">$denominator</span><span style="color: #DD0000"> complete\n"</span><span style="color: #007700">;<br />      break;<br />    case </span><span style="color: #0000BB">GEARMAN_WORK_FAIL</span><span style="color: #007700">:<br />      echo </span><span style="color: #DD0000">"Failed\n"</span><span style="color: #007700">;<br />      exit;<br />    case </span><span style="color: #0000BB">GEARMAN_SUCCESS</span><span style="color: #007700">:<br />      break;<br />    default:<br />      echo </span><span style="color: #DD0000">"RET: " </span><span style="color: #007700">. </span><span style="color: #0000BB">$gmclient</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">returnCode</span><span style="color: #007700">() . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />      exit;<br />  }<br />}<br />while(</span><span style="color: #0000BB">$gmclient</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">returnCode</span><span style="color: #007700">() != </span><span style="color: #0000BB">GEARMAN_SUCCESS</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #DD0000">"Success: </span><span style="color: #0000BB">$result</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Поданий вище приклад виведе щось
схоже на:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Starting
Sending job
Status: 1/6 complete
Status: 2/6 complete
Status: 3/6 complete
Status: 4/6 complete
Status: 5/6 complete
Status: 6/6 complete
Success: !olleH</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-gearmanclient.dostatus-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="gearmanclient.donormal.php" class="methodname" rel="rdfs-seeAlso">GearmanClient::doNormal()</a> - Run a single task and return a result</span></li>
    <li><span class="methodname"><a href="gearmanjob.status.php" class="methodname" rel="rdfs-seeAlso">GearmanJob::status()</a> - Send status (deprecated)</span></li>
   </ul>
  </p>
 </div>


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