Manual:$wgSaveDeletedFiles

Details
This setting specifies that files that are deleted via the wiki interface should not be physically removed from the disk, but instead moved out of the way and marked as 'deleted' in the database (in the same way wiki pages are).

MediaWiki 1.11.0 and above
This setting was removed in MediaWiki 1.11.0 as the option is now enabled unconditionally.  'HOW DO I DEACTIVATE SaveDeletedFiles NOW!? STUPID MEDIAWIKI I AM RUNNING OUT OF SERVER SPACE I NEED TO DISABLE THIS!!'

Earlier versions
Prior to MediaWiki 1.11.0, deleted files were simply discarded by default. To save them and make it possible to undelete images:
 * 1) create a directory which is writable to the web server, but not exposed to the Internet;
 * 2) Set $wgSaveDeletedFiles to true;
 * 3) Set up the save path in $wgFileStore['deleted']['directory'].

Examples
Here are the default settings, which disable all support for undeletion:

Here are the modified settings, which store all deleted images in :