MDL-33330 Populate referencehash field values

This commit is contained in:
David Mudrak 2012-05-31 10:27:09 +02:00
parent 5100365347
commit dccba8bcc9
3 changed files with 15 additions and 1 deletions

View File

@ -779,5 +779,18 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2012060100.01);
}
if ($oldversion < 2012060100.02) {
// Populate referencehash field with SHA1 hash of the reference - this shoudl affect only 2.3dev sites
// that were using the feature for testing. Production sites have the table empty.
$rs = $DB->get_recordset('files_reference', null, '', 'id, reference');
foreach ($rs as $record) {
$hash = sha1($record->reference);
$DB->set_field('files_reference', 'referencehash', $hash, array('id' => $record->id));
}
$rs->close();
upgrade_main_savepoint(true, 2012060100.02);
}
return true;
}

View File

@ -1938,6 +1938,7 @@ class file_storage {
$id = $DB->insert_record('files_reference', array(
'repositoryid' => $repositoryid,
'reference' => $reference,
'referencehash' => sha1($reference),
'lastsync' => $lastsync,
'lifetime' => $lifetime));
} catch (dml_exception $e) {

View File

@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2012060100.01; // YYYYMMDD = weekly release date of this DEV branch
$version = 2012060100.02; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes