/** * Lock the database file * * @return boolean */ private static function lock() { if (self::$currentlylocked === false) { self::$authFileP = fopen(self::$authFile, "a+"); if (flock(self::$authFileP, LOCK_EX)) { self::$currentlylocked = true; } else { throw new Exception('Unable to lock file'); } } return true; }