From a72dfa90c6b13ef7542da269cfcb3e8ef528f131 Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Mon, 23 Jan 2012 18:02:01 +0000 Subject: [PATCH] Hacks for posts importer --- FLocal.Common/UploadManager.cs | 2 +- FLocal.Common/dataobjects/Thread.cs | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/FLocal.Common/UploadManager.cs b/FLocal.Common/UploadManager.cs index 2ae6f43..3c52007 100644 --- a/FLocal.Common/UploadManager.cs +++ b/FLocal.Common/UploadManager.cs @@ -29,7 +29,7 @@ namespace FLocal.Common { } - private const int MAX_UPLOAD_FILESIZE = 1024*1024; + private const int MAX_UPLOAD_FILESIZE = 10*1024*1024; private static HashSet allowedExtensions = new HashSet() { "jpg", diff --git a/FLocal.Common/dataobjects/Thread.cs b/FLocal.Common/dataobjects/Thread.cs index 7e71c20..23d9fc5 100644 --- a/FLocal.Common/dataobjects/Thread.cs +++ b/FLocal.Common/dataobjects/Thread.cs @@ -423,14 +423,16 @@ namespace FLocal.Common.dataobjects { { Post.TableSpec.FIELD_PARENTPOSTID, new ScalarFieldValue(parentPostId) }, { Post.TableSpec.FIELD_POSTERID, new ScalarFieldValue(poster.id.ToString()) }, { Post.TableSpec.FIELD_POSTDATE, new ScalarFieldValue(date.ToUTCString()) }, - { Post.TableSpec.FIELD_REVISION, new ScalarFieldValue("0") }, + //{ Post.TableSpec.FIELD_REVISION, new ScalarFieldValue("0") }, { Post.TableSpec.FIELD_LASTCHANGEDATE, new ScalarFieldValue(date.ToUTCString()) }, { Post.TableSpec.FIELD_LAYERID, new ScalarFieldValue(layer.id.ToString()) }, { Post.TableSpec.FIELD_TITLE, new ScalarFieldValue(title) }, { Post.TableSpec.FIELD_BODY, new ScalarFieldValue(bodyIntermediate) }, { Post.TableSpec.FIELD_TOTALPUNISHMENTS, new ScalarFieldValue("0") }, }; - if(forcedPostId.HasValue) { + if(!forcedPostId.HasValue) { + postInsertData[Post.TableSpec.FIELD_REVISION] = new ScalarFieldValue("0"); + } else { postInsertData[Post.TableSpec.FIELD_ID] = new ScalarFieldValue(forcedPostId.Value.ToString()); } AbstractChange postInsert = new InsertChange( @@ -472,12 +474,15 @@ namespace FLocal.Common.dataobjects { }, poster.id ); - List changes = new List { - postInsert, - revisionInsert, - threadUpdate, - userUpdate, - }; + + List changes = new List(); + changes.Add(postInsert); + if(!forcedPostId.HasValue) { + //dirty hack + changes.Add(revisionInsert); + } + changes.Add(threadUpdate); + changes.Add(userUpdate); Dictionary boardData = new Dictionary {