Fields files.referencelastsync and files.referencelifetime just waste the space and actually duplicate the fields
files_reference.lifetime and files_reference.lastsync
<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20130921" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20130927" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="order of files"/>
<FIELD NAME="referencefileid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Use to indicate file is a proxy for repository file"/>
- <FIELD NAME="referencelastsync" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Last time the proxy file was synced with repository, defined for performance reasons"/>
- <FIELD NAME="referencelifetime" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="How often do we have to sync proxy file with repository, defined for performance reasons"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
upgrade_main_savepoint(true, 2013092001.02);
}
+ if ($oldversion < 2013092700.01) {
+
+ $table = new xmldb_table('files');
+
+ // Define field referencelastsync to be dropped from files.
+ $field = new xmldb_field('referencelastsync');
+
+ // Conditionally launch drop field referencelastsync.
+ if ($dbman->field_exists($table, $field)) {
+ $dbman->drop_field($table, $field);
+ }
+
+ // Define field referencelifetime to be dropped from files.
+ $field = new xmldb_field('referencelifetime');
+
+ // Conditionally launch drop field referencelifetime.
+ if ($dbman->field_exists($table, $field)) {
+ $dbman->drop_field($table, $field);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2013092700.01);
+ }
+
return true;
}
$filerecord->sortorder = 0;
}
- // TODO MDL-33416 [2.4] fields referencelastsync and referencelifetime to be removed from {files} table completely
- unset($filerecord->referencelastsync);
- unset($filerecord->referencelifetime);
-
$filerecord->mimetype = empty($filerecord->mimetype) ? $this->mimetype($filerecord->filename) : $filerecord->mimetype;
$filerecord->userid = empty($filerecord->userid) ? null : $filerecord->userid;
$filerecord->source = empty($filerecord->source) ? null : $filerecord->source;
'lastsync' => $lastsync,
'lifetime' => $lifetime);
$DB->execute('UPDATE {files} SET contenthash = :contenthash, filesize = :filesize,
- status = :status, referencelastsync = :lastsync, referencelifetime = :lifetime
+ status = :status
WHERE referencefileid = :referencefileid', $params);
$data = array('id' => $referencefileid, 'lastsync' => $lastsync, 'lifetime' => $lifetime);
$DB->update_record('files_reference', (object)$data);
}
}
- if ($field === 'referencelastsync' or $field === 'referencelifetime') {
- // do not update those fields
- // TODO MDL-33416 [2.4] fields referencelastsync and referencelifetime to be removed from {files} table completely
- continue;
- }
-
// adding the field
$this->file_record->$field = $value;
} else {
* The function repository_attach_id() was removed, it was never used and was not useful.
* New functions send_relative_file() and supports_relative_file() to allow sending relative linked
files - see filesystem repository for example.
-
+* DB fields files.referencelifetime and files.referencelastsync are deleted.
+ Their values are stored only in files_reference.lastsync and files_reference.lifetime.
=== 2.5 ===
defined('MOODLE_INTERNAL') || die();
-$version = 2013092700.00; // YYYYMMDD = weekly release date of this DEV branch.
+$version = 2013092700.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.