PostgreSQL-For-Wordpress / postgresql-for-wordpress

A maintained fork of https://wordpress.org/plugins/postgresql-for-wordpress/
GNU General Public License v2.0
209 stars 68 forks source link

Test / Fix Yoast SEO plugin and add to list of supported plugins #80

Open mattbucci opened 8 months ago

mattbucci commented 8 months ago

https://wordpress.org/plugins/wordpress-seo/

Not working per: https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress/issues/73

hahnn commented 4 months ago

Retested this plugin today and it's still not working:

[Sun Mar 10 16:50:46.165595 2024] [php:error] [pid 21125] [client XX.XX.XX.XX:52306] PHP Fatal error:  Uncaught TypeError: Yoast\\WP\\SEO\\Repositories\\Indexable_Repository::__construct(): Argument #5 ($wpdb) must be of type wpdb, wpdb2 given, called in wp-content/plugins/wordpress-seo/src/generated/container.php on line 5134 and defined in wp-content/plugins/wordpress-seo/src/repositories/indexable-repository.php:80\n
Stack trace:\n
#0 wp-content/plugins/wordpress-seo/src/generated/container.php(5134): Yoast\\WP\\SEO\\Repositories\\Indexable_Repository->__construct()\n
#1 wp-content/plugins/wordpress-seo/vendor_prefixed/symfony/dependency-injection/Container.php(271): Yoast\\WP\\SEO\\Generated\\Cached_Container->getIndexableRepositoryService()\n
#2 wp-content/plugins/wordpress-seo/src/surfaces/classes-surface.php(38): YoastSEO_Vendor\\Symfony\\Component\\DependencyInjection\\Container->get()\n
#3 wp-content/plugins/wordpress-seo/inc/class-wpseo-admin-bar-menu.php(132): Yoast\\WP\\SEO\\Surfaces\\Classes_Surface->get()\n
#4 wp-content/plugins/wordpress-seo/inc/wpseo-non-ajax-functions.php(20): WPSEO_Admin_Bar_Menu->__construct()\n
#5 wp-includes/class-wp-hook.php(324): wpseo_initialize_admin_bar()\n
#6 wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()\n
#7 wp-includes/plugin.php(517): WP_Hook->do_action()\n
#8 wp-settings.php(665): do_action()\n
#9 wp-config.php(96): require_once('...')\n
#10 wp-load.php(50): require_once('...')\n
#11 wp-admin/admin.php(34): require_once('...')\n
#12 wp-admin/plugins.php(10): require_once('...')\n
#13 {main}\n  thrown in wp-content/plugins/wordpress-seo/src/repositories/indexable-repository.php on line 80, referer: https://www.XXXXXXXXXXXX.XX/wp-admin/plugins.php?plugin=booking%2Fwpdev-booking.php
mattbucci commented 4 months ago

it seems that we won't be able to overwrite the wbdb type.

We rewrite this to wpdb2 here: https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress/blob/c7e3fbd50bb5363c84b39a611f65b9c699c7f63f/pg4wp/core.php#L23

I thought maybe we can just change this to wpdb but no we can't because default wordpress driver file is loaded first here: https://github.com/WordPress/WordPress/blob/8e5e7a3a1124cc9db3f4716beaf7a669e5218498/wp-includes/load.php#L672

before our db.php

instead I think we must change our rewrite to rewrite to class wpdb2 extends wpdb this way we are implementing the same class and yoast will be happy.