Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-32639 files: Zipping a folder does not overwrite existing files

  • Loading branch information...
commit 03f8841d9b809e35f228ffb2415f027e188c9795 1 parent aa4d973
@FMCorz FMCorz authored
View
3  repository/draftfiles_ajax.php
@@ -222,8 +222,9 @@
$filepath = explode('/', trim($file->get_filepath(), '/'));
$filepath = array_pop($filepath);
+ $zipfile = repository::get_unused_filename($draftid, $parent_path, $filepath . '.zip');
- if ($newfile = $zipper->archive_to_storage(array($filepath => $file), $user_context->id, 'user', 'draft', $draftid, $parent_path, $filepath.'.zip', $USER->id)) {
+ if ($newfile = $zipper->archive_to_storage(array($filepath => $file), $user_context->id, 'user', 'draft', $draftid, $parent_path, $zipfile, $USER->id)) {
$return = new stdClass();
$return->filepath = $parent_path;
echo json_encode($return);
View
1  repository/draftfiles_manager.php
@@ -168,6 +168,7 @@
$filename = $filepath.'.zip';
}
+ $filename = repository::get_unused_filename($itemid, $parent_path, $filename);
$newfile = $zipper->archive_to_storage(array($filepath => $file), $user_context->id, 'user', 'draft', $itemid, $parent_path, $filename, $USER->id);
$home_url->param('action', 'browse');
Please sign in to comment.
Something went wrong with that request. Please try again.