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

During migration, cannot search/replace media upload field data in database #5829

Closed dingman closed 4 years ago

dingman commented 4 years ago

Describe the bug It seems that data it being stored in a manner that cannot be searched/replaced using migration plugins/scripts.

During each migration, local URLs for the media uploads are still being referenced as local files, and likewise when I pull down a database build, it continues using staging URLs. This only happens for the media upload field, all other fields get updated correctly.

To Reproduce Steps to reproduce the behavior: 1) Create a new Custom Settings Page 2) Create a field for File / Image / Video 3) Set the custom extensions to be "json" only

Expected behavior The expectation is that upon uploading a file on a local build, that during a migration, it would correctly get replaced with the new path for the new environment.

Screenshots image image

Pods Version

2.7.22

WordPress Environment

` ### wp-core ### version: 5.5.1 site_language: en_US user_language: en_US timezone: America/Los_Angeles permalink: /%postname%/ https_status: true multisite: false user_registration: 0 blog_public: 1 default_comment_status: open environment_type: production user_count: 4 dotorg_communication: true ### wp-paths-sizes ### wordpress_path: C:\Users\Jonathan\Local Sites\local-VVV\app\public wordpress_size: loading... uploads_path: C:\Users\Jonathan\Local Sites\local-VVV\app\public/wp-content/uploads uploads_size: loading... themes_path: C:\Users\Jonathan\Local Sites\local-VVV\app\public/wp-content/themes themes_size: loading... plugins_path: C:\Users\Jonathan\Local Sites\local-VVV\app\public/wp-content/plugins plugins_size: loading... database_size: loading... total_size: loading... ### wp-dropins (2) ### advanced-cache.php: true db-error.php: true ### wp-active-theme ### name: VVV 2.0 (VVV) version: 2.0.0 author: VVV author_website: https://VVV.com parent_theme: none theme_features: core-block-patterns, responsive-embeds, title-tag, post-thumbnails, menus theme_path: C:\Users\Jonathan\Local Sites\local-VVV\app\public/wp-content/themes/VVV auto_update: Disabled ### wp-themes-inactive (1) ### Twenty Twenty: version: 1.5, author: the WordPress team,Auto-updates disabled ### wp-mu-plugins (1) ### WP Migrate DB Pro Compatibility: version: 1.2, author: Delicious Brains ### wp-plugins-active (17) ### Admin Menu Editor: version: 1.9.7, author: Janis Elsts, Auto-updates enabled Better Admin Bar: version: 2.4, author: KubiQ, Auto-updates enabled Branda: version: 3.3.2, author: WPMU DEV, Auto-updates disabled Compress JPEG & PNG images: version: 3.2.1, author: TinyPNG, Auto-updates enabled Image Regenerate & Select Crop: version: 5.4.4, author: Iulia Cazan, Auto-updates enabled Pods - Custom Content Types and Fields: version: 2.7.22, author: Pods Framework Team, Auto-updates disabled Pods Advanced Permalinks Add-On: version: 0.1, author: Pods Framework Team, Auto-updates disabled Pods SEO: version: 2.2, author: Pods Framework Team, Auto-updates disabled Query Monitor: version: 3.6.4, author: John Blackbourn, Auto-updates enabled Regenerate Thumbnails: version: 3.1.3, author: Alex Mills (Viper007Bond), Auto-updates enabled UpdraftPlus - Backup/Restore: version: 2.16.29.24, author: UpdraftPlus.Com, DavidAnderson, Auto-updates disabled WP Migrate DB Pro: version: 1.9.12, author: Delicious Brains, Auto-updates disabled WP Migrate DB Pro CLI: version: 1.3.5, author: Delicious Brains, Auto-updates disabled WP Migrate DB Pro Media Files: version: 1.4.15, author: Delicious Brains, Auto-updates disabled WP Migrate DB Pro Theme & Plugin Files: version: 1.0.5, author: Delicious Brains, Auto-updates disabled WP Search with Algolia: version: 1.4.0, author: WebDevStudios, Auto-updates disabled Yoast SEO: version: 14.9, author: Team Yoast, Auto-updates enabled ### wp-plugins-inactive (1) ### WP Rollback: version: 1.7.1, author: Impress.org, Auto-updates disabled ### wp-media ### image_editor: WP_Image_Editor_Imagick imagick_module_version: 1799 imagemagick_version: ImageMagick 7.0.7-11 Q16 x64 2017-11-23 http://www.imagemagick.org file_uploads: File uploads is turned off post_max_size: 1000M upload_max_filesize: 300M max_effective_size: 300 MB max_file_uploads: 20 imagick_limits: imagick::RESOURCETYPE_AREA: 16 GB imagick::RESOURCETYPE_DISK: 1.844674407371E+19 imagick::RESOURCETYPE_FILE: 1536 imagick::RESOURCETYPE_MAP: 16 GB imagick::RESOURCETYPE_MEMORY: 8 GB imagick::RESOURCETYPE_THREAD: 6 gd_version: bundled (2.1.0 compatible) ghostscript_version: not available ### wp-server ### server_architecture: Windows NT 10.0 AMD64 httpd_software: nginx/1.16.0 php_version: 7.4.1 64bit php_sapi: cgi-fcgi max_input_variables: 4000 time_limit: 1200 memory_limit: 256M max_input_time: 600 upload_max_filesize: 300M php_post_max_size: 1000M curl_version: 7.67.0 OpenSSL/1.1.1d suhosin: false imagick_availability: true pretty_permalinks: true htaccess_extra_rules: false ### wp-database ### extension: mysqli server_version: 8.0.16 client_version: mysqlnd 7.4.1 ### wp-constants ### WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: C:\Users\Jonathan\Local Sites\local-VVV\app\public/wp-content WP_PLUGIN_DIR: C:\Users\Jonathan\Local Sites\local-VVV\app\public/wp-content/plugins WP_MAX_MEMORY_LIMIT: 256M WP_DEBUG: true WP_DEBUG_DISPLAY: false WP_DEBUG_LOG: true SCRIPT_DEBUG: false WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_LOCAL_DEV: undefined DB_CHARSET: utf8 DB_COLLATE: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable mu-plugins: writable ### pods ### pods-server-software: nginx/1.16.0 pods-user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36 pods-session-save-path: undefined pods-session-save-path-exists: No pods-session-save-path-writable: No pods-session-max-lifetime: 1440 pods-opcode-cache-apc: No pods-opcode-cache-memcached: No pods-opcode-cache-opcache: Yes pods-opcode-cache-redis: No pods-object-cache-apc: No pods-object-cache-apcu: No pods-object-cache-memcache: No pods-object-cache-memcached: No pods-object-cache-redis: No pods-memory-current-usage: 24.386M pods-memory-current-usage-real: 4.000M pods-network-wide: No pods-install-location: C:\Users\Jonathan\Local Sites\local-VVV\app\public\wp-content\plugins\pods/ pods-developer: No pods-tableless-mode: No pods-light-mode: No pods-strict: Yes pods-allow-deprecated: No pods-api-cache: Yes pods-shortcode-allow-evaluate-tags: No
issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label Type: Bug to this issue, with a confidence of 0.96. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

dingman commented 4 years ago

My hunch is that this is being stored this way because it's a Settings Page, so the data is being serialized

sc0ttkclark commented 4 years ago

Media library URLs are not stored by Pods, those are in the wp_posts.guid column, or in wp_postmeta.meta_value for the "attachment" posts themselves.

We store IDs for media and that's it. Everything else is managed by WordPress itself. For a Settings Page pod type, we also store the ID for that, which you'd look for in wp_options.option_value for the given wp_options.option_name

dingman commented 4 years ago

Thanks Scott. I'll check it during my next migration, I wonder if it's a transient issue and I just need to purge the cache to fix it. I'll report back the results.

dingman commented 4 years ago

Clearing the Pods cache did not fix this. It's still a persistent issue and trying to narrow down what could be causing it.

dingman commented 4 years ago

My next hunch is that it's related to me using the "guid" of the attachment, which seemingly breaks between environments.

JoryHogeveen commented 4 years ago

Hi @dingman If you are using the guid then that will most likely be your issue. The guid should never be used anywhere other than RSS feeds.

dingman commented 4 years ago

This was the issue. I switched away from guid and that fixed it.