Make WordPress Core

Ticket #51507: 51507-2.patch

File 51507-2.patch, 1.8 KB (added by ttodua, 15 months ago)
  • wp-load.php

     
    3636        error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
    3737}
    3838
     39if ( ! defined( 'SHORTINIT_WITHOUT_DB' ) ) {
     40        define( 'SHORTINIT_WITHOUT_DB', false );
     41}
     42
    3943/*
    4044 * If wp-config.php exists in the WordPress root, or if it exists in the root and wp-settings.php
    4145 * doesn't, load wp-config.php. The secondary check for wp-settings.php has the added benefit
     
    5458        /** The config file resides one level above ABSPATH but is not part of another installation */
    5559        require_once dirname( ABSPATH ) . '/wp-config.php';
    5660
     61} elseif (SHORTINIT_WITHOUT_DB && @file_exists( ABSPATH . 'wp-settings.php' ) ) {
     62
     63        /** If user set the constant, we include wp-settings, even though wp-config does not exist */
     64        require_once ABSPATH . 'wp-settings.php';
     65
    5766} else {
    5867
    5968        // A config file doesn't exist.
  • wp-settings.php

     
    115115require ABSPATH . WPINC . '/class-wp.php';
    116116require ABSPATH . WPINC . '/class-wp-error.php';
    117117require ABSPATH . WPINC . '/pomo/mo.php';
     118
     119// Stop here if constant is set. This is useful when users include WP as a helper
     120// framework, to use its goodies (helper methods) without need of loading DB
     121if ( SHORTINIT_WITHOUT_DB ) {
     122        return;
     123}
     124
    118125require ABSPATH . WPINC . '/l10n/class-wp-translation-controller.php';
    119126require ABSPATH . WPINC . '/l10n/class-wp-translations.php';
    120127require ABSPATH . WPINC . '/l10n/class-wp-translation-file.php';