| @@ -229,10 +229,8 @@ | ||
| 229 | 229 | |
| 230 | 230 | // Clear any previous notices |
| 231 | 231 | delete_transient(self::NOTICE_TRANSIENT); |
| 232 | 232 | |
| 233 | - // Log the action | |
| 234 | - error_log('MetaSync: Debug mode enabled' . ($indefinite ? ' (indefinite)' : ' (24 hours)')); | |
| 235 | 233 | } |
| 236 | 234 | |
| 237 | 235 | return $result; |
| 238 | 236 | } |
| @@ -273,10 +271,8 @@ | ||
| 273 | 271 | 'Debug mode has been disabled (' . $reason . ').', |
| 274 | 272 | 'info' |
| 275 | 273 | ); |
| 276 | 274 | |
| 277 | - // Log the action | |
| 278 | - error_log('MetaSync: Debug mode disabled - ' . $reason); | |
| 279 | 275 | } |
| 280 | 276 | |
| 281 | 277 | return $result; |
| 282 | 278 | } |
| @@ -402,18 +398,18 @@ | ||
| 402 | 398 | $backup_path = $this->log_file_path . '.old'; |
| 403 | 399 | |
| 404 | 400 | // Remove existing .old file if it exists |
| 405 | 401 | if (file_exists($backup_path)) { |
| 406 | - @unlink($backup_path); | |
| 402 | + @wp_delete_file($backup_path); | |
| 407 | 403 | } |
| 408 | 404 | |
| 409 | 405 | // Rename current log to .old |
| 410 | - $result = @rename($this->log_file_path, $backup_path); | |
| 406 | + $result = @rename($this->log_file_path, $backup_path); // phpcs:ignore WordPress.WP.AlternativeFunctions.rename_rename -- atomic same-filesystem replace; WP_Filesystem::move() needs credential bootstrapping on non-direct hosts | |
| 411 | 407 | |
| 412 | 408 | if ($result) { |
| 413 | 409 | // Create new empty log file |
| 414 | 410 | @file_put_contents($this->log_file_path, ''); |
| 415 | - error_log('MetaSync: Debug log rotated - exceeded 10MB limit'); | |
| 411 | + error_log('MetaSync: Debug log rotated - exceeded 10MB limit'); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- plugin logger sink / last-resort fallback | |
| 416 | 412 | } |
| 417 | 413 | |
| 418 | 414 | // Cleanup old rotations (keep only MAX_ROTATED_LOGS) |
| 419 | 415 | $this->cleanup_old_rotations(); |
| @@ -442,9 +438,9 @@ | ||
| 442 | 438 | |
| 443 | 439 | // Delete oldest files, keep only MAX_ROTATED_LOGS |
| 444 | 440 | $to_delete = array_slice($old_logs, 0, count($old_logs) - self::MAX_ROTATED_LOGS); |
| 445 | 441 | foreach ($to_delete as $old_log) { |
| 446 | - @unlink($old_log); | |
| 442 | + @wp_delete_file($old_log); | |
| 447 | 443 | } |
| 448 | 444 | } |
| 449 | 445 | } |
| 450 | 446 | |
| @@ -565,9 +561,9 @@ | ||
| 565 | 561 | |
| 566 | 562 | // admin_notices never fires during a REST request, so the controller's own |
| 567 | 563 | // notice would be discarded - use the transient notices the admin reads. |
| 568 | 564 | $this->add_notice('wp-config.php could not be updated: ' . $reason, 'error'); |
| 569 | - error_log('MetaSync: wp-config.php not updated - ' . $reason); | |
| 565 | + error_log('MetaSync: wp-config.php not updated - ' . $reason); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- genuine failure path, bounded, no secrets | |
| 570 | 566 | |
| 571 | 567 | return $partial ? self::WRITE_PARTIAL : self::WRITE_FAILED; |
| 572 | 568 | } |
| 573 | 569 | |
| @@ -576,9 +572,9 @@ | ||
| 576 | 572 | // Throwable rather than Exception: an Error here would be a fatal on what is |
| 577 | 573 | // an ordinary REST request. |
| 578 | 574 | update_option('wp_debug_enabled', $previousEnabled); |
| 579 | 575 | update_option('wp_debug_log_enabled', $previousLog); |
| 580 | - error_log('MetaSync: Error updating wp-config.php - ' . $e->getMessage()); | |
| 576 | + error_log('MetaSync: Error updating wp-config.php - ' . $e->getMessage()); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- genuine failure path, bounded, no secrets | |
| 581 | 577 | return self::WRITE_FAILED; |
| 582 | 578 | } |
| 583 | 579 | } |
| 584 | 580 | |