From b61b2edbaa9fab688622fb251e5dd8cc12ee1c38 Mon Sep 17 00:00:00 2001 From: saint Date: Mon, 9 Sep 2024 14:27:13 +1000 Subject: [PATCH] v0.2 Fix class definition for goss-destroydeletedposts.rb --- .gossamer_forums.rb.swo | Bin 20480 -> 20480 bytes goss-destroydeletedposts.rb | 24 +++++++++--------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/.gossamer_forums.rb.swo b/.gossamer_forums.rb.swo index 382f11455759a2174aa52ddf8f916a63d7b1f71d..c6d534e9b8b131e4419661e6474766f1fcf4e870 100644 GIT binary patch delta 1051 zcmYk(Uq}=|90%}O%<}wuo<)CNZp4SXgL9(@D#wf4^Tk7!y}R*l;O_R?9lZ?W z1i_GA)OiVtu>Yz3@zRngAqp~|d@B&@QLrAOm!Mwkd+wb$?B}~XGyB_}*&Uixh9;F+ zuTxo&KBrrGEd$6`k|XEkC~{6tAz#X6WL~Z#XQiXwt-O#vsR zE+ePpI`WBhxZKKP=|et}0pvr;kq_jk%k8+oVYjf%yY~9-6?-9Kx5ZudSt<7K7U$dK zZ`AVQ=%u;+4L|+4aoiOw!FAs^u?Fo=L38epxKkT);^BQOl@5P(`(sv+bp z+=4E+0H>i9PCzv*R1-1}teWIV1Q$o)Ulk#LVGTaRO-R5=I0CDcgsi{_41$0(q~IJJ zhF=aszQPx{4H_JR23V~i z6n;BnLoEn^x{W?3wzWteFhX+5d&m^Wp`aq^)I$7Yk|{yKRqSR>B| z56DPxj~oo{lM_K#E@N0ijhYM(jcK~@mkLlNj0}&e_6r-m+a{W5*XAm)U}oRtv1n4a z1T|SEIe;DX8fHot+(@HpTjA!*EWMvKmIlvIO6?`|S;9zZy__XuR@h^hJkATdi5r%s uri7{Kx8J!3GA%NPrtjqlWvd=WMl7A}#aDU_%qDWud;lu|4-Vl|4?v!$%m zEZiE(xD4ZP7{+CJ7B+Uo##$VI&78M>|L?u@ZJw!RGqr3sirwZ$ZMS8v)l09`N8=ix zml~uO8ly3Nr043&wal5?^pAS!sru-N2Iy}M(qoO$s6Nsob$Kjvs5XtLmma8(?rXqf zx%U1gR<~|?^6lN^sa+B)l9u?I&c7Gej0JiVj#v!JA9u6?ceY36rSDcUUOEL%PT|wlIP5biYU+n-(;q6k*1< zgC#6t2Gi)rPc)(g9^~RBRpb^o7=Qy`KF>^b9cviF2!=3-I($yO#yCSJCE^IRHXLPq E0BCuBT>t<8 diff --git a/goss-destroydeletedposts.rb b/goss-destroydeletedposts.rb index b4c6d34..8e51717 100644 --- a/goss-destroydeletedposts.rb +++ b/goss-destroydeletedposts.rb @@ -1,7 +1,7 @@ # Federated Computer, Inc. # David Sainty 2024 A.D. # Gossamer Threads to Discourse -- CleanUp Script -# v0.1 New script +# v0.2 Fix class definition require 'mysql2' require 'active_record' @@ -9,6 +9,14 @@ require 'active_record' # require 'concurrent-ruby' require File.expand_path("../../../../config/environment", __FILE__) +class LegacyPost < ActiveRecord::Base + self.table_name = 'gforums_Post' +end + +class LegacyUser < ActiveRecord::Base + self.table_name = 'gforums_User' +end + class GossamerForumsDestroyDeletedPosts # def initialize # super @@ -53,11 +61,6 @@ class GossamerForumsDestroyDeletedPosts password: 'yxnh93Ybbz2Nm8#mp28zCVv' ) - # Load the gforums_Post model for legacy database - class LegacyPost < ActiveRecord::Base - self.table_name = 'gforums_Post' - end - # Find all posts marked as deleted in the legacy database LegacyPost.where(post_deleted: 1).find_each do |legacy_post| # Look for the post in Discourse by custom field @@ -81,15 +84,6 @@ class GossamerForumsDestroyDeletedPosts password: 'yxnh93Ybbz2Nm8#mp28zCVv' ) - # Load the gforums_Post model for legacy database - class LegacyPost < ActiveRecord::Base - self.table_name = 'gforums_Post' - end - - class LegacyUser < ActiveRecord::Base - self.table_name = 'gforums_User' - end - # Find the user ID for the given username user = LegacyUser.find_by(username: username) if user.nil?