Changeset 3300057
- Timestamp:
- 05/25/2025 01:01:08 AM (10 months ago)
- Location:
- fatal-plugin-auto-deactivator
- Files:
-
- 10 edited
- 1 copied
-
tags/1.0.1 (copied) (copied from fatal-plugin-auto-deactivator/trunk)
-
tags/1.0.1/fatal-plugin-auto-deactivator.php (modified) (2 diffs)
-
tags/1.0.1/includes/class-dropin-manager.php (modified) (8 diffs)
-
tags/1.0.1/includes/class-fatal-error-handler.php (modified) (4 diffs)
-
tags/1.0.1/languages/fatal-plugin-auto-deactivator.pot (modified) (4 diffs)
-
tags/1.0.1/readme.txt (modified) (3 diffs)
-
trunk/fatal-plugin-auto-deactivator.php (modified) (2 diffs)
-
trunk/includes/class-dropin-manager.php (modified) (8 diffs)
-
trunk/includes/class-fatal-error-handler.php (modified) (4 diffs)
-
trunk/languages/fatal-plugin-auto-deactivator.pot (modified) (4 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fatal-plugin-auto-deactivator/tags/1.0.1/fatal-plugin-auto-deactivator.php
r3298787 r3300057 4 4 * Plugin URI: https://wordpress.org/plugins/fatal-plugin-auto-deactivator/ 5 5 * Description: Automatically deactivates plugins that cause fatal errors to prevent site crashes. 6 * Version: 1.0. 06 * Version: 1.0.1 7 7 * Author: Linkon Miyan 8 8 * Author URI: https://profiles.wordpress.org/rudlinkon/ … … 23 23 // Define plugin constants 24 24 if ( ! defined( 'FPAD_VERSION' ) ) { 25 define( 'FPAD_VERSION', '1.0. 0' );25 define( 'FPAD_VERSION', '1.0.1' ); 26 26 } 27 27 -
fatal-plugin-auto-deactivator/tags/1.0.1/includes/class-dropin-manager.php
r3298787 r3300057 33 33 34 34 /** 35 * WordPress Filesystem API 36 * 37 * @var WP_Filesystem_Base 38 */ 39 protected $filesystem; 40 41 /** 35 42 * Constructor 36 43 */ … … 38 45 $this->dropin_path = WP_CONTENT_DIR . '/fatal-error-handler.php'; 39 46 $this->source_path = FPAD_PLUGIN_DIR . 'includes/fatal-error-handler-dropin.php'; 47 $this->init_filesystem(); 48 } 49 50 /** 51 * Initialize the WordPress Filesystem API 52 * 53 * @return bool True if filesystem was initialized successfully, false otherwise 54 */ 55 protected function init_filesystem() { 56 global $wp_filesystem; 57 58 // Include the file.php if it's not already included 59 if ( ! function_exists( 'WP_Filesystem' ) ) { 60 require_once ABSPATH . 'wp-admin/includes/file.php'; 61 } 62 63 // Initialize the filesystem 64 $initialized = WP_Filesystem(); 65 66 if ( $initialized ) { 67 $this->filesystem = $wp_filesystem; 68 } else { 69 //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 70 error_log( 'Fatal Plugin Auto Deactivator: Failed to initialize filesystem' ); 71 } 72 73 return $initialized; 40 74 } 41 75 … … 52 86 53 87 // Check if we can write to the wp-content directory 54 if ( ! is_writable( WP_CONTENT_DIR ) ) { 88 if ( ! $this->filesystem->is_writable( WP_CONTENT_DIR ) ) { 89 //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 55 90 error_log( 'Fatal Plugin Auto Deactivator: Cannot write to wp-content directory' ); 56 91 … … 64 99 // Set the same permissions as the source file 65 100 $perms = fileperms( $this->source_path ); 66 chmod( $this->dropin_path, $perms );101 $this->filesystem->chmod( $this->dropin_path, $perms ); 67 102 } 68 103 … … 80 115 $content = file_get_contents( $this->dropin_path ); 81 116 if ( strpos( $content, 'FPAD_Fatal_Error_Handler' ) !== false ) { 82 return @unlink( $this->dropin_path );117 return wp_delete_file( $this->dropin_path ); 83 118 } 84 119 } … … 109 144 // Make sure the includes directory exists 110 145 if ( ! is_dir( FPAD_PLUGIN_DIR . 'includes' ) ) { 111 mkdir( FPAD_PLUGIN_DIR . 'includes', 0755, true);146 $this->filesystem->mkdir( FPAD_PLUGIN_DIR . 'includes', FS_CHMOD_DIR ); 112 147 } 113 148 … … 115 150 $handler_path = FPAD_PLUGIN_DIR . 'includes/class-fatal-error-handler.php'; 116 151 if ( ! file_exists( $handler_path ) ) { 152 //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 117 153 error_log( 'Fatal Plugin Auto Deactivator: Fatal error handler class not found' ); 118 154 … … 141 177 142 178 file_put_contents( $this->source_path, $dropin_content ); 143 chmod( $this->source_path, 0644 );179 $this->filesystem->chmod( $this->source_path, 0644 ); 144 180 145 181 return true; -
fatal-plugin-auto-deactivator/tags/1.0.1/includes/class-fatal-error-handler.php
r3298787 r3300057 151 151 if ( function_exists( 'deactivate_plugins' ) ) { 152 152 deactivate_plugins( $plugin_base ); 153 //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 153 154 error_log( "Fatal Plugin Auto Deactivator: Auto-deactivated plugin: {$plugin_base} due to fatal error in: {$error['file']}" ); 154 155 … … 218 219 'error_line' => $error['line'], 219 220 'time' => time(), 220 'date' => date( 'Y-m-d H:i:s' ),221 'date' => gmdate( 'Y-m-d H:i:s' ), 221 222 ); 222 223 … … 370 371 </div> 371 372 <p>A fatal error occurred on your website. The Fatal Plugin Auto Deactivator has detected and resolved the issue.</p>' . 373 //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 372 374 ( defined( 'WP_DEBUG' ) && WP_DEBUG ? $plugin_info . ' 373 375 <div class="fpad_error_details"> … … 379 381 <p>You can now safely reload the page to continue browsing the site.</p> 380 382 <div class="fpad_actions"> 381 <a href="' . esc_url( $_SERVER['REQUEST_URI']) . '" class="fpad_button">Reload Page</a>383 <a href="' . esc_url( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ?? '' ) ) ) . '" class="fpad_button">Reload Page</a> 382 384 <a href="' . esc_url( $home_url ) . '" class="fpad_button fpad_secondary">Go to Homepage</a> 383 385 </div> -
fatal-plugin-auto-deactivator/tags/1.0.1/languages/fatal-plugin-auto-deactivator.pot
r3298787 r3300057 1 # Copyright (C) 2025 Your Name1 # Copyright (C) 2025 Linkon Miyan 2 2 # This file is distributed under the GPL-2.0+. 3 3 msgid "" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2025-05- 13T13:06:25+00:00\n"12 "POT-Creation-Date: 2025-05-24T19:00:51+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.11.0\n" … … 22 22 #. Plugin URI of the plugin 23 23 #: fatal-plugin-auto-deactivator.php 24 msgid "https:// example.com/fatal-plugin-auto-deactivator"24 msgid "https://wordpress.org/plugins/fatal-plugin-auto-deactivator/" 25 25 msgstr "" 26 26 … … 32 32 #. Author of the plugin 33 33 #: fatal-plugin-auto-deactivator.php 34 msgid " Your Name"34 msgid "Linkon Miyan" 35 35 msgstr "" 36 36 37 37 #. Author URI of the plugin 38 38 #: fatal-plugin-auto-deactivator.php 39 msgid "https:// example.com"39 msgid "https://profiles.wordpress.org/rudlinkon/" 40 40 msgstr "" 41 41 42 42 #. translators: 1: Plugin name, 2: Error message 43 #: fatal-plugin-auto-deactivator.php: 9343 #: fatal-plugin-auto-deactivator.php:110 44 44 msgid "Fatal Plugin Auto Deactivator has deactivated \"%1$s\" due to a fatal error: %2$s" 45 45 msgstr "" -
fatal-plugin-auto-deactivator/tags/1.0.1/readme.txt
r3298787 r3300057 2 2 Contributors: rudlinkon 3 3 Tags: fatal error, plugin deactivation, error handling, site protection, crash prevention 4 Requires at least: 5. 04 Requires at least: 5.2 5 5 Tested up to: 6.8 6 Stable tag: 1.0. 06 Stable tag: 1.0.1 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 98 98 == Changelog == 99 99 100 = 1.0.1 - 25/05/2025 = 101 - Improved: Security Enhancement 102 - Few minor bug fixes & improvements 103 100 104 = 1.0.0 - 22/05/2025 = 101 105 - Initial release … … 103 107 == Upgrade Notice == 104 108 105 = 1.0. 0=106 Initial release of Fatal Plugin Auto Deactivator.109 = 1.0.1 = 110 We have improved security and fixed few bugs. Please update to the latest version. -
fatal-plugin-auto-deactivator/trunk/fatal-plugin-auto-deactivator.php
r3298787 r3300057 4 4 * Plugin URI: https://wordpress.org/plugins/fatal-plugin-auto-deactivator/ 5 5 * Description: Automatically deactivates plugins that cause fatal errors to prevent site crashes. 6 * Version: 1.0. 06 * Version: 1.0.1 7 7 * Author: Linkon Miyan 8 8 * Author URI: https://profiles.wordpress.org/rudlinkon/ … … 23 23 // Define plugin constants 24 24 if ( ! defined( 'FPAD_VERSION' ) ) { 25 define( 'FPAD_VERSION', '1.0. 0' );25 define( 'FPAD_VERSION', '1.0.1' ); 26 26 } 27 27 -
fatal-plugin-auto-deactivator/trunk/includes/class-dropin-manager.php
r3298787 r3300057 33 33 34 34 /** 35 * WordPress Filesystem API 36 * 37 * @var WP_Filesystem_Base 38 */ 39 protected $filesystem; 40 41 /** 35 42 * Constructor 36 43 */ … … 38 45 $this->dropin_path = WP_CONTENT_DIR . '/fatal-error-handler.php'; 39 46 $this->source_path = FPAD_PLUGIN_DIR . 'includes/fatal-error-handler-dropin.php'; 47 $this->init_filesystem(); 48 } 49 50 /** 51 * Initialize the WordPress Filesystem API 52 * 53 * @return bool True if filesystem was initialized successfully, false otherwise 54 */ 55 protected function init_filesystem() { 56 global $wp_filesystem; 57 58 // Include the file.php if it's not already included 59 if ( ! function_exists( 'WP_Filesystem' ) ) { 60 require_once ABSPATH . 'wp-admin/includes/file.php'; 61 } 62 63 // Initialize the filesystem 64 $initialized = WP_Filesystem(); 65 66 if ( $initialized ) { 67 $this->filesystem = $wp_filesystem; 68 } else { 69 //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 70 error_log( 'Fatal Plugin Auto Deactivator: Failed to initialize filesystem' ); 71 } 72 73 return $initialized; 40 74 } 41 75 … … 52 86 53 87 // Check if we can write to the wp-content directory 54 if ( ! is_writable( WP_CONTENT_DIR ) ) { 88 if ( ! $this->filesystem->is_writable( WP_CONTENT_DIR ) ) { 89 //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 55 90 error_log( 'Fatal Plugin Auto Deactivator: Cannot write to wp-content directory' ); 56 91 … … 64 99 // Set the same permissions as the source file 65 100 $perms = fileperms( $this->source_path ); 66 chmod( $this->dropin_path, $perms );101 $this->filesystem->chmod( $this->dropin_path, $perms ); 67 102 } 68 103 … … 80 115 $content = file_get_contents( $this->dropin_path ); 81 116 if ( strpos( $content, 'FPAD_Fatal_Error_Handler' ) !== false ) { 82 return @unlink( $this->dropin_path );117 return wp_delete_file( $this->dropin_path ); 83 118 } 84 119 } … … 109 144 // Make sure the includes directory exists 110 145 if ( ! is_dir( FPAD_PLUGIN_DIR . 'includes' ) ) { 111 mkdir( FPAD_PLUGIN_DIR . 'includes', 0755, true);146 $this->filesystem->mkdir( FPAD_PLUGIN_DIR . 'includes', FS_CHMOD_DIR ); 112 147 } 113 148 … … 115 150 $handler_path = FPAD_PLUGIN_DIR . 'includes/class-fatal-error-handler.php'; 116 151 if ( ! file_exists( $handler_path ) ) { 152 //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 117 153 error_log( 'Fatal Plugin Auto Deactivator: Fatal error handler class not found' ); 118 154 … … 141 177 142 178 file_put_contents( $this->source_path, $dropin_content ); 143 chmod( $this->source_path, 0644 );179 $this->filesystem->chmod( $this->source_path, 0644 ); 144 180 145 181 return true; -
fatal-plugin-auto-deactivator/trunk/includes/class-fatal-error-handler.php
r3298787 r3300057 151 151 if ( function_exists( 'deactivate_plugins' ) ) { 152 152 deactivate_plugins( $plugin_base ); 153 //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log 153 154 error_log( "Fatal Plugin Auto Deactivator: Auto-deactivated plugin: {$plugin_base} due to fatal error in: {$error['file']}" ); 154 155 … … 218 219 'error_line' => $error['line'], 219 220 'time' => time(), 220 'date' => date( 'Y-m-d H:i:s' ),221 'date' => gmdate( 'Y-m-d H:i:s' ), 221 222 ); 222 223 … … 370 371 </div> 371 372 <p>A fatal error occurred on your website. The Fatal Plugin Auto Deactivator has detected and resolved the issue.</p>' . 373 //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 372 374 ( defined( 'WP_DEBUG' ) && WP_DEBUG ? $plugin_info . ' 373 375 <div class="fpad_error_details"> … … 379 381 <p>You can now safely reload the page to continue browsing the site.</p> 380 382 <div class="fpad_actions"> 381 <a href="' . esc_url( $_SERVER['REQUEST_URI']) . '" class="fpad_button">Reload Page</a>383 <a href="' . esc_url( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ?? '' ) ) ) . '" class="fpad_button">Reload Page</a> 382 384 <a href="' . esc_url( $home_url ) . '" class="fpad_button fpad_secondary">Go to Homepage</a> 383 385 </div> -
fatal-plugin-auto-deactivator/trunk/languages/fatal-plugin-auto-deactivator.pot
r3298787 r3300057 1 # Copyright (C) 2025 Your Name1 # Copyright (C) 2025 Linkon Miyan 2 2 # This file is distributed under the GPL-2.0+. 3 3 msgid "" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2025-05- 13T13:06:25+00:00\n"12 "POT-Creation-Date: 2025-05-24T19:00:51+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.11.0\n" … … 22 22 #. Plugin URI of the plugin 23 23 #: fatal-plugin-auto-deactivator.php 24 msgid "https:// example.com/fatal-plugin-auto-deactivator"24 msgid "https://wordpress.org/plugins/fatal-plugin-auto-deactivator/" 25 25 msgstr "" 26 26 … … 32 32 #. Author of the plugin 33 33 #: fatal-plugin-auto-deactivator.php 34 msgid " Your Name"34 msgid "Linkon Miyan" 35 35 msgstr "" 36 36 37 37 #. Author URI of the plugin 38 38 #: fatal-plugin-auto-deactivator.php 39 msgid "https:// example.com"39 msgid "https://profiles.wordpress.org/rudlinkon/" 40 40 msgstr "" 41 41 42 42 #. translators: 1: Plugin name, 2: Error message 43 #: fatal-plugin-auto-deactivator.php: 9343 #: fatal-plugin-auto-deactivator.php:110 44 44 msgid "Fatal Plugin Auto Deactivator has deactivated \"%1$s\" due to a fatal error: %2$s" 45 45 msgstr "" -
fatal-plugin-auto-deactivator/trunk/readme.txt
r3298787 r3300057 2 2 Contributors: rudlinkon 3 3 Tags: fatal error, plugin deactivation, error handling, site protection, crash prevention 4 Requires at least: 5. 04 Requires at least: 5.2 5 5 Tested up to: 6.8 6 Stable tag: 1.0. 06 Stable tag: 1.0.1 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 98 98 == Changelog == 99 99 100 = 1.0.1 - 25/05/2025 = 101 - Improved: Security Enhancement 102 - Few minor bug fixes & improvements 103 100 104 = 1.0.0 - 22/05/2025 = 101 105 - Initial release … … 103 107 == Upgrade Notice == 104 108 105 = 1.0. 0=106 Initial release of Fatal Plugin Auto Deactivator.109 = 1.0.1 = 110 We have improved security and fixed few bugs. Please update to the latest version.
Note: See TracChangeset
for help on using the changeset viewer.