View Single Post
Old 03-12-2004, 03:04 PM   #1
Konstantine
Green Mole
 
Join Date: Mar 2004
Location: Russia
Posts: 21
Fixing spider.php, protecting from locking site after timeout or users stop

I found, that if your PHP has time out (for example 30 secs) and spider have no time to complete indexing, your site will be locked and you'll have to go back to admin and unlock it. It's not good, so next code fix it.

Add this code into spider.php file at the begining (from 12 line, after comments, for example):

PHP Code:
function Unlock()
{
  global $site_id, $id_connect, $run_mode, $mode;

  // unlock site if not normal terminate
if(connection_status())
{
  mysql_query('UPDATE '.PHPDIG_DB_PREFIX.'sites SET locked=0 WHERE site_id='.$site_id,$id_connect);
  print "<br />Site was unlocked<br />";

  if ($run_mode == 'http')
  { ?>
<hr />
<a href="index.php" >[<?php phpdigPrnMsg('back'?>]</a> <?php phpdigPrnMsg('to_admin'?>.
<?php
    
if (isset($mode) && isset($site_id) && $mode == 'small') {
      print 
'<br /><a href="update_frame.php?site_id='.$site_id.'" >['.phpdigMsg('back').']</a> '.phpdigMsg('to_update').'.';
    }
  } else {
      print 
$br;
  }
}

return;
}

register_shutdown_function("Unlock");
Hope, it will be in next versions and will help you!!!
Konstantine is offline   Reply With Quote