@@ -64,26 +64,14 @@ public function getPath($readonly = false)
6464 $ tmp_dir = rtrim ($ tmp_dir , '/ ' ) . DIRECTORY_SEPARATOR ;
6565
6666 if (empty ($ this ->config [ 'path ' ]) || !is_string ($ this ->config [ 'path ' ])) {
67- if (self ::isPHPModule ()) {
68- $ path = $ tmp_dir ;
69- } else {
70- $ document_root_path = rtrim ($ _SERVER [ 'DOCUMENT_ROOT ' ], '/ ' ) . '/../ ' ;
71- $ path = isset ($ _SERVER [ 'DOCUMENT_ROOT ' ]) && is_writable ($ document_root_path ) ? $ document_root_path : rtrim (__DIR__ , '/ ' ) . DIRECTORY_SEPARATOR ;
72- }
73-
74- if ($ this ->config [ 'path ' ] != '' ) {
75- $ path = $ this ->config [ 'path ' ];
76- }
77-
67+ $ path = $ tmp_dir ;
7868 } else {
79- $ path = $ this ->config [ 'path ' ];
69+ $ path = rtrim ( $ this ->config [ 'path ' ], ' / ' ) . DIRECTORY_SEPARATOR ;
8070 }
8171
82- $ full_path = rtrim ($ path , '/ ' )
83- . DIRECTORY_SEPARATOR
84- . $ securityKey
85- . DIRECTORY_SEPARATOR
86- . $ this ->getDriverName ();
72+ $ path_suffix = $ securityKey . DIRECTORY_SEPARATOR . $ this ->getDriverName ();
73+ $ full_path = $ path . $ path_suffix ;
74+ $ full_path_tmp = $ tmp_dir . $ path_suffix ;
8775 $ full_path_hash = md5 ($ full_path );
8876
8977 /**
@@ -94,7 +82,7 @@ public function getPath($readonly = false)
9482 */
9583 if ($ readonly === true ) {
9684 if ($ this ->config [ 'autoTmpFallback ' ] && (!@file_exists ($ full_path ) || !@is_writable ($ full_path ))){
97- return $ tmp_dir ;
85+ return $ full_path_tmp ;
9886 }
9987 return $ full_path ;
10088 }else {
@@ -110,7 +98,7 @@ public function getPath($readonly = false)
11098 * Switch back to tmp dir
11199 * again if the path is not writable
112100 */
113- $ full_path = $ tmp_dir ;
101+ $ full_path = $ full_path_tmp ;
114102 if (!@file_exists ($ full_path )) {
115103 @mkdir ($ full_path , $ this ->setChmodAuto (), true );
116104 }
0 commit comments