22
22
namespace Pydio \Access \Driver \StreamProvider \SMB ;
23
23
24
24
use DOMNode ;
25
+ use PclZip ;
26
+ use Pydio \Access \Core \MetaStreamWrapper ;
25
27
use Pydio \Access \Core \Model \AJXP_Node ;
28
+ use Pydio \Access \Core \Model \UserSelection ;
26
29
use Pydio \Access \Core \RecycleBinManager ;
27
30
use Pydio \Access \Core \Model \Repository ;
28
31
use Pydio \Access \Driver \StreamProvider \FS \FsAccessDriver ;
29
32
use Pydio \Core \Model \ContextInterface ;
30
33
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 ;
31
39
32
40
33
41
defined ('AJXP_EXEC ' ) or die ( 'Access not allowed ' );
@@ -47,6 +55,16 @@ class SMBAccessDriver extends FsAccessDriver
47
55
protected $ wrapperClassName ;
48
56
protected $ urlBase ;
49
57
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
+
50
68
/**
51
69
* @param ContextInterface $contextInterface
52
70
* @throws PydioException
@@ -59,13 +77,7 @@ protected function initRepository(ContextInterface $contextInterface)
59
77
} else {
60
78
$ this ->driverConf = array ();
61
79
}
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 ();
69
81
70
82
//$create = $this->repository->getOption("CREATE");
71
83
$ recycle = $ this ->repository ->getContextOption ($ contextInterface , "RECYCLE_BIN " );
@@ -92,7 +104,7 @@ protected function initRepository(ContextInterface $contextInterface)
92
104
public function detectStreamWrapper ($ register = false , ContextInterface $ ctx = null )
93
105
{
94
106
if ($ register ) {
95
- require_once ( $ this ->getBaseDir (). " /smb.php " );
107
+ $ this ->loadExternalWrapper ( );
96
108
}
97
109
return parent ::detectStreamWrapper ($ register , $ ctx );
98
110
}
0 commit comments