pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.07k stars 265 forks source link

A WHERE by relationship ID no longer converts to JOINS #7098

Closed proxeeam closed 1 year ago

proxeeam commented 1 year ago

Description

In old Pods version, this code

$str = 'depar_concerned.ID = '.$id_dep['id']; $pod = pods( 'post' ); $params = array( 'limit' => 3 , 'orderby' => 'date DESC' ,  'where' => $str ); $pod = $pod->find( $params );

Produce this query

 SELECT DISTINCT `T`.*FROM `SIMON_POSTS` AS `T` LEFT JOIN `SIMON_PODSREL` AS `REL_DEPAR_CONCERNED` ON                           `REL_DEPAR_CONCERNED`.`FIELD_ID` = 10970 AND `REL_DEPAR_CONCERNED`.`ITEM_ID` = `T`.`ID`                         LEFT JOIN `SIMON_POSTS` AS `DEPAR_CONCERNED` ON `DEPAR_CONCERNED`.`ID` = `REL_DEPAR_CONCERNED`.`RELATED_ITEM_ID` WHERE ( ( `DEPAR_CONCERNED`.`ID` = 24176 ) AND ( `T`.`POST_TYPE` = 'POST' ) AND ( `T`.`POST_STATUS` IN ( 'PUBLISH' ) ) )  ORDER BY `T`.`POST_DATE` DESC, `T`.`MENU_ORDER`, `T`.`POST_TITLE`, `T`.`POST_DATE` LIMIT 0, 3

After migration to 2.9.13, now the same code have made all JOIN TABLES disappear ?

Version

2.9.13

Testing Instructions

No response

Screenshots / Screencast

No response

Possible Workaround

No response

Site Health Information

