@@ 68-88 (lines=21) @@ | ||
65 | } |
|
66 | ||
67 | // try |
|
68 | foreach($path_candidate as $path) |
|
69 | { |
|
70 | // upload check file |
|
71 | if(!@ssh2_scp_send($connection, FileHandler::getRealPath('./files/cache/ftp_check'), $path . 'ftp_check.html')) |
|
72 | { |
|
73 | continue; |
|
74 | } |
|
75 | ||
76 | // get check file |
|
77 | $result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html'); |
|
78 | ||
79 | // delete temp check file |
|
80 | @ssh2_sftp_unlink($sftp, $path . 'ftp_check.html'); |
|
81 | ||
82 | // found |
|
83 | if($result == $pin) |
|
84 | { |
|
85 | $found_path = $path; |
|
86 | break; |
|
87 | } |
|
88 | } |
|
89 | ||
90 | FileHandler::removeFile('./files/cache/ftp_check', $pin); |
|
91 | ||
@@ 143-163 (lines=21) @@ | ||
140 | } |
|
141 | ||
142 | // try |
|
143 | foreach($path_candidate as $path) |
|
144 | { |
|
145 | // upload check file |
|
146 | if(!ftp_put($connection, $path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'), FTP_BINARY)) |
|
147 | { |
|
148 | continue; |
|
149 | } |
|
150 | ||
151 | // get check file |
|
152 | $result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html'); |
|
153 | ||
154 | // delete temp check file |
|
155 | ftp_delete($connection, $path . 'ftp_check.html'); |
|
156 | ||
157 | // found |
|
158 | if($result == $pin) |
|
159 | { |
|
160 | $found_path = $path; |
|
161 | break; |
|
162 | } |
|
163 | } |
|
164 | ||
165 | FileHandler::removeFile('./files/cache/ftp_check', $pin); |
|
166 |