PclZip::privCheckFormat PHP Method

privCheckFormat() public method

--------------------------------------------------------------------------------
public privCheckFormat ( $p_level )
    public function privCheckFormat($p_level = 0)
    {
        $v_result = true;
        // ----- Reset the file system cache
        clearstatcache();
        // ----- Reset the error handler
        $this->privErrorReset();
        // ----- Look if the file exits
        if (!is_file($this->zipname)) {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '" . $this->zipname . "'");
            return false;
        }
        // ----- Check that the file is readeable
        if (!is_readable($this->zipname)) {
            // ----- Error log
            PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '" . $this->zipname . "'");
            return false;
        }
        // ----- Check the magic code
        // TBC
        // ----- Check the central header
        // TBC
        // ----- Check each file header
        // TBC
        // ----- Return
        return $v_result;
    }

Usage Example

コード例 #1
0
 public static function ZipTest($from_file)
 {
     $zip = new PclZip($from_file);
     return $zip->privCheckFormat() === true;
     /*
     if (class_exists('ZipArchive', false)) {
     	$zip = new ZipArchive();
     	return ($zip->open($from_file, ZIPARCHIVE::CHECKCONS) === true);
     }
     else {
     	$zip = new PclZip($from_file);
     	return ($zip->privCheckFormat() === true);
     }
     */
 }
All Usage Examples Of PclZip::privCheckFormat