`
### wp-core ###

version: 6.2
site_language: fr_FR
user_language: fr_FR
timezone: +02:00
permalink: /%postname%/
https_status: true
multisite: false
user_registration: 0
blog_public: 1
default_comment_status: open
environment_type: production
user_count: 11
dotorg_communication: true

### wp-paths-sizes ###

wordpress_path: /home/simonassocies/www/simonassocies.com
wordpress_size: 140,65 Mo (147481741 bytes)
uploads_path: /home/simonassocies/www/simonassocies.com/wp-content/uploads
uploads_size: 4,25 Go (4562528957 bytes)
themes_path: /home/simonassocies/www/simonassocies.com/wp-content/themes
themes_size: 131,45 Mo (137834481 bytes)
plugins_path: /home/simonassocies/www/simonassocies.com/wp-content/plugins
plugins_size: 251,74 Mo (263967604 bytes)
database_size: 142,82 Mo (149754709 bytes)
total_size: 4,90 Go (5261567492 bytes)

### wp-dropins (1) ###

db.php: true

### wp-active-theme ###

name: TheFox Child Theme (thefox_child_theme)
version: 1.50
author: Tranmautritam Team
author_website: http://themeforest.net/user/tranmautritam?ref=tranmautritam
parent_theme: TheFox (thefox)
theme_features: core-block-patterns, woocommerce, widgets, post-thumbnails, automatic-feed-links, post-formats, menus
theme_path: /home/simonassocies/www/simonassocies.com/wp-content/themes/thefox_child_theme
auto_update: Désactivé

### wp-parent-theme ###

name: TheFox (thefox)
version: 3.9.42
author: Tranmautritam Team
author_website: http://themeforest.net/user/tranmautritam?ref=tranmautritam
theme_path: /home/simonassocies/www/simonassocies.com/wp-content/themes/thefox
auto_update: Désactivé

### wp-themes-inactive (5) ###

Twenty Nineteen: version: 2.5, author: L’équipe WordPress, Mises à jour auto désactivées
Twenty Twenty: version: 2.2, author: L’équipe WordPress, Mises à jour auto désactivées
Twenty Twenty-One: version: 1.8, author: L’équipe WordPress, Mises à jour auto désactivées
Twenty Twenty-Three: version: 1.1, author: L’équipe WordPress, Mises à jour auto désactivées
Twenty Twenty-Two: version: 1.4, author: L’équipe WordPress, Mises à jour auto désactivées

### wp-plugins-active (34) ###

3D FlipBook: version: 1.10.13, author: iberezansky, Mises à jour auto activées
Contact Form 7: version: 5.7.6, author: Takayuki Miyoshi (latest version: 5.7.7), Mises à jour auto désactivées
Contact Form CFDB7: version: 1.2.6.5, author: Arshid, Mises à jour auto désactivées
Contact Form Submissions: version: 1.7.3, author: Jason Green, Mises à jour auto activées
Cookie Notice & Compliance for GDPR / CCPA: version: 2.4.8, author: Hu-manity.co, Mises à jour auto désactivées
Disable Admin Notices Individually: version: 1.3.3, author: Creative Motion <info@cm-wp.com>, Mises à jour auto désactivées
Email Before Download: version: 6.9.6, author: M&S Consulting, Mises à jour auto désactivées
Enable jQuery Migrate Helper: version: 1.3.0, author: The WordPress Team, Mises à jour auto désactivées
iThemes Security: version: 8.1.6, author: iThemes, Mises à jour auto désactivées
Map Multi Marker: version: 3.0, author: Mickael Austoni, Mises à jour auto activées
MC4WP: Mailchimp for WordPress: version: 4.9.4, author: ibericode (latest version: 4.9.5), Mises à jour auto désactivées
Missed Scheduled Posts Publisher by WPBeginner: version: 1.0.1, author: WPBeginner, Mises à jour auto désactivées
Multiple Featured Images: version: 0.5.0, author: Marcus Kober, Mises à jour auto désactivées
Newsletter, SMTP, Email marketing and Subscribe forms by Sendinblue: version: 3.1.61, author: Sendinblue (latest version: 3.1.62), Mises à jour auto désactivées
PB SEO Friendly Images: version: 4.0.5, author: Pascal Bajorat, Mises à jour auto désactivées
Pods - Custom Content Types and Fields: version: 2.9.13, author: Pods Framework Team, Mises à jour auto activées
Post Duplicator: version: 2.28, author: Metaphor Creations (latest version: 2.31), Mises à jour auto désactivées
ProfilePress: version: 4.10.2, author: ProfilePress Membership Team (latest version: 4.10.3), Mises à jour auto désactivées
Query Monitor: version: 3.12.2, author: John Blackbourn (latest version: 3.12.3), Mises à jour auto désactivées
Redirection: version: 5.3.10, author: John Godley, Mises à jour auto désactivées
Redirection for Contact Form 7: version: 2.8.0, author: Qube One, Mises à jour auto désactivées
Simple History: version: 3.5.1, author: Pär Thernström, Mises à jour auto désactivées
Slider Revolution: version: 6.6.12, author: ThemePunch, Mises à jour auto activées
TheFox Custom Post: version: 3.1.1, author: Tranmautritam's Team, Mises à jour auto activées
User Role Editor: version: 4.63.3, author: Vladimir Garagulya, Mises à jour auto désactivées
User Switching: version: 1.7.0, author: John Blackbourn & contributors, Mises à jour auto désactivées
Visual Composer remove CSS3 animations: version: 2014.10.28, author: khromov, Mises à jour auto activées
Wordfence Security: version: 7.9.2, author: Wordfence (latest version: 7.9.3), Mises à jour auto désactivées
WPBakery Page Builder: version: 6.13.0, author: Michael M - WPBakery.com, Mises à jour auto désactivées
WP Mail SMTP: version: 3.8.0, author: WP Mail SMTP, Mises à jour auto désactivées
WPML Multilingual CMS: version: 4.6.3, author: OnTheGoSystems, Mises à jour auto désactivées
WPS Hide Login: version: 1.9.8, author: WPServeur, NicolasKulka, wpformation, Mises à jour auto désactivées
WP Sitemap Page: version: 1.9.2, author: Tony Archambeau, Mises à jour auto désactivées
Yoast SEO: version: 20.7, author: Team Yoast (latest version: 20.8), Mises à jour auto désactivées

### wp-plugins-inactive (2) ###

Download Monitor: version: 4.7.78, author: WPChill (latest version: 4.8.5), Mises à jour auto désactivées
Google Analytics Dashboard for WP (GADWP): version: 7.15.2, author: ExactMetrics (latest version: 7.15.3), Mises à jour auto désactivées

### wp-media ###

image_editor: WP_Image_Editor_GD
imagick_module_version: Non disponible
imagemagick_version: Non disponible
imagick_version: Non disponible
file_uploads: File uploads is turned off
post_max_size: 131M
upload_max_filesize: 130M
max_effective_size: 130 Mo
max_file_uploads: 20
gd_version: 2.3.0
gd_formats: GIF, JPEG, PNG, WebP, BMP, XPM
ghostscript_version: not available

### wp-server ###

server_architecture: Linux 5.15.0-70-generic x86_64
httpd_software: Apache/2.4.52
php_version: 8.1.2-1ubuntu2.11 64bit
php_sapi: fpm-fcgi
max_input_variables: 1000
time_limit: 30
memory_limit: 256M
max_input_time: 60
upload_max_filesize: 130M
php_post_max_size: 131M
curl_version: 7.81.0 OpenSSL/3.0.2
suhosin: false
imagick_availability: false
pretty_permalinks: true
htaccess_extra_rules: true

### wp-database ###

extension: mysqli
server_version: 10.6.12-MariaDB-0ubuntu0.22.04.1
client_version: mysqlnd 8.1.2-1ubuntu2.11
max_allowed_packet: 16777216
max_connections: 151

### wp-constants ###

WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /home/simonassocies/www/simonassocies.com/wp-content
WP_PLUGIN_DIR: /home/simonassocies/www/simonassocies.com/wp-content/plugins
WP_MEMORY_LIMIT: 256M
WP_MAX_MEMORY_LIMIT: 256M
WP_DEBUG: false
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: false
SCRIPT_DEBUG: false
WP_CACHE: false
CONCATENATE_SCRIPTS: false
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_ENVIRONMENT_TYPE: Indéfini
DB_CHARSET: utf8
DB_COLLATE: undefined

### wp-filesystem ###

wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable

### wp_mail_smtp ###

version: 3.8.0
license_key_type: lite
debug: Aucune notification de débogage trouvée.
lite_install_date: Nov 22, 2021 @ 4:51 

### pods ###

pods-server-software: Apache/2.4.52
pods-user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
pods-session-save-path: /var/lib/php/sessions
pods-session-save-path-exists: Oui
pods-session-save-path-writable: Oui
pods-session-max-lifetime: 1440
pods-opcode-cache-apc: Non
pods-opcode-cache-memcached: Non
pods-opcode-cache-opcache: Oui
pods-opcode-cache-redis: Non
pods-object-cache-apc: Non
pods-object-cache-apcu: Non
pods-object-cache-memcache: Non
pods-object-cache-memcached: Non
pods-object-cache-redis: Non
pods-memory-current-usage: 56,482M
pods-memory-current-usage-real: 58,000M
pods-network-wide: Non
pods-install-location: /wp-content/plugins/pods/
pods-developer: Non
pods-tableless-mode: Non
pods-relationship-table-enabled: Oui
pods-light-mode: Non
pods-strict: Non
pods-allow-deprecated: Oui
pods-api-cache: Oui
pods-shortcode-allow-evaluate-tags: Non
pods-sessions: Désactiver les sessions
pods-can-use-sessions: Oui
pods-relationship-table-status: 5,513

Pods Package

No response

proxeeam commented 1 year ago

pods-package-2023-06-13.txt

sc0ttkclark commented 1 year ago

I can't seem to reproduce this issue on my test site when using your entire package. This may need more research into your particular environment or there may be other factors involved.

                SELECT

                DISTINCT
                `t`.*
                FROM `wp_posts` AS `t`

                        LEFT JOIN `wp_podsrel` AS `rel_depar_concerned` ON
                            `rel_depar_concerned`.`field_id` = 51
                            AND `rel_depar_concerned`.`item_id` = `t`.`ID`

                        LEFT JOIN `wp_posts` AS `depar_concerned` ON
                            `depar_concerned`.`ID` = `rel_depar_concerned`.`related_item_id`

                WHERE ( ( `depar_concerned`.`ID` = 2 ) AND ( `t`.`post_type` = 'post' ) AND ( `t`.`post_status` IN ( 'publish' ) ) )

                ORDER BY `t`.`post_date` DESC, `t`.`menu_order`, `t`.`post_title`, `t`.`post_date`
                LIMIT 0, 3
JoryHogeveen commented 1 year ago

Closing topic due to inactivity. @proxeeam Feel free to reopen and reply to our comments.