chief1983
Forum Replies Created
-
Forum: Plugins
In reply to: [reCaptcha by BestWebSoft] Errors updating version 1.66 to 1.67I gave this a shot and tried the upgrade on our stage environment anyway. Lots of these coming in from Sentry as people click around. We’ll be stuck on 1.66 until the following code is adjusted to be safe in more environments:
WP_Filesystem(); if ( ! $wp_filesystem->exists( dirname( __FILE__ ) . '/css/jquery-ui-styles/' . $jquery_ui_version . '/' ) ) { $jquery_ui_version = '1.12.1'; }
As multiple users are running into this issue, it might be helpful to find out what configuration we have in common.
Forum: Plugins
In reply to: [reCaptcha by BestWebSoft] Errors updating version 1.66 to 1.67@andrewsupport Actually I came here today looking to see if anyone else reported something similar to this issue. I am performing regular software upgrades and when going from 1.66 to 1.67, I also see three warnings coming from this plugin.
Warning ftp_nlist() expects parameter 1 to be resource, null given 1 wp-admin/includes/class-wp-filesystem-ftpext.php:420 ftp_nlist() wp-admin/includes/class-wp-filesystem-ftpext.php:420 WP_Filesystem_FTPext->exists() wp-content/plugins/google-captcha/bws_menu/bws_functions.php:748 bws_admin_enqueue_scripts() wp-includes/class-wp-hook.php:307 do_action('admin_enqueue_scripts') wp-admin/admin-header.php:118 Plugin: google-captcha Warning ftp_pwd() expects parameter 1 to be resource, null given 2 wp-admin/includes/class-wp-filesystem-ftpext.php:230 ftp_pwd() wp-admin/includes/class-wp-filesystem-ftpext.php:230 WP_Filesystem_FTPext->cwd() wp-admin/includes/class-wp-filesystem-ftpext.php:450 WP_Filesystem_FTPext->is_dir() wp-admin/includes/class-wp-filesystem-ftpext.php:422 WP_Filesystem_FTPext->exists() wp-content/plugins/google-captcha/bws_menu/bws_functions.php:748 bws_admin_enqueue_scripts() wp-includes/class-wp-hook.php:307 do_action('admin_enqueue_scripts') wp-admin/admin-header.php:118 Plugin: google-captcha Warning (Suppressed) ftp_chdir() expects parameter 1 to be resource, null given 1 wp-admin/includes/class-wp-filesystem-ftpext.php:451 ftp_chdir() wp-admin/includes/class-wp-filesystem-ftpext.php:451 WP_Filesystem_FTPext->is_dir() wp-admin/includes/class-wp-filesystem-ftpext.php:422 WP_Filesystem_FTPext->exists() wp-content/plugins/google-captcha/bws_menu/bws_functions.php:748 bws_admin_enqueue_scripts() wp-includes/class-wp-hook.php:307 do_action('admin_enqueue_scripts') wp-admin/admin-header.php:118 Plugin: google-captcha
Warning level messages make it to our logging system so we won’t be able to upgrade until this is rectified somehow.
If it helps, we don’t use any FTP facilities at all to manage our sites, they are run in Docker containers and deployed to AWS Fargate. We also have local file modification disabled in WP since we don’t actually modify the filesystem of deployed containers via the UI. I don’t believe the current usage of WP_Filesystem() is safe in all use cases, such as ours.
Edit: These warnings occurred for me just loading the WP Admin home page after upgrading.
- This reply was modified 2 years, 6 months ago by chief1983.
Forum: Plugins
In reply to: [Shutterstock] WP 5.8 explode() Warning in class.wp-dependencies.phpWe deployed this somewhat recently, but realized it caused a significant impact on website performance (LCP values went above 2.5 or 4s for most of our pages). It appears the attempt to split the required styles and scripts between the editor_style/script and style/script block types causes editor assets to be requested on non-editor pages, such as article viewing. This will have significant performance impacts for anyone using the plugin. We’re putting in a filter on our end in the meantime to pop those out of the queue when the editor is not running, but this is probably something that will need to be addressed differently for other users of the plugin.
Forum: Plugins
In reply to: [Shutterstock] WP 5.8 explode() Warning in class.wp-dependencies.phpIt was reported by another user that the Shutterstock plugin appears a bit broken now in WP 5.8, so this bug might actually be resulting in this breakage. It was reported that the download tab is no longer available when the block is pulled up.
Sorry about that last patch I sent having the PHP [] array syntax. The patch I posted above had that edited out, but the file I zipped up had the PHP7 syntax I am using more frequently. I had switched the test for the page to use in_array since that would be easier to expand in the future, if the plugin ever adds any more pages to that list. But I should have used array() in the file and not the [] syntax I sent over. It’s hard to switch between backwards compatibility mindset when working on plugin patches, and using all the new bells and whistles for my team’s internal development since we are only worried about PHP 7.3+.
Thanks again!
Sure thing, I just sent it over.
I am curious if the log table is ever needed before the optimizer actually starts. If so, something like this might work? Also used the page check in the init to attempt to make it before actually kicking off the optimizer, but I’m not sure that’s necessary. This moves the creation into its own function that can be called from either place. I tested deactivation, activation, ensure that when the time comes around, the odb_start function is actually triggered, the cron event comes and goes when it should, etc. Perhaps this provides some ideas at least? Also cleaned up a few seemingly unused variable references after the rearranging.
diff --git a/rvg-optimize-database.php b/rvg-optimize-database.php index f81ff37..2a5f162 100644 --- a/rvg-optimize-database.php +++ b/rvg-optimize-database.php @@ -1,7 +1,7 @@ <?php /** * @package Optimize Database after Deleting Revisions - * @version 5.0.7 + * @version 5.0.8^M */ /* Plugin Name: Optimize Database after Deleting Revisions @@ -10,7 +10,7 @@ Description: Optimizes the WordPress Database after Cleaning it out Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands Author URI: https://cagewebdev.com Network: True -Version: 5.0.7 +Version: 5.0.8^M */ /******************************************************************************************** @@ -28,8 +28,8 @@ $odb_class = new OptimizeDatabase(); class OptimizeDatabase { // VERSION - var $odb_version = '5.0.7'; - var $odb_release_date = '07/24/2021'; + var $odb_version = '5.0.8';^M + var $odb_release_date = '07/29/2021';^M // PLUGIN OPTIONS var $odb_rvg_options = array(); @@ -92,50 +92,15 @@ class OptimizeDatabase { * INITIALIZE PLUGIN *******************************************************************************/ function odb_init() { - global $wpdb; - // LOAD CLASSES $this->odb_classes(); // URLS AND DIRECTORIES $this->odb_urls_dirs(); - $this->odb_tables = $this->odb_utilities_obj->odb_get_tables(); - - // CREATE LOG TABLE (IF NOT EXISTS) - v4.6 - $this->odb_logtable_name = $wpdb->base_prefix . 'odb_logs'; - - $found = false; - for($i = 0; $i < count($this->odb_tables); $i++) { - if ($this->odb_tables[$i][0] == $this->odb_logtable_name) { - $found = true; - } - } // for($i = 0; $i < count($this->odb_tables); $i++) - - // v5.0.3 - if (!$found) { - $sql = ' - CREATE TABLE IF NOT EXISTS <code>' . $this->odb_logtable_name . '</code> ( - <code>odb_id</code> int(11) NOT NULL AUTO_INCREMENT, - <code>odb_timestamp</code> varchar(20) NOT NULL, - <code>odb_revisions</code> int(11) NOT NULL, - <code>odb_trash</code> int(11) NOT NULL, - <code>odb_spam</code> int(11) NOT NULL, - <code>odb_tags</code> int(11) NOT NULL, - <code>odb_transients</code> int(11) NOT NULL, - <code>odb_pingbacks</code> int(11) NOT NULL, - <code>odb_oembeds</code> int(11) NOT NULL, - <code>odb_orphans</code> int(11) NOT NULL, - <code>odb_tables</code> int(11) NOT NULL, - <code>odb_before</code> varchar(20) NOT NULL, - <code>odb_after</code> varchar(20) NOT NULL, - <code>odb_savings</code> varchar(20) NOT NULL, - PRIMARY KEY (<code>odb_id</code>) - ) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; - '; - - // CREATE TABLE - $wpdb->get_results($sql); + // 5.0.8 This may not even be necessary anymore^M + if ($this->odb_is_relevant_page()) {^M + $this->odb_create_log_table();^M } // GET (MULTI-SITE) NETWORK INFORMATION @@ -154,8 +119,6 @@ class OptimizeDatabase { $this->odb_minify = (defined('WP_DEBUG') && WP_DEBUG) ? '' : '.min'; // LOAD STYLE SHEET (ONLY ON RELEVANT PAGES) - $this_page = ''; - if(isset($_GET['page'])) $this_page = $_GET['page']; // v4.0.3 if($this->odb_is_relevant_page()) { wp_register_style('odb-style'.$this->odb_version, plugins_url('css/style'.$this->odb_minify.'.css', __FILE__)); @@ -575,7 +538,7 @@ class OptimizeDatabase { function odb_is_relevant_page() { $this_page = ''; if(isset($_GET['page'])) $this_page = $_GET['page']; - return ($this_page == 'odb_settings_page' || $this_page == 'rvg-optimize-database'); + return (in_array($this_page, array('odb_settings_page', 'rvg-optimize-database')));^M } // odb_is_relevant_page() @@ -644,14 +607,58 @@ class OptimizeDatabase { } // odb_start_scheduler() + function odb_create_log_table() {^M + global $wpdb;^M +^M + // PLUGIN RUNNING (v5.0.5)^M + $this->odb_tables = $this->odb_utilities_obj->odb_get_tables();^M +^M + // CREATE LOG TABLE (IF NOT EXISTS) - v4.6^M + $this->odb_logtable_name = $wpdb->base_prefix . 'odb_logs';^M +^M + $found = false;^M + for($i = 0; $i < count($this->odb_tables); $i++) {^M + if ($this->odb_tables[$i][0] == $this->odb_logtable_name) {^M + $found = true;^M + }^M + } // for($i = 0; $i < count($this->odb_tables); $i++)^M +^M + // v5.0.3^M + if (!$found) {^M + $sql = '^M + CREATE TABLE IF NOT EXISTS <code>' . $this->odb_logtable_name . '</code> (^M + <code>odb_id</code> int(11) NOT NULL AUTO_INCREMENT,^M + <code>odb_timestamp</code> varchar(20) NOT NULL,^M + <code>odb_revisions</code> int(11) NOT NULL,^M + <code>odb_trash</code> int(11) NOT NULL,^M + <code>odb_spam</code> int(11) NOT NULL,^M + <code>odb_tags</code> int(11) NOT NULL,^M + <code>odb_transients</code> int(11) NOT NULL,^M + <code>odb_pingbacks</code> int(11) NOT NULL,^M + <code>odb_oembeds</code> int(11) NOT NULL,^M + <code>odb_orphans</code> int(11) NOT NULL,^M + <code>odb_tables</code> int(11) NOT NULL,^M + <code>odb_before</code> varchar(20) NOT NULL,^M + <code>odb_after</code> varchar(20) NOT NULL,^M + <code>odb_savings</code> varchar(20) NOT NULL,^M + PRIMARY KEY (<code>odb_id</code>)^M + ) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;^M + ';^M +^M + // CREATE TABLE^M + $wpdb->query($sql);^M + }^M + }^M +^M +^M /******************************************************************************* * * MAIN METHOD FOR CLEANING / OPTIMIZING * *******************************************************************************/ function odb_start($scheduler) { - global $wpdb; - + $this->odb_create_log_table();^M +^M // PAGE LOAD TIMER $time = microtime(); $time = explode(' ', $time);
- This reply was modified 3 years, 7 months ago by chief1983.
I am sorry to see that this fix apparently caused some problems with the scheduler. For what it’s worth, since we already had it scheduled on production, I am guessing that allowed it to keep working after we upgraded to the new version (I am running 5.0.5 live and WP-Crontrol shows the optimizer entry still in the cron events, scheduled every day). I would be happy to do more testing of a pre-release version to make sure that it solves both the scheduler issue and the unnecessary SQL queries. I would even be able to test from a simple .patch file as I am a PHP developer myself and we developer our own internal plugin as well.
Forum: Plugins
In reply to: [Yoast SEO] Repeated UPDATE Query Bug with Yoast + RedisSorry, I went through the account dashboard, and still somehow ended up at this forum when trying to find a place to file a ticket. I’ll go another route.
Wow, that was incredible turnaround! Thanks for looking into it, I’ll be sure to let you know. May not be able to tell for sure until it goes to production, where the high traffic makes the behavior apparent.