by Russ TannerGallery Comment Cruncher

Version 1.00

General Usage

This section describes how to use the Gallery Comment Cruncher.

topDatabase Credentials

This section allows you to enter the database credentials that are required to access the Gallery database.

This section must be completed before you can search or delete Gallery comments. This section also needs to be complete to use the Auto Detect feature (see below) for Table and Column Prefixes.

Restore Defaults

The Restore Defaults button simply restores all fields in this section to their default value.

topTable & Column Prefixes

When Gallery is first installed, you specified a prefix for table names and column names. Comment Cruncher must know these prefixes in order to do its work.

If you don't remember what these prefixes are, you can use the "Auto Detect" button (see below).

Auto Detect

The Auto Detect button automatically detects the table and column prefixes. All database credentials must be entered for this to work.

Restore Defaults

The Restore Defaults button simply restores all fields in this section to their default value.

topDelete By Subject, Body, Author, & IP Address

Comment Cruncher maintains 4 lists that enable you to delete comments based on 4 different criteria:

  • Subject
  • Body
  • Author
  • IP Address

Each of these lists contains any number of words or phrases that are used to delete comments. Each word or phrase that you want to use must appear on it's own line. These phrases may contain wildcard characters such as those used in a typical SQL LIKE statement: "%" or "_". (In fact, each line actually IS used in a SQL LIKE statement.) All strings in the lists are case-insensitive (case doesn't matter).

Items in the "Subject" list are used to delete comments based on the subject of comments. This correlates to the "subject" column of the "Comment" table. This list is stored in a file named cc-SubjectList.txt.

Items in the "Body" list are used to delete comments based on the body of comments. This correlates to the "comment" column of the "Comment" table. This list is stored in a file named cc-BodyList.txt.

Items in the "Author" list are used to delete comments based on the author of comments. This correlates to the "author" column of the "Comment" table. This list is stored in a file named cc-AuthorList.txt.

Items in the "IP Address" list are used to delete comments based on the IP address of the author of comments. This correlates to the "host" column of the "Comments" table. This list is stored in a file named cc-IPList.txt.

Examples

To remove all comments that have a subject matching: "need to make money now"

Just enter the phrase "need to make money now" on it's own line in the Subject list.

To remove all comments that contain the word "russian" in the subject:

"%russian%" (in the Subject list)

To remove all comments having a subject beginning with "very cheap":

"very cheap%" (in the Subject list)

To remove all comments having a subject ending with "airplane tickets":

"%airplane tickets" (in the Subject list)

To remove all comments whose author has an IP address beginning with "84":

"84%" (in the IP Address list)

To remove all comments with an author having an IP address within the class A address "84":

"84.%" (in the IP Address list) Don't forget the period.

Save

The save button simply saves the list to a file. See below for a list of file names that are associated with each list.

Delete

This button deletes all comments that match any items in the list. Beware that there is no confirmation page. Deletion begins immediately after clicking the Delete button.

When this button is clicked, the list is saved before the delete operation begins.

Batch

The "Batch-Delete" feature is a powerful feature that allows you to process all items in your list without worrying about PHP timing out.

Once you click the Batch button, a series of pages will display one-by-one. Each of these pages processes a single item in the list. Each page that displays makes a new request to the web server essentially restarting the PHP timeout timer.

These pages contain a "Cancel" button that stays visible for a few seconds before each new request is made. This allows you to cancel the batch-delete process without worrying about confusing the server.

When this button is clicked, the list is saved before the delete operation begins.

Clear List

This link deletes all items in the corresponding list. A confirmation message will display before the items are deleted.

Sort List

This link sorts all items in the corresponding list. Sorting is performed in a natural order that is most intuitive for humans.

Remove Duplicates

This link removes all duplicates items from a list.

topDelete All Comments

The "Delete All Comments" button simply deletes all comments from the Gallery database. There is no confirmation message displayed, so be sure you don't click it by accident.

There is no "undo" when deleting comments, so be sure to backup your database any time you delete comments.

topAnalytics: Find Comments

This section enables you to locate and optionally delete comments in bulk.

Using "Find Comments"

First, select which part of a comment you would like to search. Following is a list of selections and how they map to the Gallery "Comment" table.

  • Subject -> subject
  • Body -> comment
  • Author -> author
  • IP Address -> host
  • Comment ID -> id

Next, enter the string you are searching for. This string is used in a SQL LIKE statement, so the standard MySQL wildcards are available: "%" "_".

Finally, enter the maximum number of records you want returned. This is useful when working with large databases. It helps prevent PHP from timing out while Comment Cruncher is running a query on a large database.

The "Search Results" Page

You will find that the search-result pages provide you with an easy way to delete comments in bulk. Just place check marks next to the comments you want to delete and click "Delete All Checked".

Avoiding PHP Memory Limits

Beware if you are working with a large database with many comments, Comment Cruncher can return huge web pages. For this reason, it is designed to avoid hitting PHP memory limits by using a cache file (cc-buffer.txt) rather than memory to display the result page. Comment Cruncher then creates and calls a temporary PHP script (cc-tmp.php) which reads the buffer directly using the PHP readfile() statement. This minimizes memory usage and maximizes speed.

topAnalytics: Find Duplicates

Why "Find Duplicates"

When your Gallery is spammed with comments, it is rare that real humans are doing the spamming. Instead, bots are designed to constantly search the web for Gallery installations and then automatically bomb them with comments. For this reason, you will find that most spam-comments are duplicates.

The "Find Duplicates" feature helps you deal with this problem by making it easy to isolate and delete duplicate comments in bulk.

Using "Find Duplicates"

First, select which part of a comment you would like to search. Following is a list of available selections and how they map to the Gallery "Comment" table.

  • Subject -> subject
  • Body -> comment
  • Author -> author
  • IP Address -> host

Note that you cannot search for duplicates on the Comment ID. This field was excluded because each comment has a unique ID, so searching for duplicates on this field is nonsensical. If you wish to delete comments by ID, use the "Find Comments" feature and select "Comment ID" from the drop-down box.

Next, enter the string you are searching for. This string is used in a SQL LIKE statement, so the standard MySQL wildcards are available: "%" "_".

Next, enter the target number of duplicates. Only comments that occur this many times or more will be displayed in the result list. This value must be between 1 and 2,000,000 inclusive.

Finally, enter the maximum number of records you want returned. This is useful when working with large databases. It helps prevent PHP from timing out while Comment Cruncher is running a query on a large database.

The "Search Results" Page

You will find that the search-result pages provide you with an easy way to delete duplicate comments in bulk. Just place check marks next to the items you want to delete and click "Delete All Checked". Keep in mind that if you check a single item that has 100 duplicates, then you will delete 100 comments when you click "Delete All Checked".

The search result page has a view feature with a return-limit. Just enter the maximum number of records you want to view and click "View". You will see a new result page displaying each duplicate comment individually. You can then select which individual comments you want to delete.

Beware that Comment Cruncher can return huge web pages if you are working with a large database. It is designed to avoid hitting PHP memory limits by caching out each record of the returned list to a file named cc-buffer.txt. and then calling a custom PHP page named cc-tmp.php which reads the buffer directly using the PHP readfile() statement. This minimizes memory usage and maximizes speed.

Avoiding PHP Memory Limits

Beware if you are working with a large database with many comments, Comment Cruncher can return huge web pages. For this reason, it is designed to avoid hitting PHP memory limits by using a cache file (cc-buffer.txt) rather than memory to display the result page. Comment Cruncher then creates and calls a temporary PHP script (cc-tmp.php) which reads the buffer directly using the PHP readfile() statement. This minimizes memory usage and maximizes speed.

top