[Instiki] instiki moved to a new host, rails 2.2 and passenger, all previous spam removed

Morgan Sutherland morgan at morgansutherland.net
Thu Feb 5 17:29:18 EST 2009


I'm very glad to hear that you're planning to implement deletion! And
the ability to delete revisions would be convenient.

Thanks for your help.

On Wed, Feb 4, 2009 at 9:33 PM, Matthias Tarasiewicz <parasew at gmail.com> wrote:
> On 04.02.2009, at 18:57, Morgan Sutherland wrote:
>
>> How did you go about deleting spam messages?
>
>
> we manually deleted the existing spam messages in the database, since the db
> grew too big and the export would take too long.
>
> if somebody tries to redo this manually, keep the following in mind:
> the data in the db is connected/linked, so when deleting rows from tables,
> make sure to not destroy the database integrity. the best approach to deal
> with the data is via the script/console.
>
> backup your database before interacting with the data!
>
> 1. invoke with 'ruby script/console production' in the instiki root
> 2. get the page you want to alter
>
>>> mypage=Page.find_by_name('HomePage')
>
> 3. check how much revisions you've got
>
>>> mypage.revisions.count
> => 202
>
> 4. either delete all the versions but one (leave at least one revision! else
> your data integrity is gone!)
>
>>> mypage.revisions.each {|r| mypage.revisions.reload; r.destroy if
>>> mypage.revisions.count.to_i>1}
>>> mypage.revisions.reload
>>> mypage.revisions.count
> => 1
>
> (keep in mind that on the website, the changes might be not visible
> immediately because of caching. delete everything in /cache to get the site
> to rebuild.
>
> if you accidentally deleted all the revisions of your page and get error
> 500's:
>
>>> mypage=Page.find_by_name('HomePage')
>>>
>>> mypage.revisions.create(:revised_at=>Time.now,:author=>Author.new('console','127.0.0.1'))
>>> mypage.save!
> => true
>
> 5. selectively delete revisions:
>
> # delete all revisions systemwide that contain the word "v1agra"
>>> Page.find(:all).each {|p| p.revisions.each {|r| r.destroy if
>>> r.content.include? "V1agra" }}
>
> # delete all revisions systemwide that from the ip 55.55.55.55
>>> Page.find(:all).each {|p| p.revisions.each{|r| r.destroy if
>>> r.ip=="55.55.55.55" }}
>
>
>
> # make sure that you don't have any pages without revisions afterwards
>
> # either restore empty revisions
>>> Page.find(:all).each {|p|
>>> p.revisions.create(:revised_at=>Time.now,:author=>Author.new('console','127.0.0.1'))
>>> if p.revisions.size == 0}
>
> # or also delete the corresponding Pages without revisions
>>> Page.find(:all).each {|p| p.destroy if p.revisions.size == 0}
>
>
>
> in the next version of instiki there will be a "delete" functionality, but i
> am thinking of also implementing a delete-option for versions (revisions)
> soon, since databases can grow huge if there are lots of rollbacks.
>
> another idea would be something like an "administrative rollback" or "hard
> rollback" that deletes all previous versions between the current entry and
> the to-be-rolled-back entry, anyone interested in such a functionality?
>
> -m
> _______________________________________________
> Instiki-users mailing list
> Instiki-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/instiki-users
>


More information about the Instiki-users mailing list