frontend/modules/elfind/src/elFinderVolumeLocalFileSystem.class.php
/**
     * Prepare driver before mount volume.
     * Return true if volume is ready.
     *
     * @return bool
     **/
Prepare driver before mount volume.
Return true if volume is ready.

@return bool
Prepare driver before mount volume . Return true if volume is ready . @return bool
protected function init()
    {
        if (DIRECTORY_SEPARATOR !== '/') {
            foreach (array('path', 'tmbPath', 'tmpPath', 'quarantine') as $key) {
                if (!empty($this->options[$key])) {
                    $this->options[$key] = str_replace('/', DIRECTORY_SEPARATOR, $this->options[$key]);
                }
            }
        }
        if (!$cwd = getcwd()) {
            return $this->setError('elFinder LocalVolumeDriver requires a result of getcwd().');
        }
        if (!isset($this->options['systemRoot'])) {
            if ($cwd[0] === $this->separator || $this->root[0] === $this->separator) {
                $this->systemRoot = $this->separator;
            } else if (preg_match('/^([a-zA-Z]:' . preg_quote($this->separator, '/') . ')/', $this->root, $m)) {
                $this->systemRoot = $m[1];
            } else if (preg_match('/^([a-zA-Z]:' . preg_quote($this->separator, '/') . ')/', $cwd, $m)) {
                $this->systemRoot = $m[1];
            }
        }
        $this->root = $this->getFullPath($this->root, $cwd);
        if (!empty($this->options['startPath'])) {
            $this->options['startPath'] = $this->getFullPath($this->options['startPath'], $cwd);
        }
        if (is_null($this->options['syncChkAsTs'])) {
            $this->options['syncChkAsTs'] = true;
        }
        if (is_null($this->options['syncCheckFunc'])) {
            $this->options['syncCheckFunc'] = array($this, 'localFileSystemInotify');
        }
        return true;
    }
protected function init ( ) { if ( DIRECTORY_SEPARATOR !== '/' ) { foreach ( array ( 'path' , 'tmbPath' , 'tmpPath' , 'quarantine' ) as $ key ) { if ( ! empty ( $ this -> options [ $ key ] ) ) { $ this -> options [ $ key ] = str_replace ( '/' , DIRECTORY_SEPARATOR , $ this -> options [ $ key ] ) ; } } } if ( ! $ cwd = getcwd ( ) ) { return $ this -> setError ( 'elFinder LocalVolumeDriver requires a result of getcwd().' ) ; } if ( ! isset ( $ this -> options [ 'systemRoot' ] ) ) { if ( $ cwd [ 0 ] === $ this -> separator || $ this -> root [ 0 ] === $ this -> separator ) { $ this -> systemRoot = $ this -> separator ; } else if ( preg_match ( '/^([a-zA-Z]:' . preg_quote ( $ this -> separator , '/' ) . ')/' , $ this -> root , $ m ) ) { $ this -> systemRoot = $ m [ 1 ] ; } else if ( preg_match ( '/^([a-zA-Z]:' . preg_quote ( $ this -> separator , '/' ) . ')/' , $ cwd , $ m ) ) { $ this -> systemRoot = $ m [ 1 ] ; } } $ this -> root = $ this -> getFullPath ( $ this -> root , $ cwd ) ; if ( ! empty ( $ this -> options [ 'startPath' ] ) ) { $ this -> options [ 'startPath' ] = $ this -> getFullPath ( $ this -> options [ 'startPath' ] , $ cwd ) ; } if ( is_null ( $ this -> options [ 'syncChkAsTs' ] ) ) { $ this -> options [ 'syncChkAsTs' ] = true ; } if ( is_null ( $ this -> options [ 'syncCheckFunc' ] ) ) { $ this -> options [ 'syncCheckFunc' ] = array ( $ this , 'localFileSystemInotify' ) ; } return true ; }
Prepare driver before mount volume.
Prepare driver before mount volume .
// Normalize directory separator for windows // detect systemRoot