Make WordPress Core

Ticket #13847: 13847.patch

File 13847.patch, 3.5 KB (added by hakre, 15 years ago)

Use Constant instead of Magic Number

  • wp-admin/includes/file.php

    Property changes on: .
    ___________________________________________________________________
    Added: svn:ignore
       + .project
    .buildpath
    .settings
    
    
     
    529529                return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
    530530
    531531        // Unzip can use a lot of memory, but not this much hopefully
    532         @ini_set('memory_limit', '256M');
     532        @ini_set('memory_limit', WP_MAX_MEMORY_LIMIT);
    533533
    534534        $needed_dirs = array();
    535535        $to = trailingslashit($to);
  • wp-admin/includes/image-edit.php

     
    390390
    391391function stream_preview_image($post_id) {
    392392        $post = get_post($post_id);
    393         @ini_set('memory_limit', '256M');
     393        @ini_set('memory_limit', WP_MAX_MEMORY_LIMIT);
    394394        $img = load_image_to_edit( $post_id, $post->post_mime_type, array(400, 400) );
    395395
    396396        if ( !is_resource($img) )
     
    495495        $return = '';
    496496        $success = $delete = $scaled = $nocrop = false;
    497497        $post = get_post($post_id);
    498         @ini_set('memory_limit', '256M');
     498        @ini_set('memory_limit', WP_MAX_MEMORY_LIMIT);
    499499        $img = load_image_to_edit($post_id, $post->post_mime_type);
    500500
    501501        if ( !is_resource($img) ) {
  • wp-admin/admin.php

     
    9999        require(ABSPATH . 'wp-admin/menu.php');
    100100
    101101if ( current_user_can( 'manage_options' ) )
    102         @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', '256M' ) );
     102        @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
    103103
    104104do_action('admin_init');
    105105
  • wp-includes/default-constants.php

     
    2323                        define('WP_MEMORY_LIMIT', '32M');
    2424                }
    2525        }
     26       
     27        if ( !defined('WP_MAX_MEMORY_LIMIT') ) {
     28                define('WP_MAX_MEMORY_LIMIT', '256M');
     29        }
    2630
    2731        /**
    2832         * The $blog_id global, which you can change in the config allows you to create a simple
  • wp-includes/media.php

     
    249249                return __('The GD image library is not installed.');
    250250
    251251        // Set artificially high because GD uses uncompressed images in memory
    252         @ini_set('memory_limit', '256M');
     252        @ini_set('memory_limit', WP_MAX_MEMORY_LIMIT);
    253253        $image = imagecreatefromstring( file_get_contents( $file ) );
    254254
    255255        if ( !is_resource( $image ) )
  • wp-settings.php

     
    2020require( ABSPATH . WPINC . '/default-constants.php' );
    2121require( ABSPATH . WPINC . '/version.php' );
    2222
    23 // Set initial default constants including WP_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
     23// Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
    2424wp_initial_constants( );
    2525
    2626// Disable magic quotes at runtime. Magic quotes are added using wpdb later in wp-settings.php.