Item class has been moved to a new directory 'models', a new class has been added: ItemContent

and same fields from Item were moved to ItemContent

Item
- id
- parent_id
- type (file, dir, symlink)
- url
- subject
- template (html template)
- sort_index
- content_id

ItemContent
- id
- ref -> references (renamed)
- user_id
- modification_user_id
- group_id
- privileges
- date_creation
- date_modification
- guest_name
- link_to
- link_redirect
- file_path
- file_fs
- file_type
- file_size
- has_thumb -> file_has_thumb (renamed)
- hash -> file_hash (renamed)
- hash_type -> file_hash_type (renamed)
- content -> content_raw (renamed)
- content_type -> content_raw_type (renamed)
- content_parsed
- content_parsed_type
- meta
- ameta -> meta_admin (renamed)
- modify_index (removed)

WIP: #4
This commit is contained in:
2021-02-24 01:19:47 +01:00
parent 3d7ece15f8
commit 32e93a04c5
118 changed files with 5795 additions and 4514 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* Copyright (c) 2010-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -62,17 +62,19 @@ bool Ln::HasAccess()
bool Ln::CreateSymbolicLink(long parent_id, const wchar_t * link_to, const wchar_t * url, bool link_redirect)
{
item.set_connector(model_connector);
item.Clear(); // setting the date to now
item.type = Item::symlink;
item.parent_id = parent_id;
item.url = url;
item.link_to = link_to;
item.link_redirect = static_cast<int>(link_redirect);
item.privileges = system->NewFilePrivileges();
item.item_content.link_to = link_to;
item.item_content.link_redirect = static_cast<int>(link_redirect);
item.item_content.privileges = system->NewFilePrivileges();
functions->SetUser(item);
functions->PrepareUrl(item);
return db->AddItem(item) == WINIX_ERR_OK;
return item.insert();
//return db->AddItem(item) == WINIX_ERR_OK;
}
@@ -124,7 +126,11 @@ bool Ln::CreateHardLink(const std::vector<Item*> & dirs, const std::wstring & li
item.url = url;
functions->PrepareUrl(item);
return db->AddHardLink(item) == WINIX_ERR_OK;
/*
* IMPROVEME
*
*/
//return db->AddHardLink(item) == WINIX_ERR_OK;
}
return false;