public function isFile($path = null, $md5 = null)
    {
        //====================================================================//
        // Safety Checks
        if (empty($path)) {
            return Splash::log()->err("ErrFileFileMissing", __FUNCTION__);
        }
        if (empty(dirname($path))) {
            return Splash::log()->err("ErrFileDirMissing", __FUNCTION__);
        }
        if (empty($md5)) {
            return Splash::log()->err("ErrFileMd5Missing", __FUNCTION__);
        }

        //====================================================================//
        // Check if folder exists
        if (!is_dir(dirname($path))) {
            return Splash::log()->war("ErrFileDirNoExists", __FUNCTION__, dirname($path));
        }
        //====================================================================//
        // Check if file exists
        if (!is_file($path)) {
            return Splash::log()->war("ErrFileNoExists", __FUNCTION__, $path);
        }
        //====================================================================//
        // Check File CheckSum => No Diff with Previous Error for Higher Safety Level
        if (md5_file($path) != $md5) {
            return Splash::log()->war("ErrFileNoExists", __FUNCTION__, $path);
        }

        //====================================================================//
        // Read file Informations
        Splash::log()->deb("Splash - Get File Infos : File ".$path." exists.");
        $infos = array();
        $owner = posix_getpwuid((int) fileowner($path));
        $infos["owner"] = $owner["name"];
        $infos["readable"] = is_readable($path);
        $infos["writable"] = is_writable($path);
        $infos["mtime"] = filemtime($path);
        $infos["modified"] = date("F d Y H:i:s.", (int) $infos["mtime"]);
        $infos["md5"] = md5_file($path);
        $infos["size"] = filesize($path);

        return $infos;
    }
public function isFile($path = null, $md5 = null)
    {
        //====================================================================//
        // Safety Checks
        if (empty($path)) {
            return Splash::log()->err("ErrFileFileMissing", __FUNCTION__);
        }
        if (empty(dirname($path))) {
            return Splash::log()->err("ErrFileDirMissing", __FUNCTION__);
        }
        if (empty($md5)) {
            return Splash::log()->err("ErrFileMd5Missing", __FUNCTION__);
        }

        //====================================================================//
        // Check if folder exists
        if (!is_dir(dirname($path))) {
            return Splash::log()->war("ErrFileDirNoExists", __FUNCTION__, dirname($path));
        }
        //====================================================================//
        // Check if file exists
        if (!is_file($path)) {
            return Splash::log()->war("ErrFileNoExists", __FUNCTION__, $path);
        }
        //====================================================================//
        // Check File CheckSum => No Diff with Previous Error for Higher Safety Level
        if (md5_file($path) != $md5) {
            return Splash::log()->war("ErrFileNoExists", __FUNCTION__, $path);
        }

        //====================================================================//
        // Read file Informations
        Splash::log()->deb("Splash - Get File Infos : File ".$path." exists.");
        $infos = array();
        $owner = posix_getpwuid((int) fileowner($path));
        $infos["owner"] = $owner["name"];
        $infos["readable"] = is_readable($path);
        $infos["writable"] = is_writable($path);
        $infos["mtime"] = filemtime($path);
        $infos["modified"] = date("F d Y H:i:s.", (int) $infos["mtime"]);
        $infos["md5"] = md5_file($path);
        $infos["size"] = filesize($path);

        return $infos;
    }
public function isFile ( $ path = null , $ md5 = null ) { //====================================================================// // Safety Checks if ( empty ( $ path ) ) { return Splash :: log ( ) -> err ( "ErrFileFileMissing" , __FUNCTION__ ) ; } if ( empty ( dirname ( $ path ) ) ) { return Splash :: log ( ) -> err ( "ErrFileDirMissing" , __FUNCTION__ ) ; } if ( empty ( $ md5 ) ) { return Splash :: log ( ) -> err ( "ErrFileMd5Missing" , __FUNCTION__ ) ; } //====================================================================// // Check if folder exists if ( ! is_dir ( dirname ( $ path ) ) ) { return Splash :: log ( ) -> war ( "ErrFileDirNoExists" , __FUNCTION__ , dirname ( $ path ) ) ; } //====================================================================// // Check if file exists if ( ! is_file ( $ path ) ) { return Splash :: log ( ) -> war ( "ErrFileNoExists" , __FUNCTION__ , $ path ) ; } //====================================================================// // Check File CheckSum => No Diff with Previous Error for Higher Safety Level if ( md5_file ( $ path ) != $ md5 ) { return Splash :: log ( ) -> war ( "ErrFileNoExists" , __FUNCTION__ , $ path ) ; } //====================================================================// // Read file Informations Splash :: log ( ) -> deb ( "Splash - Get File Infos : File " . $ path . " exists." ) ; $ infos = array ( ) ; $ owner = posix_getpwuid ( ( int ) fileowner ( $ path ) ) ; $ infos [ "owner" ] = $ owner [ "name" ] ; $ infos [ "readable" ] = is_readable ( $ path ) ; $ infos [ "writable" ] = is_writable ( $ path ) ; $ infos [ "mtime" ] = filemtime ( $ path ) ; $ infos [ "modified" ] = date ( "F d Y H:i:s." , ( int ) $ infos [ "mtime" ] ) ; $ infos [ "md5" ] = md5_file ( $ path ) ; $ infos [ "size" ] = filesize ( $ path ) ; return $ infos ; }
Check whether if a file exists or not

@param string $path Full Path to Local File
@param string $md5  Local File Checksum

@return array|bool $infos      0 if not found, else file informations array

File Information Array Structure
$infos["owner"]     =>  File Owner Name (Human Readable);
$infos["readable"]  =>  File is Readable;
$infos["writable"]  =>  File is writable;
$infos["mtime"]     =>  Last Modification TimeStamp;
$infos["modified"]  =>  Last Modification Date (Human Readable);
$infos["md5"]       =>  File MD5 Checksum
$infos["size"]      =>  File Size in bytes

@remark     For all file access functions, File Checksumm is used to ensure
the server who send request was allowed by local server to read
the specified file.
Check whether if a file exists or not