Beispiel #1
0
function spip_fclose_unlock($handle)
{
    if (_SPIP_LOCK_MODE == 1) {
        @flock($handle, LOCK_UN);
    } elseif (_SPIP_LOCK_MODE == 2) {
        spip_nfsunlock(reset($GLOBALS['liste_verrous'][$handle]), end($GLOBALS['liste_verrous'][$handle]));
        unset($GLOBALS['liste_verrous'][$handle]);
    }
    return @fclose($handle);
}
Beispiel #2
0
/**
 * Test a lock to see if it's still valid.
 *
 * Args, return codes, and behavior are identical to nfsunlock except
 * that nfslock_test doesn't remove the lock. NFSL_OK means the lock is
 * good, NFLS_LOST and NFSL_STOLEN means it's bad, and NFSL_SYSF means
 * we couldn't tell due to system failure.
 *
 * The source for this routine is almost identical to nfsunlock(), but it's
 * coded separately to make things as clear as possible.
 *
 * @author Alexis Rosen <alexis@panix.com>
 * @see spip_nfsunlock() about lost and stolen locks.
 *
 * @param string $fichier Chemin du fichier
 * @param bool $birth Timestamp de l'heure de création du verrou
 * @param int $max_age Age maximum du verrou
 * return bool true si déverrouillé, false sinon
 */
function spip_nfslock_test($fichier, $birth, $max_age = 0)
{
    return spip_nfsunlock($fichier, $birth, $max_age, true);
}