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:
@@ -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
|
||||
@@ -377,7 +377,7 @@ bool Image::CreateInputFileName()
|
||||
{
|
||||
bool thumb = (item_work.type == WINIX_IMAGE_TYPE_CROP_THUMB);
|
||||
|
||||
if( thumb && !file_work.has_thumb )
|
||||
if( thumb && !file_work.item_content.file_has_thumb )
|
||||
{
|
||||
log << log1 << "Image: file id: " << file_work.id << ", url: " << file_work.url
|
||||
<< " doesn't have a thumbnail yet (skipping)" << logend;
|
||||
@@ -414,11 +414,19 @@ bool Image::CreateCommand()
|
||||
{
|
||||
class Lock lock_object(synchro);
|
||||
|
||||
iq.SetAll(true, false);
|
||||
iq.WhereId(item_work.file_id);
|
||||
// iq.SetAll(true, false);
|
||||
// iq.WhereId(item_work.file_id);
|
||||
|
||||
morm::Finder<Item> finder(model_connector);
|
||||
|
||||
{
|
||||
// IMPROVEME we need a seperate model_connector for this thread
|
||||
Lock();
|
||||
file_work = finder.select().where().eq(L"id", item_work.file_id).get();
|
||||
}
|
||||
|
||||
// the file could have been changed especially when there is a long queue of files
|
||||
if( db->GetItem(file_work, iq) != WINIX_ERR_OK )
|
||||
if( !file_work.found() )
|
||||
return false;
|
||||
|
||||
if( !CreateInputFileName() )
|
||||
@@ -483,10 +491,16 @@ void Image::ImageSavedCorrectly()
|
||||
{
|
||||
if( item_work.type == WINIX_IMAGE_TYPE_CREATE_THUMB )
|
||||
{
|
||||
if( !file_work.has_thumb )
|
||||
if( !file_work.item_content.file_has_thumb )
|
||||
{
|
||||
file_work.has_thumb = true;
|
||||
db->EditHasThumbById(true, file_work.id);
|
||||
file_work.item_content.file_has_thumb = true;
|
||||
|
||||
{
|
||||
// IMPROVEME we need a separate model_connector for this thread
|
||||
Lock();
|
||||
file_work.update(false, false);
|
||||
//db->EditHasThumbById(true, file_work.id);
|
||||
}
|
||||
}
|
||||
|
||||
log << log3 << "Image: generated a thumbnail: " << dst_path << logend;
|
||||
@@ -528,11 +542,23 @@ void Image::SaveImage()
|
||||
class Lock lock_object(synchro);
|
||||
|
||||
// the file could have been changed especially when creating the image lasted too long
|
||||
iq.SetAll(true, false);
|
||||
iq.WhereId(item_work.file_id);
|
||||
//iq.SetAll(true, false);
|
||||
//iq.WhereId(item_work.file_id);
|
||||
|
||||
morm::Finder<Item> finder(model_connector);
|
||||
|
||||
if( db->GetItem(file_work, iq) == WINIX_ERR_OK )
|
||||
{
|
||||
// IMPROVEME we need a seperate model_connector for this thread
|
||||
Lock();
|
||||
file_work = finder.select().where().eq(L"id", item_work.file_id).get();
|
||||
}
|
||||
|
||||
// the file could have been changed especially when there is a long queue of files
|
||||
if( !file_work.found() )
|
||||
return;
|
||||
|
||||
//if( db->GetItem(file_work, iq) == WINIX_ERR_OK )
|
||||
//{
|
||||
bool thumb = (item_work.type == WINIX_IMAGE_TYPE_CREATE_THUMB ||
|
||||
item_work.type == WINIX_IMAGE_TYPE_CROP_THUMB ||
|
||||
item_work.type == WINIX_IMAGE_TYPE_CREATE_CROP_NEW_THUMB );
|
||||
@@ -558,7 +584,7 @@ void Image::SaveImage()
|
||||
{
|
||||
log << log1 << "Image: cannot create a destination path" << logend;
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user