-
Bug
-
Resolution: Fixed
-
Blocker
-
2.5.3, 2.6
-
MOODLE_25_STABLE, MOODLE_26_STABLE
-
MOODLE_25_STABLE, MOODLE_26_STABLE
-
MDL-42882-master -
- Run unit tests on all databases.
-
20
-
BACKEND Sprint 10
In the update process for version 2013051402.10 there is a fix for missing root folder entries. (File: lib/db/upgrade.php line 2216)
To find the fileareas where these entries are missing a left join is used.
We have some installations with really large files table (more then 600 MB).
On these installations the update fails at this point.
Here is my attempt to get this work. Maybe it helps other people with the same problem.
if ($oldversion < 2013051402.10) {
|
|
$sql = "SELECT distinct f1.contextid, f1.component, f1.filearea, f1.itemid
|
FROM {files} f1
|
WHERE f1.component <> 'user' or f1.filearea <> 'draft'";
|
|
$rs = $DB->get_recordset_sql($sql);
|
$defaults = array('filepath' => '/',
|
'filename' => '.',
|
'userid' => $USER->id,
|
'filesize' => 0,
|
'timecreated' => time(),
|
'timemodified' => time(),
|
'contenthash' => sha1(''));
|
|
foreach ($rs as $r) {
|
// Is there a root folder entry for that filearea?
|
$count = $DB->count_records('files', array(
|
'contextid' => $r->contextid,
|
'component' => $r->component,
|
'filearea' => $r->filearea,
|
'itemid' => $r->itemid,
|
'filename' => '.',
|
'filepath' => '/'
|
));
|
if ($count) {
|
continue;
|
}
|
|
// There is no root folder entry for that filearea.
|
$pathhash = sha1("/$r->contextid/$r->component/$r->filearea/$r->itemid".'/.');
|
$DB->insert_record('files', (array)$r + $defaults +
|
array('pathnamehash' => $pathhash));
|
}
|
$rs->close();
|
// Main savepoint reached.
|
upgrade_main_savepoint(true, 2013051402.10);
|
}
|
- has a non-specific relationship to
-
MDL-41337 Can't delete the last file from filearea (under some circumstances)
-
- Closed
-
- has been marked as being related by
-
MDL-79138 file_trash_cleanup_task: User/Draft file records without corresponding "." directory file records do not get cleaned
-
- Open
-
- is a regression caused by
-
MDL-41337 Can't delete the last file from filearea (under some circumstances)
-
- Closed
-