Skip to content

Commit 8d2f74d

Browse files
authored
Bug Fixes
1 parent 14d9827 commit 8d2f74d

3 files changed

Lines changed: 39 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog for EngineScript: Simple Site Exporter
22

3+
## 1.6.1 - May 24, 2025
4+
### WordPress Plugin Check Compliance
5+
- **Fixed Timezone Issues**: Replaced all `date()` calls with `gmdate()` to avoid timezone-related problems
6+
- **Improved Debug Logging**: Enhanced logging function with WordPress `wp_debug_log()` support and proper fallback
7+
- **Fixed Admin Page Title**: Corrected `get_admin_page_title()` usage in template output
8+
- **Enhanced Documentation**: Added proper PHPDoc comments and phpcs ignore annotations for necessary discouraged functions
9+
- **Plugin Check Compliance**: Addressed all WordPress Plugin Check warnings and errors
10+
311
## 1.6.0 - May 15, 2025
412
### Major Security and Code Quality Improvements
513
- **Enhanced Logging**: Replaced all direct `error_log()` calls with secure `sse_log()` function that respects WP_DEBUG settings, includes timestamps, and stores critical errors in database (limited to last 20 entries)

readme.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: enginescript
33
Tags: backup, export, migration, site export, database export
44
Requires at least: 5.8
55
Tested up to: 6.8
6-
Stable tag: 1.6.0
6+
Stable tag: 1.6.1
77
Requires PHP: 7.4
88
License: GPLv3 or later
99
License URI: https://www.gnu.org/licenses/gpl-3.0.html
@@ -72,6 +72,14 @@ Yes, the plugin is designed to be compatible with most shared hosting environmen
7272

7373
== Changelog ==
7474

75+
= 1.6.1 =
76+
* WordPress Plugin Check compliance fixes
77+
* Fixed timezone issues by replacing date() with gmdate() for UTC consistency
78+
* Improved debug logging with WordPress wp_debug_log() support and proper fallback
79+
* Fixed admin page title display issue with get_admin_page_title() usage
80+
* Enhanced documentation with proper PHPDoc comments and phpcs annotations
81+
* Addressed all WordPress Plugin Check warnings and errors
82+
7583
= 1.6.0 =
7684
* Major security and code quality improvements
7785
* Enhanced logging system with WP_DEBUG integration and database storage for critical errors
@@ -151,6 +159,9 @@ Yes, the plugin is designed to be compatible with most shared hosting environmen
151159

152160
== Upgrade Notice ==
153161

162+
= 1.6.1 =
163+
WordPress Plugin Check compliance update: Fixed timezone issues, improved debug logging, and addressed all plugin check warnings. Recommended update for WordPress.org submission.
164+
154165
= 1.6.0 =
155166
Major security and code quality update: Enhanced logging system, improved file operations with WordPress Filesystem API, execution time safety improvements, comprehensive path validation, standardized text domains, and GitHub Actions security updates. Recommended upgrade for all users.
156167

simple-site-exporter.php

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
Plugin Name: EngineScript: Simple Site Exporter
44
Description: Exports the site files and database as a zip archive.
5-
Version: 1.6.0
5+
Version: 1.6.1
66
Author: EngineScript
77
License: GPL v3 or later
88
Text Domain: Simple-Site-Exporter
@@ -15,7 +15,7 @@
1515

1616
// Define plugin version
1717
if (!defined('ES_SITE_EXPORTER_VERSION')) {
18-
define('ES_SITE_EXPORTER_VERSION', '1.6.0');
18+
define('ES_SITE_EXPORTER_VERSION', '1.6.1');
1919
}
2020

2121
/**
@@ -27,18 +27,26 @@
2727
function sse_log($message, $level = 'info') {
2828
// Check if WP_DEBUG is enabled
2929
if (defined('WP_DEBUG') && WP_DEBUG) {
30-
// Format the message with a timestamp
30+
// Format the message with a timestamp (using GMT to avoid timezone issues)
3131
$formatted_message = sprintf(
3232
'[%s] [%s] %s: %s',
33-
date('Y-m-d H:i:s'),
33+
gmdate('Y-m-d H:i:s'),
3434
'Simple Site Exporter',
3535
strtoupper($level),
3636
$message
3737
);
3838

3939
// Log to the WordPress debug log if enabled
4040
if (defined('WP_DEBUG_LOG') && WP_DEBUG_LOG) {
41-
error_log($formatted_message);
41+
// Use WordPress logging when available, fallback to standard logging
42+
if (function_exists('wp_debug_log')) {
43+
wp_debug_log($formatted_message);
44+
} else {
45+
// Fallback for older WordPress versions that don't have wp_debug_log()
46+
// Only log during development/debug mode as controlled by WP_DEBUG
47+
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
48+
error_log($formatted_message);
49+
}
4250
}
4351

4452
// Store logs in the database (limit to errors only to prevent bloat)
@@ -104,7 +112,7 @@ function sse_exporter_page_html() {
104112
$display_path = str_replace( ABSPATH, '', $export_dir_path );
105113
?>
106114
<div class="wrap">
107-
<h1><?php esc_html_e( get_admin_page_title(), 'Simple-Site-Exporter' ); // Use esc_html_e for translatable titles ?></h1>
115+
<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
108116
<p><?php esc_html_e( 'Click the button below to generate a zip archive containing your WordPress files and a database dump (.sql file).', 'Simple-Site-Exporter' ); ?></p>
109117
<p><strong><?php esc_html_e( 'Warning:', 'Simple-Site-Exporter' ); ?></strong> <?php esc_html_e( 'This can take a long time and consume significant server resources, especially on large sites. Ensure your server has sufficient disk space and execution time.', 'Simple-Site-Exporter' ); ?></p>
110118
<p style="margin-top: 15px;">
@@ -176,7 +184,11 @@ function sse_handle_export() {
176184
// Only try to increase if current limit is lower than our target
177185
if ($max_execution_time > 0 && $max_execution_time < $target_execution_time) {
178186
// Try to set a reasonable execution time instead of unlimited (0)
187+
// Note: set_time_limit() is necessary for export operations that may take longer
188+
// than the default PHP execution time. This is only used when the current limit
189+
// is insufficient for the export process.
179190
if (function_exists('set_time_limit') && !ini_get('safe_mode')) {
191+
// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_set_time_limit
180192
@set_time_limit($target_execution_time);
181193
sse_log("Increased execution time limit to {$target_execution_time} seconds", 'info');
182194
} else {
@@ -222,7 +234,7 @@ function sse_handle_export() {
222234
}
223235

224236
$site_name = sanitize_file_name( get_bloginfo( 'name' ) );
225-
$timestamp = date( 'Y-m-d_H-i-s' );
237+
$timestamp = gmdate( 'Y-m-d_H-i-s' );
226238
$random_str = substr( bin2hex( random_bytes(4) ), 0, 7 );
227239
$db_filename = "db_dump_{$site_name}_{$timestamp}.sql";
228240
$zip_filename = "site_export_sse_{$random_str}_{$site_name}_{$timestamp}.zip";

0 commit comments

Comments
 (0)