File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
classes/local/store/swift Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -203,12 +203,22 @@ public function test_connection() {
203203 }
204204
205205 try {
206- $ container ->createObject ([ ' name ' => ' connection_check_file ', ' content ' => ' connection_check_file ' ] );
206+ $ container ->getObject ( ' connection_check_file ')-> download ( );
207207 } catch (\OpenStack \Common \Error \BadResponseError $ e ) {
208- $ connection ->success = false ;
209- $ connection ->details = $ this ->get_exception_details ($ e );
210- } catch (\Exception $ e ) {
211- $ connection ->success = false ;
208+ if ($ e ->getResponse ()->getStatusCode () == 404 ) {
209+ try {
210+ $ container ->createObject (['name ' => 'connection_check_file ' , 'content ' => 'connection_check_file ' ]);
211+ } catch (\OpenStack \Common \Error \BadResponseError $ e ) {
212+ $ connection ->success = false ;
213+ $ connection ->details = $ this ->get_exception_details ($ e );
214+ } catch (\Exception $ e ) {
215+ $ connection ->success = false ;
216+ }
217+ } else {
218+ $ details = $ this ->get_exception_details ($ e );
219+ $ connection ->messages [get_string ('settings:readfailure ' , 'tool_objectfs ' ) . $ details ] = 'notifyproblem ' ;
220+ $ connection ->success = false ;
221+ }
212222 }
213223
214224 return $ connection ;
You can’t perform that action at this time.
0 commit comments