added: setting a correct mime type for static files - using magic library

added: std::wstring file_mime_type to ItemContent - a mime type for static file
added: Header (core/header.h) - there will be header names defined, at the moment only content_type
added: FuncionsBase::Finish() - it is called at the end when the winix finishes
This commit is contained in:
2021-09-22 00:23:25 +02:00
parent 26ed7b80be
commit 9c5c74ba84
29 changed files with 364 additions and 35 deletions

View File

@@ -97,6 +97,7 @@ item.o: ../../../winix/winixd/core/error.h
item.o: ../../../winix/winixd/core/config.h
item.o: ../../../winix/winixd/core/textstream.h
item.o: ../../../winix/winixd/models/winixmodel.h
item.o: ../../../winix/winixd/core/header.h
item.o: ../../../winix/winixd/templates/templates.h
item.o: ../../../winix/winixd/templates/patterncacher.h
item.o: ../../../winix/winixd/templates/indexpatterns.h
@@ -241,6 +242,7 @@ itemcontent.o: ../../../winix/winixd/models/item.h itemcontent.h
itemcontent.o: ../../../winix/winixd/core/error.h
itemcontent.o: ../../../winix/winixd/core/textstream.h
itemcontent.o: ../../../winix/winixd/models/winixmodel.h
itemcontent.o: ../../../winix/winixd/core/header.h
itemcontent.o: ../../../winix/winixd/core/users.h
itemcontent.o: ../../../winix/winixd/core/groups.h
itemcontent.o: ../../../winix/winixd/models/group.h

View File

@@ -74,6 +74,7 @@ void ItemContent::fields()
field(L"file_path", file_path);
field(L"file_fs", file_fs);
field(L"file_type", file_type);
field(L"file_mime_type", file_mime_type);
field(L"file_has_thumb", file_has_thumb);
field(L"file_hash", file_hash);
field(L"file_hash_type", file_hash_type);
@@ -192,6 +193,7 @@ bool ItemContent::do_migration(int & current_table_version)
ok = ok && morm::Model::do_migration(current_table_version, 2, this, &ItemContent::do_migration_to_2);
ok = ok && morm::Model::do_migration(current_table_version, 3, this, &ItemContent::do_migration_to_3);
ok = ok && morm::Model::do_migration(current_table_version, 4, this, &ItemContent::do_migration_to_4);
ok = ok && morm::Model::do_migration(current_table_version, 5, this, &ItemContent::do_migration_to_5);
return ok;
}
@@ -278,6 +280,13 @@ bool ItemContent::do_migration_to_4()
}
bool ItemContent::do_migration_to_5()
{
const char * str = "alter table core.content add column file_mime_type varchar(256)";
return db_query(str);
}
bool ItemContent::has_access(const User * current_user, int mask) const
{
if( current_user )

View File

@@ -177,6 +177,22 @@ public:
*/
int file_type;
/*
* mime file type e.g. image/jpeg
*
* CHANGEME
* we need to rething what to do with above file_type
*
* may would be better to have:
* remove file_type and add:
* bool has_static_file;
* std::wstring file_mime_type;
*
* may it would be good to have a seperate mime_type for the thumnail?
*
*/
std::wstring file_mime_type;
/*
* whether or not we have a thumbnail
*/
@@ -289,6 +305,7 @@ protected:
bool do_migration_to_2();
bool do_migration_to_3();
bool do_migration_to_4();
bool do_migration_to_5();
bool has_access(const User * current_user, int mask) const;
bool content_type_is(const std::wstring & type);