Deleting a mailing list post on a Snow Leopard Server Wiki is a pain in the ass.
There was a blog posting on this fine fellow’s website but it seems that Apple has gotten rid of the index.db file he calls out and merged everything into a single, monolithic index database file. The Snow Leopard Wiki Server documentation also claims that this file exists… but it doesn’t. That’s a bit of a bummer but it probably makes sense for performance reasons.
First, stop the wiki server:
sudo serveradmin stop teams
MAKE SURE YOUR DATA IS BACKED UP BEFORE PROCEEDING.
To do this, you must first get the ID of the page that was given to it. The easiest way to do this is to ssh into the server and go to:
cd /Library/Collaboration/Groups//mailinglist
Inside that directory you will see a bunch of directories. There is one directory per page. Each directory has a unique name of gibberish.page. For example:
8e07eb0bf81cb983aa69b673af39cea6.page
Do a copy of the gibberish portion of the directory name up to the .page. You want only the gibberish portion in your clipboard. Back up one directory so you’re back in /Library/Collaboration/Groups//mailinglist and get rid of the page directory:
sudo rm -fr 8e07eb0bf81cb983aa69b673af39cea6.page
NOTE: Use the name that you found, not this example.
Next, you’re going to perform surgery on the global index database. Go to:
cd /Library/Collaboration
Now you’ll want to get a SQL dump of the existing database. To do this, go into sqlite3.
sudo sqlite3 globalIndex.db .dump > globalIndex.sql
This should produce a SQL text file of the entire database so you can see all of the innards. Now you’ll want to move the current database to an old copy just in case you destroy everything by accident.
sudo mv globalIndex.db globalIndex.db.OLD
Now, perform the surgery. What we’ll be doing here is editing the SQL file that we dumped out and reimport it into a new database. Use your favorite text editor (vim works just fine) and run a search on the unique string you copied into your clipboard earlier. You will find at least two entries. You’ll find one entry to designate the page itself and at least one more entry that inserts the edit information into a table called “changes” for revision tracking. Find all of those lines and delete the SQL queries associated with them.
BE VERY CAREFUL that you only delete the lines associated with the queries. If your email contained a lot of whitespace it will exist in the database.
After removing all instances of that string in the SQL text file you’ll want to rebuild the database with this file. To do this, go into sqlite3 again. This time, however, you’re creating a new database with the same name.
sudo sqlite3 globalIndex.db
This creates the globalIndex.db file and drops you into the sqlite3 command prompt. If you want to be sure you’re in the right place, type at the sqlite3 command prompt:
.databases
You should see a little explanation of what file you’re attached to. You should see that you’re attached to “/Library/Collaboration/globalIndex.db.” This assumes, of course, that you’re using the default location for the wiki server information.
Now let’s read in the SQL file. Type at the sqlite3 command prompt:
.read globalIndex.sql
sqlite3 should execute and return you to the sqlite3 command prompt. If you want to see if you have tables that were created, type “.tables”. You should see some tables there. If so and you’re happy, type “.exit” to get out of sqlite3.
Now restart the wiki server:
sudo serveradmin start teams
…and go to the mailing list page that was bothering you. You should see that it is now missing. Hooray!
I’ll be filing a bug report on this. This is way too hard.
Another proven method for exorcising these mailing list posts is to whack the globalIndex.db file completely and restart the teams server. I do not recommend this because it will set incorrect time stamps on all of your old entries across the entire server. Although… if you have a lot of posts to get rid of, this might be the best way to do it.
$deity help you if a spammer gets ahold of your wiki mailing list address.
Blabber back