private function updateFile($filename)
        {
                // fetch remote file:
                $file_contents = $this->fetchUrl(self::DOWNLOAD_BASE_URL.$filename);

        if ($file_contents === false) return false;

        if (sha1($file_contents) != $this->getCurrentFileHash($filename)) {
            try {
                throw new Exception("PHPIDS-Update: SHA1-hash of the downloaded file ($filename) is incorrect! (Download failed or Man-in-the-Middle). SHA1 of the file in the trunk: ".sha1($file_contents).", SHA1, provided by phpids.org: ".$this->getCurrentFileHash($filename));
            } catch (Exception $e) {
                return false;
            }
                }

                if (strlen($file_contents) <= 100) {
                        return false;
                }

                // overwrite file contents
                if (!file_put_contents($this->phpids_base.$filename, $file_contents)) {
                        return false;
                }

                return true;
        }
private function updateFile($filename)
        {
                // fetch remote file:
                $file_contents = $this->fetchUrl(self::DOWNLOAD_BASE_URL.$filename);

        if ($file_contents === false) return false;

        if (sha1($file_contents) != $this->getCurrentFileHash($filename)) {
            try {
                throw new Exception("PHPIDS-Update: SHA1-hash of the downloaded file ($filename) is incorrect! (Download failed or Man-in-the-Middle). SHA1 of the file in the trunk: ".sha1($file_contents).", SHA1, provided by phpids.org: ".$this->getCurrentFileHash($filename));
            } catch (Exception $e) {
                return false;
            }
                }

                if (strlen($file_contents) <= 100) {
                        return false;
                }

                // overwrite file contents
                if (!file_put_contents($this->phpids_base.$filename, $file_contents)) {
                        return false;
                }

                return true;
        }
private function updateFile ( $ filename ) { // fetch remote file: $ file_contents = $ this -> fetchUrl ( self :: DOWNLOAD_BASE_URL . $ filename ) ; if ( $ file_contents === false ) return false ; if ( sha1 ( $ file_contents ) != $ this -> getCurrentFileHash ( $ filename ) ) { try { throw new Exception ( "PHPIDS-Update: SHA1-hash of the downloaded file ($filename) is incorrect! (Download failed or Man-in-the-Middle). SHA1 of the file in the trunk: " . sha1 ( $ file_contents ) . ", SHA1, provided by phpids.org: " . $ this -> getCurrentFileHash ( $ filename ) ) ; } catch ( Exception $ e ) { return false ; } } if ( strlen ( $ file_contents ) <= 100 ) { return false ; } // overwrite file contents if ( ! file_put_contents ( $ this -> phpids_base . $ filename , $ file_contents ) ) { return false ; } return true ; }
Download current file and replaces local

@param string FILENAME_RULES or FILENAME_CONVERTER
Download current file and replaces local