forked from GNUsocial/gnu-social
[DB][File] Remove timestamp, add actor_id
This commit is contained in:
parent
6d1fa10965
commit
d86636ebd4
@ -47,10 +47,10 @@ abstract class Utils
|
|||||||
$hash = hash_file(File::FILEHASH_ALGO, $sfile->getPathname());
|
$hash = hash_file(File::FILEHASH_ALGO, $sfile->getPathname());
|
||||||
$file = File::create([
|
$file = File::create([
|
||||||
'file_hash' => $hash,
|
'file_hash' => $hash,
|
||||||
|
'actor_id' => $actor_id,
|
||||||
'mimetype' => $sfile->getMimeType(),
|
'mimetype' => $sfile->getMimeType(),
|
||||||
'size' => $sfile->getSize(),
|
'size' => $sfile->getSize(),
|
||||||
'title' => $title ?: _m('Untitled attachment'),
|
'title' => $title ?: _m('Untitled attachment'),
|
||||||
'timestamp' => $sfile->getMTime(),
|
|
||||||
'is_local' => $is_local,
|
'is_local' => $is_local,
|
||||||
]);
|
]);
|
||||||
$sfile->move($dest_dir, $hash);
|
$sfile->move($dest_dir, $hash);
|
||||||
|
@ -229,16 +229,16 @@ class File extends Entity
|
|||||||
'is_url_protected' => ['type' => 'bool', 'default' => false, 'description' => 'true when URL is private (needs login)'],
|
'is_url_protected' => ['type' => 'bool', 'default' => false, 'description' => 'true when URL is private (needs login)'],
|
||||||
'url_hash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of destination URL (url field)'],
|
'url_hash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of destination URL (url field)'],
|
||||||
'file_hash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of the file contents, if the file is stored locally'],
|
'file_hash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of the file contents, if the file is stored locally'],
|
||||||
|
'actor_id' => ['type' => 'int', 'description' => 'If set, used so each actor can have a version of this file (for avatars, for instance)'],
|
||||||
'mimetype' => ['type' => 'varchar', 'length' => 50, 'description' => 'mime type of resource'],
|
'mimetype' => ['type' => 'varchar', 'length' => 50, 'description' => 'mime type of resource'],
|
||||||
'size' => ['type' => 'int', 'description' => 'size of resource when available'],
|
'size' => ['type' => 'int', 'description' => 'size of resource when available'],
|
||||||
'title' => ['type' => 'text', 'description' => 'title of resource when available'],
|
'title' => ['type' => 'text', 'description' => 'title of resource when available'],
|
||||||
'timestamp' => ['type' => 'int', 'description' => 'unix timestamp according to http query'],
|
|
||||||
'is_local' => ['type' => 'bool', 'description' => 'whether the file is stored locally'],
|
'is_local' => ['type' => 'bool', 'description' => 'whether the file is stored locally'],
|
||||||
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
|
||||||
],
|
],
|
||||||
'primary key' => ['id'],
|
'primary key' => ['id'],
|
||||||
'unique keys' => [
|
'unique keys' => [
|
||||||
'file_file_key' => ['file_hash'],
|
'file_file_key' => ['file_hash', 'actor_id'],
|
||||||
],
|
],
|
||||||
'indexes' => [
|
'indexes' => [
|
||||||
'file_filehash_idx' => ['file_hash'],
|
'file_filehash_idx' => ['file_hash'],
|
||||||
|
Loading…
Reference in New Issue
Block a user