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.”
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.
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.
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.
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.”
– 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.
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.
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…
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.
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.
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.
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”.
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…”
It would be great if you could do it with the latest WP code changes..
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.
- The topic ‘The deletion of a media is PERMANENT’ is closed to new replies.