PMA\libraries\File::detectCompression PHP Method

detectCompression() protected method

Detects what compression the file uses
protected detectCompression ( ) : string | false
return string | false false on error, otherwise string MIME type of compression, none for none
    protected function detectCompression()
    {
        // suppress warnings from being displayed, but not from being logged
        // f.e. any file access outside of open_basedir will issue a warning
        ob_start();
        $file = fopen($this->getName(), 'rb');
        ob_end_clean();
        if (!$file) {
            $this->_error_message = Message::error(__('File could not be read!'));
            return false;
        }
        /**
        * @todo
        * get registered plugins for file compression
        
                foreach (PMA_getPlugins($type = 'compression') as $plugin) {
           if ($plugin['classname']::canHandle($this->getName())) {
               $this->setCompressionPlugin($plugin);
               break;
           }
                }
        */
        $this->_compression = Util::getCompressionMimeType($file);
        return $this->_compression;
    }