Plugin Directory

Changeset 3441987


Ignore:
Timestamp:
01/18/2026 04:03:03 PM (2 months ago)
Author:
wpfixit
Message:
  • Fixed permissions issue with Site Lock and MainWP
Location:
folder-auditor
Files:
81 added
4 edited

Legend:

Unmodified
Added
Removed
  • folder-auditor/trunk/folder-auditor.php

    r3441624 r3441987  
    33 * Plugin Name: Guard Dog Security & Site Lock
    44 * Description: Helps WordPress administrators take full control of their site. It scans critical areas including the root directory, wp-content, plugins, themes, uploads, and .htaccess files to detect anything suspicious such as orphaned folders, leftover files, or hidden PHP in uploads. From the WordPress dashboard, you can safely review, download, or remove items that don’t belong, with built-in protection to ensure required resources remain untouched. In addition, Guard Dog Security lets you lock all files and folders as read-only, preventing unauthorized changes, additions, or deletions to your WordPress installation.
    5  * Version: 5.2
     5 * Version: 5.3
    66 * Author: WP Fix It
    77 * Author URI: https://www.wpfixit.com
  • folder-auditor/trunk/includes/helpers/lock-system/traits/WPFA_Folder_Locker_Trait_FS.php

    r3441624 r3441987  
    104104
    105105        }
     106       
     107protected static function is_mainwp_child_active() {
     108
     109    // Load plugin functions if needed
     110    if ( ! function_exists( 'is_plugin_active' ) ) {
     111        require_once ABSPATH . 'wp-admin/includes/plugin.php';
     112    }
     113
     114    return is_plugin_active( 'mainwp-child/mainwp-child.php' );
     115}
    106116       
    107117/**
     
    111121 */
    112122public static function get_hard_excluded_paths() {
     123
    113124    $paths = array(
    114             WP_CONTENT_DIR . '/cache',
    115             WP_CONTENT_DIR . '/et-cache',
    116         WP_CONTENT_DIR . '/uploads/elementor',
    117         WP_CONTENT_DIR . '/uploads/mainwp',
    118         WP_CONTENT_DIR . '/wp-rocket-config',
    119         WP_CONTENT_DIR . '/updraft',
    120         WP_CONTENT_DIR . '/fonts',
    121         WP_CONTENT_DIR . '/litespeed',
    122         WP_CONTENT_DIR . '/w3tc-config',
    123         WP_CONTENT_DIR . '/ai1wm-backups',
    124         WP_CONTENT_DIR . '/plugins/all-in-one-wp-migration',
    125         WP_CONTENT_DIR . '/uploads/gravity_forms',
    126         WP_CONTENT_DIR . '/uploads/wpforms',
    127         WP_CONTENT_DIR . '/uploads/fluentform',
    128         WP_CONTENT_DIR . '/uploads/woocommerce_uploads',
    129         WP_CONTENT_DIR . '/uploads/wc-logs',
    130        
     125        WP_CONTENT_DIR . '/cache',
     126        WP_CONTENT_DIR . '/et-cache',
     127        WP_CONTENT_DIR . '/uploads/elementor',
     128        WP_CONTENT_DIR . '/uploads/mainwp',
     129        WP_CONTENT_DIR . '/wp-rocket-config',
     130        WP_CONTENT_DIR . '/updraft',
     131        WP_CONTENT_DIR . '/fonts',
     132        WP_CONTENT_DIR . '/litespeed',
     133        WP_CONTENT_DIR . '/w3tc-config',
     134        WP_CONTENT_DIR . '/ai1wm-backups',
     135        WP_CONTENT_DIR . '/plugins/all-in-one-wp-migration',
     136        WP_CONTENT_DIR . '/uploads/gravity_forms',
     137        WP_CONTENT_DIR . '/uploads/wpforms',
     138        WP_CONTENT_DIR . '/uploads/fluentform',
     139        WP_CONTENT_DIR . '/uploads/woocommerce_uploads',
     140        WP_CONTENT_DIR . '/uploads/wc-logs',
    131141    );
    132142
     
    134144    $paths = array_map( 'wp_normalize_path', $paths );
    135145
    136     /**
    137      * Allow extensions (optional, future-proof).
    138      */
    139146    return apply_filters( 'wpfa_hard_excluded_paths', $paths );
    140147}
    141 
    142148
    143149/** Exclude wp-content/cache, Uploads exclusions, wp-content exclusions, and ABSPATH (root) exclusions. */
    144150protected static function is_excluded_path( $path ) {
    145     $p = wp_normalize_path( $path );
     151   
     152    $p          = wp_normalize_path( $path );
     153    $wp_content = wp_normalize_path( WP_CONTENT_DIR );
     154
     155    // 🔴 Special case: wp-content itself (non-recursive)
     156    if ( self::is_mainwp_child_active() ) {
     157        if ( untrailingslashit( $p ) === untrailingslashit( $wp_content ) ) {
     158            return true; // exclude ONLY wp-content dir itself
     159        }
     160    }
     161
     162    // --- Always-excluded folders ---
     163    $hard_excluded = self::get_hard_excluded_paths();
     164    foreach ( $hard_excluded as $excluded ) {
     165        if ( $p === $excluded || strpos( $p, $excluded . '/' ) === 0 ) {
     166            return true;
     167        }
     168    }
    146169   
    147     // --- Always-excluded folders---
    148     $hard_excluded = self::get_hard_excluded_paths();
    149 
    150     foreach ( $hard_excluded as $excluded ) {
    151         if ( $p === $excluded || strpos( $p, $excluded . '/' ) === 0 ) {
    152             return true;
    153         }
    154     }
    155 
    156 
    157170    $wp_content = wp_normalize_path( WP_CONTENT_DIR );
    158171    $abspath    = wp_normalize_path( trailingslashit( ABSPATH ) );
  • folder-auditor/trunk/includes/helpers/lock-system/traits/WPFA_Folder_Locker_Trait_NoticesBar.php

    r3374418 r3441987  
    123123        }
    124124
     125
    125126/**
    126127
     
    198199
    199200    );
     201   
     202   
     203    // 🔒 Hide wp-content from admin bar when MainWP Child is active
     204if ( self::is_mainwp_child_active() ) {
     205    unset( $paths['wp-content'] );
     206}
    200207
    201208    $guard_dog_security_url = admin_url( 'admin.php?page=guard-dog-security' );
  • folder-auditor/trunk/readme.txt

    r3441624 r3441987  
    66Tested up to: 6.9
    77Requires PHP: 7.4
    8 Stable tag: 5.2
     8Stable tag: 5.3
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    9797== Changelog ==
    9898
     99= 5.3 =
     100* Fixed permissions issue with Site Lock and MainWP
     101
    99102= 5.2 =
    100103* Added integration with MainWP to manage Site Lock feature during remote updates
     
    238241== Upgrade Notice ==
    239242
     243= 5.3 =
     244* Fixed permissions issue with Site Lock and MainWP
     245
    240246= 5.2 =
    241247* Added integration with MainWP
Note: See TracChangeset for help on using the changeset viewer.