public function isLocked($recover = true) {
        $myPid = getmypid();
        if (!file_exists($this->pidFile)) {
            return false;
        }

        $lockPid = trim(file_get_contents($this->pidFile));

        // This is my lockfile, nothing to do
        if ($myPid == $lockPid) {
            return false;
        }

        // Is the PID running?
        $isRunning = $this->isProcessRunning($lockPid);

        // No? Unlock and return Locked=false
        if (!$isRunning) {
            if ($recover) {
                $this->unlock($this->pidFile);
            }
            return false;
        }

        // Someone else is already running
        return true;
    }
public function isLocked($recover = true) {
        $myPid = getmypid();
        if (!file_exists($this->pidFile)) {
            return false;
        }

        $lockPid = trim(file_get_contents($this->pidFile));

        // This is my lockfile, nothing to do
        if ($myPid == $lockPid) {
            return false;
        }

        // Is the PID running?
        $isRunning = $this->isProcessRunning($lockPid);

        // No? Unlock and return Locked=false
        if (!$isRunning) {
            if ($recover) {
                $this->unlock($this->pidFile);
            }
            return false;
        }

        // Someone else is already running
        return true;
    }
public function isLocked ( $ recover = true ) { $ myPid = getmypid ( ) ; if ( ! file_exists ( $ this -> pidFile ) ) { return false ; } $ lockPid = trim ( file_get_contents ( $ this -> pidFile ) ) ; // This is my lockfile, nothing to do if ( $ myPid == $ lockPid ) { return false ; } // Is the PID running? $ isRunning = $ this -> isProcessRunning ( $ lockPid ) ; // No? Unlock and return Locked=false if ( ! $ isRunning ) { if ( $ recover ) { $ this -> unlock ( $ this -> pidFile ) ; } return false ; } // Someone else is already running return true ; }
Check if this lockFile corresponds to a locked process

@param boolean $recover
@return boolean
Check if this lockFile corresponds to a locked process