/** * Append object properties * @param ilObject $obj */ public function __appendObjectProperties(ilObject $obj) { switch ($obj->getType()) { case 'file': include_once './Modules/File/classes/class.ilObjFileAccess.php'; $size = ilObjFileAccess::_lookupFileSize($obj->getId()); $extension = ilObjFileAccess::_lookupSuffix($obj->getId()); $this->xmlStartTag('Properties'); $this->xmlElement("Property", array('name' => 'fileSize'), (int) $size); $this->xmlElement("Property", array('name' => 'fileExtension'), (string) $extension); // begin-patch fm $this->xmlElement('Property', array('name' => 'fileVersion'), (string) ilObjFileAccess::_lookupVersion($obj->getId())); // end-patch fm $this->xmlEndTag('Properties'); break; } }
continue; } // Rename $fss = new ilFSStorageFile($file_id); $fss->create(); if ($fss->rename(ilUpdateUtils::getDataDir() . '/files/file_' . $file_id, $fss->getAbsolutePath())) { $ilLog->write('DB Migration 1024: Success renaming file_' . $file_id); } else { $ilLog->write('DB Migration 1024: Failed renaming ' . ilUpdateUtils::getDataDir() . '/files/file_' . $file_id . ' -> ' . $fss->getAbsolutePath()); continue; } // Save success $query = "REPLACE INTO tmp_migration SET obj_id = '" . $file_id . "',passed = '1'"; $ilDB->query($query); // Update file size $size = ilObjFileAccess::_lookupFileSize($file_id); $query = "UPDATE file_data SET file_size = '" . $size . "' " . "WHERE file_id = " . $file_id; $ilDB->query($query); $ilLog->write('DB Migration 905: File size is ' . $size . ' Bytes'); } ?> <#1025> DROP TABLE IF EXISTS tmp_migration; <#1026> DROP TABLE IF EXISTS tmp_migration; CREATE TABLE `tmp_migration` ( `obj_id` int(11) NOT NULL default '0', `passed` tinyint(4) NOT NULL default '0'); ALTER TABLE `tmp_migration` ADD INDEX `obj_passed` ( `obj_id` ,`passed` );
/** Lookups the file size of the file in bytes. */ function _lookupFileSize($a_id) { require_once "./Modules/File/classes/class.ilObjFileAccess.php"; return ilObjFileAccess::_lookupFileSize($a_id); }