framework/RedKiteCms/Tools/FilesystemTools.php
public static function readFile($file)
    {
        if (!file_exists($file)) {
            return null;
        }

        $handle = fopen($file, 'r');
        if (!self::lockFile($handle, LOCK_SH | LOCK_NB)) {
            $exception = array(
                "message" => 'exception_file_cannot_be_locked_for_reading',
                "parameters" => array(
                    "%file%" => basename($file),
                )
            );
            throw new RuntimeException(json_encode($exception));
        }

        $contents = file_get_contents($file);
        self::unlockFile($handle);

        return $contents;
    }
public static function readFile($file)
    {
        if (!file_exists($file)) {
            return null;
        }

        $handle = fopen($file, 'r');
        if (!self::lockFile($handle, LOCK_SH | LOCK_NB)) {
            $exception = array(
                "message" => 'exception_file_cannot_be_locked_for_reading',
                "parameters" => array(
                    "%file%" => basename($file),
                )
            );
            throw new RuntimeException(json_encode($exception));
        }

        $contents = file_get_contents($file);
        self::unlockFile($handle);

        return $contents;
    }
Reads and locks a file from the filesystem

@param $file

@return string