protected function netmount($args)
{
$options = array();
$protocol = $args['protocol'];
$driver = isset(self::$netDrivers[$protocol]) ? $protocol : '';
$class = 'elfindervolume' . $protocol;
if (!$driver) {
return array('error' => $this->error(self::ERROR_NETMOUNT, $args['host'], self::ERROR_NETMOUNT_NO_DRIVER));
}
if (!$args['path']) {
$args['path'] = '/';
}
foreach ($args as $k => $v) {
if ($k != 'options' && $k != 'protocol' && $v) {
$options[$k] = $v;
}
}
if (is_array($args['options'])) {
foreach ($args['options'] as $key => $value) {
$options[$key] = $value;
}
}
$volume = new $class();
if ($volume->mount($options)) {
$netVolumes = $this->getNetVolumes();
$options['driver'] = $driver;
$netVolumes[] = $options;
$netVolumes = array_unique($netVolumes);
$this->saveNetVolumes($netVolumes);
return array('sync' => true);
} else {
return array('error' => $this->error(self::ERROR_NETMOUNT, $args['host'], implode(' ', $volume->error())));
}
}