Skip to:
Content

bbPress.org

Changeset 1812 for trunk/bb-settings.php


Ignore:
Timestamp:
11/21/2008 01:37:56 PM (18 years ago)
Author:
sambauers
Message:

Try out a "safe mode" option - set $bb->safemode = true; in bb-config.php to temporarily deactivate all plugins and the current theme. Removing the setting will put them all back again. Props _ck_ for the idea. Fixes #994

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bb-settings.php

    r1801 r1812  
    905905 */
    906906
    907 // Autoloaded "underscore" plugins
    908 // First BB_CORE_PLUGIN_DIR
    909 foreach ( bb_glob(BB_CORE_PLUGIN_DIR . '_*.php') as $_plugin )
    910         require_once( $_plugin );
    911 unset( $_plugin );
    912 
    913 // Second BB_PLUGIN_DIR, with no name clash testing
    914 foreach ( bb_glob(BB_PLUGIN_DIR . '_*.php') as $_plugin )
    915         require_once( $_plugin );
    916 unset( $_plugin );
    917 do_action( 'bb_underscore_plugins_loaded' );
    918 
    919 // Normal plugins
    920 if ( $plugins = bb_get_option( 'active_plugins' ) ) {
    921         foreach ( (array) $plugins as $plugin ) {
    922                 if ( strpos($plugin, 'core#') === 0 || strpos($plugin, 'user#') === 0 ) {
    923                         if ( validate_file($plugin) ) // $plugin has .., :, etc.
    924                                 continue;
    925 
    926                         $plugin = str_replace(
    927                                 array('core#', 'user#'),
    928                                 array(BB_CORE_PLUGIN_DIR, BB_PLUGIN_DIR),
    929                                 $plugin
    930                         );
    931                         if (
    932                                 BB_CORE_PLUGIN_DIR != $plugin &&
    933                                 BB_PLUGIN_DIR != $plugin &&
    934                                 file_exists( $plugin )
    935                         ) {
    936                                 require_once( $plugin );
     907// Skip plugin loading in "safe" mode
     908if ( !isset( $bb->safemode ) || $bb->safemode !== true ) {
     909        // Autoloaded "underscore" plugins
     910        // First BB_CORE_PLUGIN_DIR
     911        foreach ( bb_glob(BB_CORE_PLUGIN_DIR . '_*.php') as $_plugin )
     912                require_once( $_plugin );
     913        unset( $_plugin );
     914
     915        // Second BB_PLUGIN_DIR, with no name clash testing
     916        foreach ( bb_glob(BB_PLUGIN_DIR . '_*.php') as $_plugin )
     917                require_once( $_plugin );
     918        unset( $_plugin );
     919        do_action( 'bb_underscore_plugins_loaded' );
     920
     921        // Normal plugins
     922        if ( $plugins = bb_get_option( 'active_plugins' ) ) {
     923                foreach ( (array) $plugins as $plugin ) {
     924                        if ( strpos($plugin, 'core#') === 0 || strpos($plugin, 'user#') === 0 ) {
     925                                if ( validate_file($plugin) ) // $plugin has .., :, etc.
     926                                        continue;
     927
     928                                $plugin = str_replace(
     929                                        array('core#', 'user#'),
     930                                        array(BB_CORE_PLUGIN_DIR, BB_PLUGIN_DIR),
     931                                        $plugin
     932                                );
     933                                if (
     934                                        BB_CORE_PLUGIN_DIR != $plugin &&
     935                                        BB_PLUGIN_DIR != $plugin &&
     936                                        file_exists( $plugin )
     937                                ) {
     938                                        require_once( $plugin );
     939                                }
    937940                        }
    938941                }
    939942        }
    940 }
    941 do_action( 'bb_plugins_loaded' );
    942 unset( $plugins, $plugin );
     943        do_action( 'bb_plugins_loaded' );
     944        unset( $plugins, $plugin );
     945}
    943946
    944947require_once( BB_PATH . BB_INC . 'functions.bb-pluggable.php' );
Note: See TracChangeset for help on using the changeset viewer.