@@ -135,44 +135,32 @@ function hejbit_SaveInProgress($NbrRelance = 0){
135135
136136
137137 case "0 " :
138- error_log ('DB-Exporting-BEGIN ' );
139138 // Export of the DB
140139 include ('inc/CreateDB.php ' );
141- error_log ('DB-Exporting-END ' );
142140 // End of the script before relaunch by cron to avoid timeout
143141 exit ();
144142
145143
146144
147145 case "1 " :
148- error_log ('ZIP-Creation-BEGIN ' );
149146 // Creation of the Zip
150147 include ('inc/CreateZip.php ' );
151- error_log ('ZIP-Creation-END ' );
152148 // End of the script before relaunch by cron to avoid timeout
153149 exit ();
154150
155151
156152 case "2 " :
157- error_log ('Merging-ZIP-BEGIN ' );
158153 // Merging the files to be backed up
159154 include ('inc/MergeZip.php ' );
160- error_log ('Merging-ZIP-END ' );
161155 // End of the script before relaunch by cron to avoid timeout
162156 exit ();
163157
164158
165159 case "3 " :
166- // Only log BEGIN if this is the first time (fileNumber is 0)
167- if (intval ($ inProgress ['fileNumber ' ]) == 0 ) {
168- error_log ('Sending-Chunk-BEGIN ' );
169- }
170160
171161 $ nc_status = hejbit_save_to_nextcloud::is_NextCloud_good ();
172162 $ hejbit_folder = hejbit_save_to_nextcloud::is_Folder_hejbit ();
173163
174- error_log ('Nextcloud status: ' . ($ nc_status ? 'active ' : 'inactive ' ));
175- error_log ('Hejbit folder status: ' . ($ hejbit_folder ? 'exists ' : 'does not exist ' ));
176164
177165
178166
@@ -255,7 +243,6 @@ function hejbit_SaveInProgress($NbrRelance = 0){
255243 exit ();
256244
257245 case "4 " :
258- error_log ('MergingChunk-BEGIN ' );
259246
260247 // If the connection with NextCloud is correct
261248 if (hejbit_save_to_nextcloud::is_NextCloud_good ()){
@@ -289,7 +276,6 @@ function hejbit_SaveInProgress($NbrRelance = 0){
289276
290277
291278 };
292- error_log ('MergingChunk-END ' );
293279
294280 exit ();
295281
@@ -405,7 +391,6 @@ static function is_NextCloud_good(){
405391
406392 // Check if the request failed to execute
407393 if (is_wp_error ($ nextcloud_response )){
408- error_log ('NextCloud connection error: ' . $ nextcloud_response ->get_error_message ());
409394 return false ;
410395 }
411396
@@ -416,7 +401,6 @@ static function is_NextCloud_good(){
416401 if ($ response_code >= 200 && $ response_code < 300 ){
417402 return true ;
418403 } else {
419- error_log ('NextCloud returned HTTP ' . $ response_code . ': ' . wp_remote_retrieve_response_message ($ nextcloud_response ));
420404 return false ;
421405 }
422406 }
@@ -430,12 +414,10 @@ static function is_Folder_hejbit(){
430414 $ password = get_option ("hejbit_pass_dlwcloud " );
431415
432416 if (empty ($ url_base ) || empty ($ login ) || empty ($ folder ) || empty ($ password )) {
433- error_log ('HejBit: Missing required NextCloud configuration options ' );
434417 return false ;
435418 }
436419
437420 $ url = $ url_base . '/remote.php/dav/files/ ' . $ login . $ folder ;
438- error_log ('HejBit: Checking folder URL: ' . $ url );
439421
440422 $ headers = array (
441423 'Content-Type ' => 'application/xml ' ,
@@ -461,13 +443,11 @@ static function is_Folder_hejbit(){
461443
462444 // Check if the request failed to execute
463445 if (is_wp_error ($ nextcloud_response )){
464- error_log ('HejBit: NextCloud request error: ' . $ nextcloud_response ->get_error_message ());
465446 return false ;
466447 }
467448
468449 // Check the HTTP response code
469450 $ response_code = wp_remote_retrieve_response_code ($ nextcloud_response );
470- error_log ('HejBit: NextCloud response code: ' . $ response_code );
471451
472452 // Handle different response codes appropriately
473453 switch ($ response_code ) {
@@ -476,40 +456,33 @@ static function is_Folder_hejbit(){
476456 return hejbit_save_to_nextcloud::check_ethswarm_node_status ($ nextcloud_response );
477457
478458 case 401 :
479- error_log ('HejBit: Authentication failed - check credentials ' );
480459 return false ;
481460
482461 case 403 :
483- error_log ('HejBit: Access forbidden - check permissions for folder: ' . $ folder );
484462 return false ;
485463
486464 case 404 :
487- error_log ('HejBit: Folder not found: ' . $ folder );
488465 return false ;
489466
490467 case 405 :
491- error_log ('HejBit: PROPFIND method not allowed - server may not support WebDAV ' );
492468 return false ;
493469
494470 default :
495471 if ($ response_code >= 200 && $ response_code < 300 ) {
496472 // Other 2xx codes might be valid
497473 return hejbit_save_to_nextcloud::check_ethswarm_node_status ($ nextcloud_response );
498474 } else {
499- error_log ('HejBit: Unexpected response code ' . $ response_code . ': ' . wp_remote_retrieve_response_message ($ nextcloud_response ));
500475 return false ;
501476 }
502477 }
503478 }
504479 static function check_ethswarm_node_status ($ xml_response ) {
505- error_log ('Response code: ' . wp_remote_retrieve_response_code ($ xml_response ));
506480
507481 // Extract the body from the WordPress response array
508482 $ body = wp_remote_retrieve_body ($ xml_response );
509483
510484 // Check if we got a valid body
511485 if (empty ($ body )) {
512- error_log ('Empty response body from Nextcloud ' );
513486 return false ;
514487 }
515488
@@ -520,9 +493,7 @@ static function check_ethswarm_node_status($xml_response) {
520493 // If XML couldn't be parsed, return false
521494 if ($ xml === false ) {
522495 $ errors = libxml_get_errors ();
523- foreach ($ errors as $ error ) {
524- error_log ('XML parsing error: ' . $ error ->message );
525- }
496+
526497 libxml_clear_errors ();
527498 return false ;
528499 }
@@ -537,17 +508,14 @@ static function check_ethswarm_node_status($xml_response) {
537508 // Check if element exists and its value
538509 if (count ($ nodes ) > 0 ) {
539510 $ value = trim ((string )$ nodes [0 ]);
540- error_log ('ethswarm-node value: " ' . $ value . '" ' );
541511
542512 // Accept both "1" and "true" as valid values
543513 $ is_swarm = (strtolower ($ value ) === 'true ' || $ value === '1 ' );
544- error_log ('Is Swarm folder: ' . ($ is_swarm ? 'YES ' : 'NO ' ));
545514
546515 return $ is_swarm ;
547516 }
548517
549518 // Element not found
550- error_log ('ethswarm-node element not found in XML ' );
551519 return false ;
552520 }
553521
0 commit comments