Home
Documentation
Downloads
Demo
Tracker
Development
Translation
Moodle.net
Search
projects
/
moodle.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d106cf1
)
MDL-33127 Fixed the problem when storing draft files
author
Dongsheng Cai
<dongsheng@moodle.com>
Tue, 22 May 2012 06:50:47 +0000
(14:50 +0800)
committer
Dongsheng Cai
<dongsheng@moodle.com>
Tue, 22 May 2012 06:50:47 +0000
(14:50 +0800)
lib/filelib.php
patch
|
blob
|
blame
|
history
diff --git
a/lib/filelib.php
b/lib/filelib.php
index
aa3798e
..
948aa7c
100644
(file)
--- a/
lib/filelib.php
+++ b/
lib/filelib.php
@@
-732,8
+732,8
@@
function file_save_draft_area_files($draftitemid, $contextid, $component, $filea
} else if (count($oldfiles) < 2) {
$filecount = 0;
// there were no files before - one file means root dir only ;-)
} else if (count($oldfiles) < 2) {
$filecount = 0;
// there were no files before - one file means root dir only ;-)
- $file_record = array('contextid'=>$contextid, 'component'=>$component, 'filearea'=>$filearea, 'itemid'=>$itemid);
foreach ($draftfiles as $file) {
foreach ($draftfiles as $file) {
+ $file_record = array('contextid'=>$contextid, 'component'=>$component, 'filearea'=>$filearea, 'itemid'=>$itemid);
if (!$options['subdirs']) {
if ($file->get_filepath() !== '/' or $file->is_directory()) {
continue;
if (!$options['subdirs']) {
if ($file->get_filepath() !== '/' or $file->is_directory()) {
continue;
@@
-766,7
+766,6
@@
function file_save_draft_area_files($draftitemid, $contextid, $component, $filea
} else {
// we have to merge old and new files - we want to keep file ids for files that were not changed
// we change time modified for all new and changed files, we keep time created as is
} else {
// we have to merge old and new files - we want to keep file ids for files that were not changed
// we change time modified for all new and changed files, we keep time created as is
- $file_record = array('contextid'=>$contextid, 'component'=>$component, 'filearea'=>$filearea, 'itemid'=>$itemid, 'timemodified'=>time());
$newhashes = array();
foreach ($draftfiles as $file) {
$newhashes = array();
foreach ($draftfiles as $file) {
@@
-835,6
+834,7
@@
function file_save_draft_area_files($draftitemid, $contextid, $component, $filea
// Add fresh file or the file which has changed status
// the size and subdirectory tests are extra safety only, the UI should prevent it
foreach ($newhashes as $file) {
// Add fresh file or the file which has changed status
// the size and subdirectory tests are extra safety only, the UI should prevent it
foreach ($newhashes as $file) {
+ $file_record = array('contextid'=>$contextid, 'component'=>$component, 'filearea'=>$filearea, 'itemid'=>$itemid, 'timemodified'=>time());
if (!$options['subdirs']) {
if ($file->get_filepath() !== '/' or $file->is_directory()) {
continue;
if (!$options['subdirs']) {
if ($file->get_filepath() !== '/' or $file->is_directory()) {
continue;