Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 61e90bc

Browse files
committed
Fix SMB access driver and custom smbclient path. Close #1290
1 parent 1a69423 commit 61e90bc

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

core/src/plugins/access.smb/SMBAccessDriver.php

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,20 @@
2222
namespace Pydio\Access\Driver\StreamProvider\SMB;
2323

2424
use DOMNode;
25+
use PclZip;
26+
use Pydio\Access\Core\MetaStreamWrapper;
2527
use Pydio\Access\Core\Model\AJXP_Node;
28+
use Pydio\Access\Core\Model\UserSelection;
2629
use Pydio\Access\Core\RecycleBinManager;
2730
use Pydio\Access\Core\Model\Repository;
2831
use Pydio\Access\Driver\StreamProvider\FS\FsAccessDriver;
2932
use Pydio\Core\Model\ContextInterface;
3033
use Pydio\Core\Exception\PydioException;
34+
use Pydio\Core\Services\ConfService;
35+
use Pydio\Core\Utils\TextEncoder;
36+
use Pydio\Core\Utils\Vars\InputFilter;
37+
use Pydio\Tasks\Task;
38+
use Pydio\Tasks\TaskService;
3139

3240

3341
defined('AJXP_EXEC') or die( 'Access not allowed');
@@ -47,6 +55,16 @@ class SMBAccessDriver extends FsAccessDriver
4755
protected $wrapperClassName;
4856
protected $urlBase;
4957

58+
protected function loadExternalWrapper(){
59+
if(!empty($this->pluginConf['SMBCLIENT']) && !defined('SMB4PHP_SMBCLIENT')){
60+
define ('SMB4PHP_SMBCLIENT', $this->pluginConf["SMBCLIENT"]);
61+
}
62+
if(!empty($this->pluginConf['SMB_PATH_TMP']) && !defined('SMB_PATH_TMP')){
63+
define ('SMB4PHP_SMBTMP', $this->pluginConf["SMB_PATH_TMP"]);
64+
}
65+
require_once($this->getBaseDir()."/smb.php");
66+
}
67+
5068
/**
5169
* @param ContextInterface $contextInterface
5270
* @throws PydioException
@@ -59,13 +77,7 @@ protected function initRepository(ContextInterface $contextInterface)
5977
} else {
6078
$this->driverConf = array();
6179
}
62-
$smbclientPath = $this->driverConf["SMBCLIENT"];
63-
define ('SMB4PHP_SMBCLIENT', $smbclientPath);
64-
65-
$smbtmpPath = $this->driverConf["SMB_PATH_TMP"];
66-
define ('SMB4PHP_SMBTMP', $smbtmpPath);
67-
68-
require_once($this->getBaseDir()."/smb.php");
80+
$this->loadExternalWrapper();
6981

7082
//$create = $this->repository->getOption("CREATE");
7183
$recycle = $this->repository->getContextOption($contextInterface, "RECYCLE_BIN");
@@ -92,7 +104,7 @@ protected function initRepository(ContextInterface $contextInterface)
92104
public function detectStreamWrapper($register = false, ContextInterface $ctx = null)
93105
{
94106
if ($register) {
95-
require_once($this->getBaseDir()."/smb.php");
107+
$this->loadExternalWrapper();
96108
}
97109
return parent::detectStreamWrapper($register, $ctx);
98110
}

0 commit comments

Comments
 (0)