Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter skarabeq

    (@skarabeq)

    Hi, @monbauza

    Thank you for your response!
    I can give you an example of a too complicated code. For example when I download the plugin, in this file – wordpress-seo/src/generated/container.php I saw nested short IF statements. For example, the return statement of method getPaginationHelperService is on one row, but it has a big IF statement which is too nested:

    
    protected function getPaginationHelperService()
        {
            return $this->services['Yoast\\WP\\SEO\\Helpers\\Pagination_Helper'] = new \Yoast\WP\SEO\Helpers\Pagination_Helper(${($_ = isset($this->services['Yoast\\WP\\SEO\\Wrappers\\WP_Rewrite_Wrapper']) ? $this->services['Yoast\\WP\\SEO\\Wrappers\\WP_Rewrite_Wrapper'] : ($this->services['Yoast\\WP\\SEO\\Wrappers\\WP_Rewrite_Wrapper'] = new \Yoast\WP\SEO\Wrappers\WP_Rewrite_Wrapper())) && false ?: '_'}, ${($_ = isset($this->services['Yoast\\WP\\SEO\\Wrappers\\WP_Query_Wrapper']) ? $this->services['Yoast\\WP\\SEO\\Wrappers\\WP_Query_Wrapper'] : ($this->services['Yoast\\WP\\SEO\\Wrappers\\WP_Query_Wrapper'] = new \Yoast\WP\SEO\Wrappers\WP_Query_Wrapper())) && false ?: '_'});
        }
    

    Another example in this file wordpress-seo/src/generators/schema/organization.php:

    The original code of the method fetch_social_profiles is:

    
    private function fetch_social_profiles() {
    		$profiles        = [];
    		$social_profiles = [
    			'facebook_site',
    			'instagram_url',
    			'linkedin_url',
    			'myspace_url',
    			'youtube_url',
    			'pinterest_url',
    			'wikipedia_url',
    		];
    		foreach ( $social_profiles as $profile ) {
    			$social_profile = $this->helpers->options->get( $profile, '' );
    			if ( $social_profile !== '' ) {
    				$profiles[] = urldecode( $social_profile );
    			}
    		}
    
    		$twitter = $this->helpers->options->get( 'twitter_site', '' );
    		if ( $twitter !== '' ) {
    			$profiles[] = 'https://twitter.com/' . $twitter;
    		}
    
    		/**
    		 * Filter: 'wpseo_schema_organization_social_profiles' - Allows filtering social profiles for the
    		 * represented organization.
    		 *
    		 * @api string[] $profiles
    		 */
    		$profiles = \apply_filters( 'wpseo_schema_organization_social_profiles', $profiles );
    
    		return $profiles;
    	}
    

    But it can be refactored to this one:

    
    private function fetch_social_profiles() {
    		$profiles        = [];
    		$social_profiles = [
    			'facebook_site',
    			'instagram_url',
    			'linkedin_url',
    			'myspace_url',
    			'youtube_url',
    			'pinterest_url',
    			'wikipedia_url',
                            'twitter_site'
    		];
    		foreach ( $social_profiles as $profile ) {
    			$social_profile = $this->helpers->options->get( $profile, '' );
    			if ( $social_profile !== '' ) {
    			        $prefix     = ($profile === 'twitter_site') ? 'https://twitter.com/'  : '';
    				$profiles[] = urldecode( $prefix . $social_profile );
    			}
    		}
    
    		/**
    		 * Filter: 'wpseo_schema_organization_social_profiles' - Allows filtering social profiles for the
    		 * represented organization.
    		 *
    		 * @api string[] $profiles
    		 */
    		$profiles = \apply_filters( 'wpseo_schema_organization_social_profiles', $profiles );
    
    		return $profiles;
    	}
    

    I can give you other examples, but I think this is enough to understand what I mean.

    Cheers,

    • This reply was modified 4 years, 5 months ago by skarabeq.
    Thread Starter skarabeq

    (@skarabeq)

    Hi @mbrsolution,
    The issue is resolved. We increased the server resources.

    Thread Starter skarabeq

    (@skarabeq)

    Hi @wpsolutions,
    The file change detection and DB backups are disabled in the admin panel, but I’m not sure they are disabled. If there is some bug, and only it is visual looks like they are disabled, but they aren’t, this is eventual scenario.

    I saw the following cron events:

    Hook name: aiowps_hourly_cron_event
    Action: AIOWPSecurity_Cronjob_Handler->aiowps_hourly_cron_event_handler()
    Recurrence: Onece Hourly

    Hook name: aiowps_daily_cron_event
    Action: AIOWPSecurity_Cronjob_Handler->aiowps_daily_cron_event_handler()
    Recurrence: Once Daily

    Thread Starter skarabeq

    (@skarabeq)

    Thank you too!
    If you have any future information about that problem, could you please share with me here? Thank you!

    Kind regards

    Thread Starter skarabeq

    (@skarabeq)

    Hi,
    I have no info about server specs. But after removing the actions from the file all-in-one-wp-security-and-firewall/classes/wp-security-cronjob-handler.php

    do_action('aiowps_perform_scheduled_backup_tasks');
    do_action('aiowps_perform_fcd_scan_tasks');
    do_action('aiowps_perform_db_cleanup_tasks');

    The problem is solved. Before that, I have disabled files scanning from the admin panel, but unfortunately, it isn’t applied as well. I’m not sure only the action aiowps_perform_fcd_scan_tasks is the problem, but I suggest it is the main villain.

    I think this – AIOWPSecurity_Cronjob_Handler->aiowps_hourly_cron_event_handler() cron event is the main reason of the hight CPU usage. About this cron event AIOWPSecurity_Cronjob_Handler->aiowps_daily_cron_event_handler() I saw it hasn’t any code in the body of the method aiowps_daily_cron_event_handler.

    This is happening with the AIO version 4.4.0 and WordPress version 5.2.2.

    • This reply was modified 5 years, 2 months ago by skarabeq.
    • This reply was modified 5 years, 2 months ago by skarabeq.
    • This reply was modified 5 years, 2 months ago by skarabeq. Reason: Information about cron events
    Thread Starter skarabeq

    (@skarabeq)

    Hi,
    The website is located on the VM server.

    Thread Starter skarabeq

    (@skarabeq)

    Hi,
    I tried, but nothing happens. Also, I’ve tried to disable AIO and I’ve no high CPU usage. Any suggestions why is this happens?

    Thread Starter skarabeq

    (@skarabeq)

    It seems to work as well with wordpress 5.0.3 and polylang to 2.5.1.

    Thread Starter skarabeq

    (@skarabeq)

    The problem is solved by fix the permissions of the directory wp-content. In this directory WordFence can’t create the directory wflogs and may be can’t generate some required javascripts. I solve this problem when add permission of the directory wflogs.

    It will be better WordFence show the error for the problem in admin panel as error notice.

    • This reply was modified 6 years, 6 months ago by skarabeq. Reason: suggestion
    Thread Starter skarabeq

    (@skarabeq)

    Dear Print Friendly plugin support,

    Thank you for fast reaction. Now print icon again is available.

    P.S.: For future I suggest you to implement PHPUnit test and behat integration testes. With these tests you can prevent generation of bugs ??

    Cheers,

    • This reply was modified 7 years, 3 months ago by skarabeq.
    • This reply was modified 7 years, 3 months ago by skarabeq.
    Thread Starter skarabeq

    (@skarabeq)

    Thank you for your response David!

    Thread Starter skarabeq

    (@skarabeq)

    Thanks for fast issue fix.

Viewing 12 replies - 1 through 12 (of 12 total)