Пример #1
0
 public static function release_lockfile()
 {
     $f3 = \Base::instance();
     $lock_file = realpath($f3->get('FILE')) . ".lock";
     $pid = self::get_lock_file();
     if ($pid == getmypid() or !self::isrunning($pid, FALSE)) {
         if (is_file($lock_file) && unlink($lock_file)) {
             My::function_debug(__CLASS__, __FUNCTION__, "OK!");
             return TRUE;
         } else {
             My::function_debug(__CLASS__, __FUNCTION__, "{$lock_file} could NOT be released, check permissions etc....", "error");
             return FALSE;
         }
     }
     if ($pid) {
         My::function_debug(__CLASS__, __FUNCTION__, "{$lock_file} not mine and still running. My pid=" . getmypid() . ".", "warn");
         return TRUE;
     }
     My::function_debug(__CLASS__, __FUNCTION__, "{$lock_file} does not exist. Nothing to release...");
     return TRUE;
 }