Remove filename from storageFiles#55
Conversation
| } | ||
| if ($response) { | ||
| if ($zip) { | ||
| $success = self::extractZip($downloadDir . $info['filename'], $dir); |
There was a problem hiding this comment.
If we create a random dir, I think there is no difference what filename the zip file has.
|
We need a script to point all storageFileItems files that have the same hash, to the same (lowest storageFileID) row in storageFiles. There are a few options how it could be implemented. Option 1: Option 2: Option 3: There is an unused 'getFileItems' function that is unimplemented: link. Now when we have storageFileLibraries table this function would be much easier to implement if needed. Or we should remove it if no longer needed. |
| public static function addFile(Zotero_StorageFileInfo $info) { | ||
| $sql = "INSERT INTO storageFiles (hash, filename, size, zip) VALUES (?,?,?,?)"; | ||
| return Zotero_DB::query($sql, array($info->hash, $info->filename, $info->size, (int) $info->zip)); | ||
| $sql = "INSERT INTO storageFiles (hash, `size`, zip) VALUES (?,?,?)"; |
There was a problem hiding this comment.
Why the backticks? size isn't a reserved word, as far as I know.
| if ($e->getAwsErrorCode() == 'NoSuchKey' || $e->getAwsErrorCode() == 'NotFound') { | ||
| $contents = $result->get('Contents'); | ||
| if (!$contents || count($contents) < 1) { |
There was a problem hiding this comment.
What are the possible values for this?
There was a problem hiding this comment.
It returns all keys that are prefixed with a given hash. In our case:
hash
hash/file1
hash/c/file1
|
We should be able to eliminate |
…eld; remove 'getFileByHash' remove unnecessary backticks; remove any 'storageFiles' filtering on 'zip' or 'filename' fields
|
When uploading a file the original code was copying 'hash/filename1' to 'hash' on S3 if 'hash' doesn't exist. |
|
I think we should completely eliminate |
|
This |
'filename' column should be removed from storageDownloadLog and storageUploadLog too, because they depend on storageFiles table.
For those tables a default 'filename' value must be set.
storageFiles
storageDownloadLog
storageUploadLog