Обновление до PHP7.2 вызывает проблемы с памятью - PullRequest
0 голосов
/ 02 декабря 2018

Мой хостинг обновлен до PHP 7.2, и теперь у меня появилось много проблем.Поскольку мой конструктор тем Wordpress больше не существует, я сам решил проблемы, решая проблемы.По какой-то причине это не проходит, и я беспокоюсь об этом.

Неустранимая ошибка: допустимый объем памяти 1048576000 байт исчерпан (попытка выделить 20480 байт) в /customers/3/8/4/XXX/httpd.www/wp-content/themes/dejavu/lib / classes / widget-popular.php в строке 14

Всякий раз, когда я увеличиваю ограничение в wp-config, оно только растет.Проблема в этом файле php или я должен искать в другом месте?Содержимое этого php-файла:

<?php

/**
 *
 */

class MySite_PopularPost_Widget extends WP_Widget {

    /**
     *
     */
    function __construct() {
        $widget_ops = array( 'classname' => 'mysite_popular_widget', 'description' => __( 'Custom popular post widget with post preview image', MYSITE_ADMIN_TEXTDOMAIN ) );
        $control_ops = array( 'width' => 250, 'height' => 200 );
        $this->__construct( 'popularwidget', sprintf( __( '%1$s - Popular Post', MYSITE_ADMIN_TEXTDOMAIN ), THEME_NAME ), $widget_ops, $control_ops );
    }

    /**
     *
     */
    function widget($args, $instance) {
        global $wpdb, $mysite;
        $prefix = MYSITE_PREFIX;

        extract( $args );

        $title = apply_filters('widget_title', empty($instance['title']) ? __('Popular Posts') : $instance['title'], $instance, $this->id_base);

        if ( !$number = (int) $instance['number'] )
            $number = 3;
        else if ( $number < 1 )
            $number = 1;
        else if ( $number > 15 )
            $number = 15;

        echo $before_widget;
        echo $before_title . $title . $after_title;

        $count = ( !empty( $count ) ) ? trim( $count ) : '3';
        $disable_thumb = $instance['disable_thumb'] ? '1' : '0';

        $popular_query = new WP_Query(array(
            'showposts' => $number,
            'nopaging' => 0,
            'orderby'=> 'comment_count',
            'post_status' => 'publish',
            'category__not_in' => array( mysite_exclude_category_string( $minus = false )),
            'ignore_sticky_posts' => 1
        ));

        $out = '<ul class="post_list small_post_list">';

        while ( $popular_query->have_posts() ) {
            $popular_query->the_post();

            $out .= '<li class="post_list_module">';

            if( !$disable_thumb ) {
                $widget_thumb_img = $mysite->layout['big_sidebar_images']['small_post_list'];
                $out .= mysite_get_post_image(array(
                    'width' => $widget_thumb_img[0],
                    'height' => $widget_thumb_img[1],
                    'img_class' => 'post_list_image',
                    'preload' => false,
                    'placeholder' => true,
                    'echo' => false,
                    'wp_resize' => ( mysite_get_setting( 'image_resize_type' ) == 'wordpress' ? true : false )
                ));
            }

            $out .= '<div class="post_list_content">';

            $out .= '<p class="post_title">';
            $out .= '<a rel="bookmark" href="' . esc_url( get_permalink() ) . '" title="' . esc_attr( get_the_title() ) . '">' . get_the_title() . '</a>';
            $out .= '</p>';

            $get_year = get_the_time( 'Y', get_the_ID() );
            $get_month = get_the_time( 'm', get_the_ID() );

            $out .= '<p class="post_meta">';
            $out .= apply_filters( 'mysite_widget_meta', do_shortcode( '[post_date]' ) );
            $out .= '</p>';

            $out .= '</div>';

            $out .= '</li>';
        }

        $out .= '</ul>';

        echo $out;
        echo $after_widget;

        wp_reset_postdata();
    }

    /**
     *
     */
    function update($new_instance, $old_instance) {
        $instance = $old_instance;
        $instance['title'] = strip_tags($new_instance['title']);
        $instance['number'] = (int) $new_instance['number'];
        $instance['disable_thumb'] = !empty($new_instance['disable_thumb']) ? 1 : 0;

        return $instance;
    }

    /**
     *
     */
    function form($instance) {
        $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
        $disable_thumb = isset( $instance['disable_thumb'] ) ? (bool) $instance['disable_thumb'] : false;
        if ( !isset($instance['number']) || !$number = (int) $instance['number'] )
            $number = 3;
        ?>

        <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', MYSITE_ADMIN_TEXTDOMAIN ); ?></label>
        <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>

        <p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e( "Enter the number of popular posts you'd like to display:", MYSITE_ADMIN_TEXTDOMAIN ); ?></label>
        <input class="widefat" id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" /></p>

        <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('disable_thumb'); ?>" name="<?php echo $this->get_field_name('disable_thumb'); ?>"<?php checked( $disable_thumb ); ?> />
        <label for="<?php echo $this->get_field_id('disable_thumb'); ?>"><?php _e( 'Disable Post Thumbnail?', MYSITE_ADMIN_TEXTDOMAIN ); ?></label></p>

        <?php
    }

}

?>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...