17
17
function wp_initial_constants() {
21
if ( !defined('WP_MEMORY_LIMIT') ) {
22
if ( is_multisite() ) {
23
define('WP_MEMORY_LIMIT', '64M');
21
* Constants for expressing human-readable data sizes in their respective number of bytes.
25
define( 'KB_IN_BYTES', 1024 );
26
define( 'MB_IN_BYTES', 1024 * KB_IN_BYTES );
27
define( 'GB_IN_BYTES', 1024 * MB_IN_BYTES );
28
define( 'TB_IN_BYTES', 1024 * GB_IN_BYTES );
31
$current_limit = @ini_get( 'memory_limit' );
32
$current_limit_int = wp_convert_hr_to_bytes( $current_limit );
34
// Define memory limits.
35
if ( ! defined( 'WP_MEMORY_LIMIT' ) ) {
36
if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
37
define( 'WP_MEMORY_LIMIT', $current_limit );
38
} elseif ( is_multisite() ) {
39
define( 'WP_MEMORY_LIMIT', '64M' );
25
define('WP_MEMORY_LIMIT', '40M');
41
define( 'WP_MEMORY_LIMIT', '40M' );
29
45
if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) ) {
30
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
46
if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
47
define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
48
} elseif ( -1 === $current_limit_int || $current_limit_int > 268435456 /* = 256M */ ) {
49
define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
51
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
56
$wp_limit_int = wp_convert_hr_to_bytes( WP_MEMORY_LIMIT );
57
if ( -1 !== $current_limit_int && ( -1 === $wp_limit_int || $wp_limit_int > $current_limit_int ) ) {
58
@ini_set( 'memory_limit', WP_MEMORY_LIMIT );
33
61
if ( ! isset($blog_id) )
37
if ( function_exists( 'memory_get_usage' ) ) {
38
$current_limit = @ini_get( 'memory_limit' );
39
$current_limit_int = intval( $current_limit );
40
if ( false !== strpos( $current_limit, 'G' ) )
41
$current_limit_int *= 1024;
42
$wp_limit_int = intval( WP_MEMORY_LIMIT );
43
if ( false !== strpos( WP_MEMORY_LIMIT, 'G' ) )
44
$wp_limit_int *= 1024;
46
if ( -1 != $current_limit && ( -1 == WP_MEMORY_LIMIT || $current_limit_int < $wp_limit_int ) )
47
@ini_set( 'memory_limit', WP_MEMORY_LIMIT );
50
64
if ( !defined('WP_CONTENT_DIR') )
51
65
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
98
112
* For example, MONTH_IN_SECONDS wrongly assumes every month has 30 days and
99
113
* YEAR_IN_SECONDS does not take leap years into account.
101
* If you need more accuracy please consider using the DateTime class (http://php.net/manual/class.datetime.php).
115
* If you need more accuracy please consider using the DateTime class (https://secure.php.net/manual/en/class.datetime.php).
104
118
* @since 4.4.0 Introduced `MONTH_IN_SECONDS`.
110
124
define( 'MONTH_IN_SECONDS', 30 * DAY_IN_SECONDS );
111
125
define( 'YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS );
115
* Constants for expressing human-readable data sizes in their respective number of bytes.
119
define( 'KB_IN_BYTES', 1024 );
120
define( 'MB_IN_BYTES', 1024 * KB_IN_BYTES );
121
define( 'GB_IN_BYTES', 1024 * MB_IN_BYTES );
122
define( 'TB_IN_BYTES', 1024 * GB_IN_BYTES );