WordPress.org

Ready to get started?Download WordPress

Forums

WP Media Cleaner
[resolved] The deletion of a media is PERMANENT (22 posts)

  1. Greybox
    Member
    Posted 9 months ago #

    The deletion of a media is PERMANENT.

    Why do you have this scary notice on the top of the plugin? Could you explain what do you mean by "PERMANENT"?

    Maybe it is not permanent, because, as per the next notice:

    "Deleted files will be moved to the 'uploads/wpmc-trash' directory."

    http://wordpress.org/plugins/wp-media-cleaner/

  2. Jordy Meow
    Member
    Plugin Author

    Posted 9 months ago #

    Actually the files are moved to the trash, but the media itself, as en entry in the database, is not. So it will be impossible to get this back.

  3. Greybox
    Member
    Posted 9 months ago #

    Please explain: "The media itself, as en entry in the database, is not <moved to trash>". Are you saying the file stays in the database? Are you talking about the file database or your plugin database or it's the same? If I clean the file with your plugin, I expect it to disappear from all databases and be moved to 'uploads/wpmc-trash' directory.

  4. Jordy Meow
    Member
    Plugin Author

    Posted 8 months ago #

    The file is not in the database, it is in the filesystem. But the file is referenced in the database and that is also why you can see it in the WP Media Library.

    If you delete a media using my plugin, both the file and the database entry is deleted. Because it's not possible (or a bit complicated) to restore the database entry, I remove both (file + database entry) permanently, hence the warning message.

    Sorry if it was not clear. If possible, can you suggest me a clearer message? My English is not native so it would be great to have my explanations, warnings and random messages a bit more straightforward.

    Thanks and sorry for the late reply.

  5. Greybox
    Member
    Posted 8 months ago #

    As I understand, you don't remove/delete the files, you move them to another directory and you delete the database entry. English is not my first language, but I would simply explain what will happen, something like:

    "Deleted files will be moved to the 'uploads/wpmc-trash' directory. Related database entries will be permanently removed."

  6. Jordy Meow
    Member
    Plugin Author

    Posted 8 months ago #

    Actually not.

    - When the plugin deletes a MEDIA file (from the MEDIA LIBRARY):
    It deletes the files on the filesystem in a permanent way and the database entry as well.

    - When the plugin deletes a file which is on the filesystem (/uploads/) but no in the MEDIA LIBRARY:
    The file is moved to the trash folder and it can be recovered.

    I can't use the trash for the MEDIA file because there is no way I can recover the database entry. So it's just better to be clear, delete both the file and entry and say that is not recoverable. Most of the time, the media the plugin detects actually don't have any files in the filesystem and are only database entry. It's in the database but the file is not there anymore. This is why it is tricky. The other common case is that there is a db entry and the file but that it is not used anywhere.

  7. Greybox
    Member
    Posted 8 months ago #

    Why there is a special care for the files that are in uploads folder, but not in the database? The moment you remove the related database reference, the situation becomes the same for both types of the files. I agree, there is no way you can recover the database entry if you delete the media file, but you can always re-upload and it is very easy to do it. And this would be much safer to move the files to uploads/wpmc-trash than dump them permanently. When the user is happy with the result, he can clean the uploads/wpmc-trash folder manually.

  8. Jordy Meow
    Member
    Plugin Author

    Posted 8 months ago #

    The files present in the file system but not in the DB (known as FILE type in the plugin) are often there because uploaded manually (FTP?) or created automatically by a plugin. It's a bit tricky to remove them hence the trash.

    I would love to use the trash with the other one (known as MEDIA type is the plugin) but there is no easy way to recover the DB entry. It's a bit strange to put the file in the trash but not to have the DB entry recoverable...

  9. Greybox
    Member
    Posted 8 months ago #

    I think it is very easy to recover the database entry. All you have to do is FTP the files from wpmc-trash to your computer and re-upload them back to the library the regular way. It is much more dangerous to lose the file forever by mistake permanently.

  10. Jordy Meow
    Member
    Plugin Author

    Posted 8 months ago #

    It is not easy at all for the lambda user. They will delete everything, thinking it is safe, then they will realize that they have to go in the trash folder and re upload all the files, losing the titles, the link between the post and images...

    Most people will complain and come back here stating the plugin doesn't work. That's why I chose to say that the MEDIA are not recoverable. The solution: backup database, backup the /uploads, and then if any issue it's easy to restore.

    If you think it's better (and it seems it is for you) I can definitely move the files from a media to the trash and make them recoverable. However, they will be referenced as FILE and not MEDIA anymore since re-creating the DB entry it way too tricky.

  11. Jordy Meow
    Member
    Plugin Author

    Posted 8 months ago #

    Sorry, there is something else I actually wanted to say :)

    Before, it seems there was a "trash" for the media. That's why I didn't want to handle it myself. Right now, for the media, I am using the WP API function to delete the media and to copy the files (the main file + the re-sized files) will be an extra step.

    It seems the trash function of WP for Media is now disabled or obsolete, I am not sure. I believe they will put it back, in that case it would be great and the plugin will definitely take advantage of it.

  12. Jordy Meow
    Member
    Plugin Author

    Posted 8 months ago #

    Actually... :
    http://en.support.wordpress.com/trash/

    It seems that for the WP team it is easy to move a standard post to trash but that it is way more tricky for a media. Which is why they write "delete permanently".

  13. Greybox
    Member
    Posted 8 months ago #

    If we are talking about the files marked as "Related content not found", then there is no link to the post/page, correct? The title is most likely automatically created from the file name, and re-editing the title is a small price to pay for the chance to ftp the file back to your computer and re-upload it again manually.

    I agree with you that moving the files from a media to a trash folder without a DB entry is the best solution.

    "losing the titles, the link between the post and images..."

  14. Greybox
    Member
    Posted 8 months ago #

    It would be great if you could do it with the latest WP code changes..

  15. Jordy Meow
    Member
    Plugin Author

    Posted 8 months ago #

    Related content not found = (for now) the image and none of the related re-sized images was found in any posts (in the content or attached).

    I can do that change : the files (there are more than one) will be moved to the trash folder and the lamba user will be able to restore them (you are an advanced user so you know you will have to re-upload in order to get the db entry back). Their websites will work again even though there will be no DB entry. I guess it's fine... or better than nothing for them. I will write a warning specifically for that DB entry.

    Unfortunately I don't think WordPress will implement a trash... I explored the idea for 30mn just now but realized that the ID of the media would be different anyway after restoration... therefore, it's impossible to do a perfect retrieval. WordPress has to simplement it directly (and avoid to remove the db entry, they should just "disable" it). A plugin can't do it or it will be full of dangerous overrides.

  16. Greybox
    Member
    Posted 8 months ago #

    I like the idea as long as the DB entry will also be deleted along with the file moved to the trash folder. Because our goal is also to clean the database.

  17. Jordy Meow
    Member
    Plugin Author

    Posted 8 months ago #

    Okay, just committed a new version of the plugin, it should be available in your WordPress soon. Please update and tell me what you think about it.

    To try it you can upload a new media without using it, start a scan with the plugin, delete the media, then try to get the files back. It's pretty straightforward I think.

    By the way, please help me by rating the plugin, too many got deceived by using it inappropriately :( This plugin is a difficult task because it does a dangerous operation. I don't think the users realize that.

  18. Greybox
    Member
    Posted 8 months ago #

    Works exactly as expected. Thank you! I will post into the rating as well.

  19. Jordy Meow
    Member
    Plugin Author

    Posted 8 months ago #

    Thanks! I really appreciate your feedbacks and help a lot. You are giving a second life to this plugin. Even though I would have still using it, I lost a bit of my motivation by the lack of positive ratings. I hope users will learn how to use it like you did :)

  20. Greybox
    Member
    Posted 8 months ago #

    Thank you! I think lots of people just use it without giving any feedback. Look at the statistics: 3,481+ downloads total. Only yesterday there were 84 downloads - most likely updates and those actively use this plugin which is as beautiful as this song:-)

    http://www.youtube.com/watch?v=PTpgY00-hhQ

  21. Jordy Meow
    Member
    Plugin Author

    Posted 8 months ago #

    Thanks a lot Greybox! If all the users were like you I'd be rich and all the plugins would be full of features and rid of all the bugs :)

    Ghibli? Of course! Hey, but you checked my website, right? ;)

  22. Greybox
    Member
    Posted 8 months ago #

    Yep, and I like My Neighbor Totoro!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.