WordPress.org

Plugin Directory

Changeset 192650 for health-check


Ignore:
Timestamp:
01/11/10 14:00:41 (4 years ago)
Author:
Denis-de-Bernardy
Message:

scan for drop-in files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • health-check/branches/alpha/hc-tests/wp-configuration.php

    r192634 r192650  
    179179} 
    180180HealthCheck::register_test('HealthCheck_InactiveWidgets'); 
     181 
     182 
     183/** 
     184 * Check for drop in files 
     185 *  
     186 * @link http://core.trac.wordpress.org/ticket/11861 
     187 * @author Denis de Bernardy 
     188 */ 
     189class HealthCheck_DropInFiles extends HealthCheckTest { 
     190    function run_test() { 
     191        $files = array(); 
     192        foreach ( array( 
     193            'db.php', 
     194            'advanced-cache.php', 
     195            'object-cache.php', 
     196            ) as $file ) { 
     197            if ( file_exists(WP_CONTENT_DIR . '/' . $file) ) 
     198                $files[] = $file; 
     199        } 
     200        $files = implode(__('</code>, <code>', 'health-check'), $files); 
     201        $message = sprintf(__( 'Your WordPress installation has drop-in files in its wp-content folder: <code>%1$s</code>. In the event that you added them manually, be sure to keep them up to date. Forgetting to do so can create issues that are <a href="%2$s">very hard to diagnose</a>.', 'health-check' ), $files, 'http://core.trac.wordpress.org/ticket/11861' ); 
     202        $this->assertEquals($files, 
     203                            '', 
     204                            $message, 
     205                            HEALTH_CHECK_INFO ); 
     206         
     207        $files = array(); 
     208        if ( defined('WPMU_PLUGIN_DIR') && is_dir(WPMU_PLUGIN_DIR) ) { 
     209            foreach ( glob(WPMU_PLUGIN_DIR . '/*.php') as $file ) 
     210                $files[] = basename($file); 
     211        } 
     212        $files = implode(__('</code>, <code>', 'health-check'), $files); 
     213        $message = sprintf(__( 'Your WordPress installation has drop-in files in its wp-content/mu-plugins folder: <code>%1$s</code>. In the event that you added them manually, be sure to keep them up to date. Forgetting to do so can create issues that are <a href="%2$s">very hard to diagnose</a>.', 'health-check' ), $files, 'http://core.trac.wordpress.org/ticket/11861' ); 
     214        $this->assertEquals($files, 
     215                            '', 
     216                            $message, 
     217                            HEALTH_CHECK_INFO ); 
     218    } 
     219} 
     220HealthCheck::register_test('HealthCheck_DropInFiles'); 
    181221?> 
Note: See TracChangeset for help on using the changeset viewer.