Thread Starter
Brad
(@boechslin)
As an update, I checked the upload folders on the WP server and the files seem to be missing. I certainly didn’t delete the files, is there any setting that I might have missed that could explain why the files were deleted from my ‘uploads’/’2015’/’01 folder?
Look in database for the filename that wp document revisions would have used.
In your theme function file add the following
if($r = $wpdb->get_results("SELECT meta_value FROM ".$wpdb->postmeta." WHERE meta_key='_wp_attached_file';"))
echo '<pre>'.print_r($r,true),'</pre>';
Then reload your admin interface to get a dump of all the filenames and relative path upload path… once you see the dump you can comment out the code above… just don’t reload.
Mine returns:
Array
(
[0] => stdClass Object
(
[meta_value] => 2015/02/0db560200ec202737130ac36ff6b3769.doc
)
[1] => stdClass Object
(
[meta_value] => 2015/02/9053bd318ff6cb81ff895c9d137f83c7.doc
)
...
)
If this is a multisite install, then the actual directory will be:
/wp-content/uploads/sites/<site id>/<year>/<month>/<filename>.<ext>
Now look for the files again, just to be sure that you are looking in the right place. We are also assuming that you didn’t override this using the general/network setting.
If you find the files, then check for the “Document Upload Directory” setting in your general/network settings to be sure that it didn’t default to something… If that field has something odd in it, then follow what I wrote to do here:
https://wordpress.org/support/topic/broken-and-unable-to-resolve-issue-myself-at-this-time?replies=7
Otherwise, I have no idea what happened… I’ve had WPDR do some weird things, but deleting files isn’t one of them… I am guessing they are misplaced or became unlinked by a revision cleaning or WordPress db optimization utility type thing maybe… just a guess.