Skip to content

Commit f29e44d

Browse files
author
Tom Copeland
committed
Delete artifact files as part of cleaning up a spam account
1 parent 7d14929 commit f29e44d

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

Diff for: app/models/user.rb

+7-3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class User < ActiveRecord::Base
4747
has_many :user_group
4848
has_many :artifacts, :foreign_key => 'submitted_by', :dependent => :destroy
4949
has_many :artifact_messages, :foreign_key => 'submitted_by', :dependent => :destroy
50+
has_many :artifact_files, :foreign_key => 'submitted_by', :dependent => :destroy
5051
has_many :groups, :through => :user_group
5152
belongs_to :supported_language, :foreign_key => 'language'
5253
belongs_to :user_type, :foreign_key => 'type_id'
@@ -124,12 +125,15 @@ def to_json(args = {})
124125
end
125126

126127
def delete_child_records!
127-
puts "Deleting #{self.artifact_messages.count} artifact messages"
128+
puts "Deleting #{artifact_messages.count} artifact messages"
128129
artifact_messages.each {|m| m.destroy }
129-
puts "Deleting #{self.forum_messages.count} forum messages"
130+
puts "Deleting #{forum_messages.count} forum messages"
130131
forum_messages.each {|m| m.destroy }
131-
puts "Deleting #{self.snippets.count} snippets"
132+
puts "Deleting #{snippets.count} snippets"
132133
snippets.each {|m| m.destroy }
134+
puts "Deleting #{artifact_files.count} artifact files"
135+
artifact_files.each {|m| m.destroy }
136+
nil
133137
end
134138

135139
def spammer!

Diff for: doc/README.txt

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
==============
1+
==
22
Consider this for API docs:
33
http://techblog.floorplanner.com/2008/05/07/rapidoc-rails-rest-api-documentation-generation-well-just-rapidoc/
44

5-
==============
5+
==
66
Used this to install the machinist gem:
77
sudo gem install notahat-machinist --source http://gems.github.com
88

9-
==============
9+
==
1010
Some notes about news byte creation:
1111
# sample data for a support group "Merry Chrismas" news byte:
1212
# THESE MUST BE CREATED AS PART OF THE NEWS BYTE
@@ -29,14 +29,15 @@ Some notes about news byte creation:
2929
775 | 589 | 119 | RE: happy christmas + newyear
3030
(2 rows)
3131

32-
==============
32+
==
3333
To start the service:
3434

3535
sudo su -l webuser
3636
cdapi
3737
mongrel_rails cluster::start
3838

39-
==============
39+
==
40+
4041
To anonymize a GForge DB dump - e.g., for Dr Nic - run this SQL:
4142

4243
update users set email = 'anonymous'||user_id||'@example.org';
@@ -55,3 +56,11 @@ delete from mirrors;
5556
delete from frs_dlstats_file where month < 201101;
5657
delete from stats_project_developers where month < 201101;
5758

59+
==
60+
61+
If spam is reported on an artifact, i.e.:
62+
63+
http://rubyforge.org/tracker/download.php/718/2844/29642/5722/cos26.html
64+
65+
"718" is the group id.
66+

0 commit comments

Comments
 (0)