MDL-39177 Discard file origin when moving/renaming a file in filemanager

Created one function that handles file update to be used from both JS and nonJS filepicker
MDL-39177 Update file in filearea only if original is present

Now when file was deleted in filemanager and new file with the same file was uploaded the references will be converted to copies exactly like UI warns in filemanager.
Also do not delete original information from draftfiles.
MDL-39177 Remove code duplication
MDL-39177 Perform all checks on draftfile area before saving the files
archive - v1 basic
MDL-39177 Ensure files are overwritten correctly on unzip
MDL-39177 New function file_storage::get_unused_dirname()