Elfinder-复制硬链接



我们移动大量大文件,这项工作是完美的,因为这是在实例中完成的,而无需复制文件。(只是移动指针)

,但有时我们需要从文件系统中的多个位置加入同一文件,今天我们复制该文件,但这需要很长时间并且正在储存,这是可以预期的,因为该文件已复制到磁盘上的另一个位置。所以我们不能抱怨:)

但是在我们的工作流中,我们实际上不必拥有多个文件,同一文件的多个指针就足够了。因此,硬链接模型对我们来说是理想的选择。如果可以更改Elfinder的复制功能的行为,那么这将非常有用,有人知道是否可能。?:)

通过扩展Elfindervolumelocalfilesystem类而成为可能。

class elFinderVolumeMyLocalFileSystem extends elFinderVolumeLocalFileSystem
{
    protected function _copy($source, $targetDir, $name) {
        $target = $this->_joinPath($targetDir, $name);
        if (! $ret = link($source, $target)) {
            return parent::_copy($source, $targetDir, $name);
        }
        return $ret;
    }
}
$opts = array(
    'locale' => '',
    'roots'  => array(
        array(
            'driver' => 'MyLocalFileSystem',
            'path'   => '/path/to/files/',
            'URL'    => 'http://localhost/to/files/'
        )
    )
);
// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();

最新更新