Project

General

Profile

Actions

Support #22028

closed

Advanced Views Framework plugin problem

Added by Marilyn Weber about 1 month ago. Updated 30 days ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
WordPress Plugins
Target version:
Start date:
2025-02-07
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

Joseph Pentangelo

I'm writing because the Macaulay Honors College's website for Night at the Museum is displaying a number of error messages relating to the Advanced Views Framework plugin. Example pages here and here. When I view the plugin itself on the dashboard, it returns the following error message:
The templates directory is not writable. (path = /var/www/webroot/ROOT/wp-content/blogs.dir/34628/files/acf-views)
Most likely, the WordPress uploads directory is not writable.
Check and fix file permissions, then deactivate and activate back the Advanced Views plugin. If the issue persists, contact support.
I think that this probably has to do with the recent hosting switch. Can you please let me know if there are any steps we can take to fix this? We have a ton of student-generated content on there that we really don't want to lose.

Actions #1

Updated by Marilyn Weber about 1 month ago

Here's more info:

STEAM Fest 2024
https://steam2024.commons.gc.cuny.edu/ - Throughout this site.
https://steam2024.commons.gc.cuny.edu/2024/12/16/the-influence-of-hymenoptera-species-in-urban-areas/ - An example entry from that site.

Night at the Museum
https://natm.commons.gc.cuny.edu/- Throughout this site.
https://natm.commons.gc.cuny.edu/your-reflections/ - One page that shows the problem.
https://natm.commons.gc.cuny.edu/your-gallery/ - Another page that shows the problem

Actions #2

Updated by Boone Gorges about 1 month ago

  • Category name set to WordPress Plugins
  • Status changed from New to Testing Required
  • Assignee set to Boone Gorges
  • Target version set to 2.5.2

It looks like some links were lost when creating the ticket. The site in question is https://natm.commons.gc.cuny.edu/ and it appears that an affected URL is https://natm.commons.gc.cuny.edu/your-gallery/

After a bit of investigation, it looks like there's an incompatibility between the way the acf-views plugin works and the way that s3-uploads filters upload paths. The plugin initializes itself immediately when the plugin file is loaded during the WP bootstrap:

https://github.com/cuny-academic-commons/cac/blob/70f7bb4a79d66ba7c9b9b727e96176cccf80b75f/wp-content/plugins/acf-views/acf-views.php#L82
https://github.com/cuny-academic-commons/cac/blob/70f7bb4a79d66ba7c9b9b727e96176cccf80b75f/wp-content/plugins/acf-views/acf-views.php#L621

At that time, the plugin determines its "uploads_folder" using wp_upload_dir() https://github.com/cuny-academic-commons/cac/blob/70f7bb4a79d66ba7c9b9b727e96176cccf80b75f/wp-content/plugins/acf-views/acf-views.php#L151

The problem is that, at this point, the s3-uploads isn't yet initialized. Like a good plugin, it waits until plugins_loaded: https://github.com/cuny-academic-commons/cac/blob/70f7bb4a79d66ba7c9b9b727e96176cccf80b75f/wp-content/plugins/s3-uploads/s3-uploads.php#L13

As a result, acf-views believes that its upload path should be in the filesystem. But by the time it actually tries to write to the filesystem, s3-uploads has loaded its stream wrapper, which points these file operations to S3. This means that checks like is_writable( $uploads_folder ) fail.

If I replace the plugin's call to init() with this, it works:

add_action(
  'plugins_loaded',
  function() use ( $acf_views ) {
    $acf_views->init();
  }
);

I tried a half-dozen workarounds (allowing filesystem writes for this plugin, reinitializing the plugin with reflection classes, etc) but nothing worked. I went with the unpleasant approach of preventing the plugin from being loaded during the WP bootstrap, and delaying it to plugins_loaded:1 https://github.com/cuny-academic-commons/cac/commit/04b66f9688460e30e4a3253ce85a0266660fa592

Ray and Jeremy, I share this approach here in case you need it in the future, or in case you have a better idea or a warning about how this might break things.

Marilyn, it appears that the pages are working as expected, but I'm not certain how all of the sites are supposed to work, so perhaps you could check back with the reporter.

Actions #3

Updated by Marilyn Weber about 1 month ago

They reply "It looks great, thank you!"

Hooray! This can be closed!

Actions #4

Updated by Boone Gorges 30 days ago

  • Status changed from Testing Required to Resolved

Very good, thanks for confirming.

Actions

Also available in: Atom PDF