Plugin Directory

Changeset 3300057


Ignore:
Timestamp:
05/25/2025 01:01:08 AM (10 months ago)
Author:
rudlinkon
Message:

Update to version 1.0.1 from GitHub

Location:
fatal-plugin-auto-deactivator
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • fatal-plugin-auto-deactivator/tags/1.0.1/fatal-plugin-auto-deactivator.php

    r3298787 r3300057  
    44 * Plugin URI: https://wordpress.org/plugins/fatal-plugin-auto-deactivator/
    55 * Description: Automatically deactivates plugins that cause fatal errors to prevent site crashes.
    6  * Version: 1.0.0
     6 * Version: 1.0.1
    77 * Author: Linkon Miyan
    88 * Author URI: https://profiles.wordpress.org/rudlinkon/
     
    2323// Define plugin constants
    2424if ( ! defined( 'FPAD_VERSION' ) ) {
    25     define( 'FPAD_VERSION', '1.0.0' );
     25    define( 'FPAD_VERSION', '1.0.1' );
    2626}
    2727
  • fatal-plugin-auto-deactivator/tags/1.0.1/includes/class-dropin-manager.php

    r3298787 r3300057  
    3333
    3434    /**
     35     * WordPress Filesystem API
     36     *
     37     * @var WP_Filesystem_Base
     38     */
     39    protected $filesystem;
     40
     41    /**
    3542     * Constructor
    3643     */
     
    3845        $this->dropin_path = WP_CONTENT_DIR . '/fatal-error-handler.php';
    3946        $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;
    4074    }
    4175
     
    5286
    5387        // 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
    5590            error_log( 'Fatal Plugin Auto Deactivator: Cannot write to wp-content directory' );
    5691
     
    6499            // Set the same permissions as the source file
    65100            $perms = fileperms( $this->source_path );
    66             chmod( $this->dropin_path, $perms );
     101            $this->filesystem->chmod( $this->dropin_path, $perms );
    67102        }
    68103
     
    80115            $content = file_get_contents( $this->dropin_path );
    81116            if ( strpos( $content, 'FPAD_Fatal_Error_Handler' ) !== false ) {
    82                 return @unlink( $this->dropin_path );
     117                return wp_delete_file( $this->dropin_path );
    83118            }
    84119        }
     
    109144        // Make sure the includes directory exists
    110145        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 );
    112147        }
    113148
     
    115150        $handler_path = FPAD_PLUGIN_DIR . 'includes/class-fatal-error-handler.php';
    116151        if ( ! file_exists( $handler_path ) ) {
     152            //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
    117153            error_log( 'Fatal Plugin Auto Deactivator: Fatal error handler class not found' );
    118154
     
    141177
    142178        file_put_contents( $this->source_path, $dropin_content );
    143         chmod( $this->source_path, 0644 );
     179        $this->filesystem->chmod( $this->source_path, 0644 );
    144180
    145181        return true;
  • fatal-plugin-auto-deactivator/tags/1.0.1/includes/class-fatal-error-handler.php

    r3298787 r3300057  
    151151        if ( function_exists( 'deactivate_plugins' ) ) {
    152152            deactivate_plugins( $plugin_base );
     153            //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
    153154            error_log( "Fatal Plugin Auto Deactivator: Auto-deactivated plugin: {$plugin_base} due to fatal error in: {$error['file']}" );
    154155
     
    218219            'error_line'  => $error['line'],
    219220            'time'        => time(),
    220             'date'        => date( 'Y-m-d H:i:s' ),
     221            'date'        => gmdate( 'Y-m-d H:i:s' ),
    221222        );
    222223
     
    370371                </div>
    371372                <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
    372374             ( defined( 'WP_DEBUG' ) && WP_DEBUG ? $plugin_info . '
    373375                <div class="fpad_error_details">
     
    379381                <p>You can now safely reload the page to continue browsing the site.</p>
    380382                <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>
    382384                    <a href="' . esc_url( $home_url ) . '" class="fpad_button fpad_secondary">Go to Homepage</a>
    383385                </div>
  • fatal-plugin-auto-deactivator/tags/1.0.1/languages/fatal-plugin-auto-deactivator.pot

    r3298787 r3300057  
    1 # Copyright (C) 2025 Your Name
     1# Copyright (C) 2025 Linkon Miyan
    22# This file is distributed under the GPL-2.0+.
    33msgid ""
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"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"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.11.0\n"
     
    2222#. Plugin URI of the plugin
    2323#: fatal-plugin-auto-deactivator.php
    24 msgid "https://example.com/fatal-plugin-auto-deactivator"
     24msgid "https://wordpress.org/plugins/fatal-plugin-auto-deactivator/"
    2525msgstr ""
    2626
     
    3232#. Author of the plugin
    3333#: fatal-plugin-auto-deactivator.php
    34 msgid "Your Name"
     34msgid "Linkon Miyan"
    3535msgstr ""
    3636
    3737#. Author URI of the plugin
    3838#: fatal-plugin-auto-deactivator.php
    39 msgid "https://example.com"
     39msgid "https://profiles.wordpress.org/rudlinkon/"
    4040msgstr ""
    4141
    4242#. translators: 1: Plugin name, 2: Error message
    43 #: fatal-plugin-auto-deactivator.php:93
     43#: fatal-plugin-auto-deactivator.php:110
    4444msgid "Fatal Plugin Auto Deactivator has deactivated \"%1$s\" due to a fatal error: %2$s"
    4545msgstr ""
  • fatal-plugin-auto-deactivator/tags/1.0.1/readme.txt

    r3298787 r3300057  
    22Contributors: rudlinkon
    33Tags: fatal error, plugin deactivation, error handling, site protection, crash prevention
    4 Requires at least: 5.0
     4Requires at least: 5.2
    55Tested up to: 6.8
    6 Stable tag: 1.0.0
     6Stable tag: 1.0.1
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    9898== Changelog ==
    9999
     100= 1.0.1 - 25/05/2025 =
     101- Improved: Security Enhancement
     102- Few minor bug fixes & improvements
     103
    100104= 1.0.0 - 22/05/2025 =
    101105- Initial release
     
    103107== Upgrade Notice ==
    104108
    105 = 1.0.0 =
    106 Initial release of Fatal Plugin Auto Deactivator.
     109= 1.0.1 =
     110We 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  
    44 * Plugin URI: https://wordpress.org/plugins/fatal-plugin-auto-deactivator/
    55 * Description: Automatically deactivates plugins that cause fatal errors to prevent site crashes.
    6  * Version: 1.0.0
     6 * Version: 1.0.1
    77 * Author: Linkon Miyan
    88 * Author URI: https://profiles.wordpress.org/rudlinkon/
     
    2323// Define plugin constants
    2424if ( ! defined( 'FPAD_VERSION' ) ) {
    25     define( 'FPAD_VERSION', '1.0.0' );
     25    define( 'FPAD_VERSION', '1.0.1' );
    2626}
    2727
  • fatal-plugin-auto-deactivator/trunk/includes/class-dropin-manager.php

    r3298787 r3300057  
    3333
    3434    /**
     35     * WordPress Filesystem API
     36     *
     37     * @var WP_Filesystem_Base
     38     */
     39    protected $filesystem;
     40
     41    /**
    3542     * Constructor
    3643     */
     
    3845        $this->dropin_path = WP_CONTENT_DIR . '/fatal-error-handler.php';
    3946        $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;
    4074    }
    4175
     
    5286
    5387        // 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
    5590            error_log( 'Fatal Plugin Auto Deactivator: Cannot write to wp-content directory' );
    5691
     
    6499            // Set the same permissions as the source file
    65100            $perms = fileperms( $this->source_path );
    66             chmod( $this->dropin_path, $perms );
     101            $this->filesystem->chmod( $this->dropin_path, $perms );
    67102        }
    68103
     
    80115            $content = file_get_contents( $this->dropin_path );
    81116            if ( strpos( $content, 'FPAD_Fatal_Error_Handler' ) !== false ) {
    82                 return @unlink( $this->dropin_path );
     117                return wp_delete_file( $this->dropin_path );
    83118            }
    84119        }
     
    109144        // Make sure the includes directory exists
    110145        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 );
    112147        }
    113148
     
    115150        $handler_path = FPAD_PLUGIN_DIR . 'includes/class-fatal-error-handler.php';
    116151        if ( ! file_exists( $handler_path ) ) {
     152            //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
    117153            error_log( 'Fatal Plugin Auto Deactivator: Fatal error handler class not found' );
    118154
     
    141177
    142178        file_put_contents( $this->source_path, $dropin_content );
    143         chmod( $this->source_path, 0644 );
     179        $this->filesystem->chmod( $this->source_path, 0644 );
    144180
    145181        return true;
  • fatal-plugin-auto-deactivator/trunk/includes/class-fatal-error-handler.php

    r3298787 r3300057  
    151151        if ( function_exists( 'deactivate_plugins' ) ) {
    152152            deactivate_plugins( $plugin_base );
     153            //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
    153154            error_log( "Fatal Plugin Auto Deactivator: Auto-deactivated plugin: {$plugin_base} due to fatal error in: {$error['file']}" );
    154155
     
    218219            'error_line'  => $error['line'],
    219220            'time'        => time(),
    220             'date'        => date( 'Y-m-d H:i:s' ),
     221            'date'        => gmdate( 'Y-m-d H:i:s' ),
    221222        );
    222223
     
    370371                </div>
    371372                <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
    372374             ( defined( 'WP_DEBUG' ) && WP_DEBUG ? $plugin_info . '
    373375                <div class="fpad_error_details">
     
    379381                <p>You can now safely reload the page to continue browsing the site.</p>
    380382                <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>
    382384                    <a href="' . esc_url( $home_url ) . '" class="fpad_button fpad_secondary">Go to Homepage</a>
    383385                </div>
  • fatal-plugin-auto-deactivator/trunk/languages/fatal-plugin-auto-deactivator.pot

    r3298787 r3300057  
    1 # Copyright (C) 2025 Your Name
     1# Copyright (C) 2025 Linkon Miyan
    22# This file is distributed under the GPL-2.0+.
    33msgid ""
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"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"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.11.0\n"
     
    2222#. Plugin URI of the plugin
    2323#: fatal-plugin-auto-deactivator.php
    24 msgid "https://example.com/fatal-plugin-auto-deactivator"
     24msgid "https://wordpress.org/plugins/fatal-plugin-auto-deactivator/"
    2525msgstr ""
    2626
     
    3232#. Author of the plugin
    3333#: fatal-plugin-auto-deactivator.php
    34 msgid "Your Name"
     34msgid "Linkon Miyan"
    3535msgstr ""
    3636
    3737#. Author URI of the plugin
    3838#: fatal-plugin-auto-deactivator.php
    39 msgid "https://example.com"
     39msgid "https://profiles.wordpress.org/rudlinkon/"
    4040msgstr ""
    4141
    4242#. translators: 1: Plugin name, 2: Error message
    43 #: fatal-plugin-auto-deactivator.php:93
     43#: fatal-plugin-auto-deactivator.php:110
    4444msgid "Fatal Plugin Auto Deactivator has deactivated \"%1$s\" due to a fatal error: %2$s"
    4545msgstr ""
  • fatal-plugin-auto-deactivator/trunk/readme.txt

    r3298787 r3300057  
    22Contributors: rudlinkon
    33Tags: fatal error, plugin deactivation, error handling, site protection, crash prevention
    4 Requires at least: 5.0
     4Requires at least: 5.2
    55Tested up to: 6.8
    6 Stable tag: 1.0.0
     6Stable tag: 1.0.1
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    9898== Changelog ==
    9999
     100= 1.0.1 - 25/05/2025 =
     101- Improved: Security Enhancement
     102- Few minor bug fixes & improvements
     103
    100104= 1.0.0 - 22/05/2025 =
    101105- Initial release
     
    103107== Upgrade Notice ==
    104108
    105 = 1.0.0 =
    106 Initial release of Fatal Plugin Auto Deactivator.
     109= 1.0.1 =
     110We have improved security and fixed few bugs. Please update to the latest version.
Note: See TracChangeset for help on using the changeset viewer.