Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "File Un-Attach" plugin from cjet theme #118

Open
benlk opened this issue Nov 11, 2019 · 12 comments
Open

Remove "File Un-Attach" plugin from cjet theme #118

benlk opened this issue Nov 11, 2019 · 12 comments

Comments

@benlk
Copy link
Collaborator

benlk commented Nov 11, 2019

https://wordpress.org/plugins/file-un-attach/
https://github.com/INN/umbrella-inndev/tree/master/wp-content/themes/cjet/lib/file-un-attach

This is what's causing the image problems on learn.inn.org

@benlk
Copy link
Collaborator Author

benlk commented Nov 16, 2019

@MirandaEcho
Copy link
Collaborator

MirandaEcho commented Nov 16, 2019 via email

@benlk
Copy link
Collaborator Author

benlk commented Nov 19, 2019

Further adventures of find-the-file, thanks to a find . on inndev's staging:

localhost: https://inndev.test/wp-content/uploads/sites/3/2019/08/noun_management_1871553-336x336-336x336.png
  staging: https://inndev.test/wp-content/uploads/2019/08/noun_management_1871553-336x336-336x336.png

so my local dev site doesn't have a db that matches the staging site's DB.

@benlk
Copy link
Collaborator Author

benlk commented Nov 19, 2019

After resetting localhost from inndev staging:

localhost: https://inndevlearn.wpengine.com/wp-content/uploads/sites/3/2019/08/noun_management_1871553-336x336-336x336.png

so, uh, it looks like http://learn-inn-org.inndev.staging.wpengine.com/ is using a DB from inndevlearn.wpengine.com

@benlk
Copy link
Collaborator Author

benlk commented Nov 19, 2019

After resetting localhost from inndev live, here's that same thumbnail:

    localhost: https://inndev.test/wp-content/uploads/sites/3/2019/06/noun_management_1871553-336x336.png
learn.inn.org: https://inn.org/wp-content/uploads/2019/08/noun_management_1871553-336x336-336x336.png
 staging find: wp-content/uploads/2019/08/noun_management_1871553-336x336-336x336.png

It shows up in the learn.inn.org media library, and find . on inndev staging reports that the file is found at wp-content/uploads/2019/08/noun_management_1871553-336x336-336x336.png which matches the expected path.

So we need a different image.

    localhost: https://inndev.test/wp-content/uploads/sites/3/2019/07/noun_guide_2362366-336x336.png
learn.inn.org: https://inn.org/wp-content/uploads/2019/07/noun_guide_2362366-336x336.png
 staging find: not found

@benlk
Copy link
Collaborator Author

benlk commented Nov 19, 2019

Found a must-use plugin on inn.org that wasn't on my localhost: change-upload-paths.php

<?php
/*
  Plugin Name: Change Uploads Paths
  Plugin URI: http://investigativenewsnetwork.org
  Description: Use the main uploads folder for all blogs
  Author: Adam Schweigert
  Version: 0.1
 */

add_filter('upload_dir', 'ms_global_upload_dir');

function ms_global_upload_dir($uploads)
{
    $ms_dir = '/sites/' . get_current_blog_id();

    $uploads['path']    = str_replace($ms_dir, "", $uploads['path']);
    $uploads['url']     = str_replace($ms_dir, "", $uploads['url']);
    $uploads['basedir'] = str_replace($ms_dir, "", $uploads['basedir']);
    $uploads['baseurl'] = str_replace($ms_dir, "", $uploads['baseurl']);

    return $uploads;
}

This explains where /sites/3 was coming from in the localhost URLs above, but it doesn't explain why the images are not present on any of the sites at any path.

@benlk
Copy link
Collaborator Author

benlk commented Nov 19, 2019

These image files do not exist on prod at any image size.

@benlk
Copy link
Collaborator Author

benlk commented Nov 19, 2019

These image files do not exist on the learninndev site, used for staging Learn.

@MirandaEcho I don't think this is a problem with the "File Un-Attach" plugin. I think these images are legitimately not present on the servers that are trying to use them.

New questions:

  • We will have to re-upload these images.
    • Do we still have copies of them?
    • Do they exist in any site backup?
    • Do we have a comprehensive list of missing original images, that can be reuploaded and then have Regenerate Thumbnails run against them to recreate all the other image sizes?
  • How did they go missing?

@benlk
Copy link
Collaborator Author

benlk commented Nov 19, 2019

the original issue was that new images couldn't be uploaded or added, and the media gallery wasn't visible to users.

@benlk
Copy link
Collaborator Author

benlk commented Nov 20, 2019

I can't reproduce the issue where images can't be uploaded or added, or the media gallery not being visible to users. The media gallery remains visible to my super-admin user, and I can upload images.

With the plugin active, note the weird formatting of the "close" button:

Screen Shot 2019-11-19 at 23 00 35

With the plugin removed, note the changed appearance of the "close" button:

Screen Shot 2019-11-19 at 23 00 20

So the plugin is doing something here. The next steps would be to create a user whose permissions match the affected users' permissions, and try from there.

@MirandaEcho do we just want to go ahead and remove the plugin rather than verifying that removing the plugin solves the problem?

@benlk
Copy link
Collaborator Author

benlk commented Nov 20, 2019

Removing the File Un-Attach plugin from the child theme gives us the functional Media Library:

Screen Shot 2019-11-20 at 11 40 02

@benlk benlk mentioned this issue Nov 21, 2019
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants