skarabeq
Forum Replies Created
-
Forum: Reviews
In reply to: [Yoast SEO] Bad code implementationHi, @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 methodgetPaginationHelperService
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.
Forum: Plugins
In reply to: [All-In-One Security (AIOS) – Security and Firewall] High CPU usageHi @mbrsolution,
The issue is resolved. We increased the server resources.Forum: Plugins
In reply to: [All-In-One Security (AIOS) – Security and Firewall] High CPU usageHi @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
Forum: Plugins
In reply to: [All-In-One Security (AIOS) – Security and Firewall] High CPU usageThank you too!
If you have any future information about that problem, could you please share with me here? Thank you!Kind regards
Forum: Plugins
In reply to: [All-In-One Security (AIOS) – Security and Firewall] High CPU usageHi,
I have no info about server specs. But after removing the actions from the fileall-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 eventAIOWPSecurity_Cronjob_Handler->aiowps_daily_cron_event_handler()
I saw it hasn’t any code in the body of the methodaiowps_daily_cron_event_handler
.This is happening with the AIO version 4.4.0 and WordPress version 5.2.2.
Forum: Plugins
In reply to: [All-In-One Security (AIOS) – Security and Firewall] High CPU usageHi,
The website is located on the VM server.Forum: Plugins
In reply to: [All-In-One Security (AIOS) – Security and Firewall] High CPU usageHi,
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?Forum: Plugins
In reply to: [Polylang] When update the polylang with WP 5.0.2 home page doesn’t workIt seems to work as well with wordpress 5.0.3 and polylang to 2.5.1.
The problem is solved by fix the permissions of the directory
wp-content
. In this directoryWordFence
can’t create the directorywflogs
and may be can’t generate some required javascripts. I solve this problem when add permission of the directorywflogs
.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
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,
Forum: Plugins
In reply to: [WPML to MultilingualPress] Error loading css language switchersThank you for your response David!
Forum: Plugins
In reply to: [Print, PDF, Email by PrintFriendly] error cdn imagesThanks for fast issue fix.