TypeMover, MTArchiveList and Weekly mode in MT 3.2
The Setup
I used TypeMover to migrate a site from a MT 3.17 install to a MT 3.2 install. The site happens to use Weekly archiving as the default, so that was what the Master Archive Index was trying to pick up.
The Symptom
The generated file had no weekly archive links. Oh no!
The Problem
There is a new column in the mt_entry table called entry_week_number which is the 4-digit year concatenated with the 2-digit week number (i.e. 200517). TypeMover will not populate this and the entry will have a NULL value. This borks the MTArchiveList template tag when archive_type is set to 'Weekly.' It does not break the building of the weekly pages themselves though.
The Fix
I choose to fix the database because it would take less time. I don't dive into perl code all that well. So if you are using mysql for you datastore, this script will update you.
#/usr/bin/perl -w
use Date::Manip;
use DBI;
my $dbh =
DBI->connect("DBI:mysql:mt32:localhost", 'user', 'password');
$sql = "SELECT entry_id, entry_created_on from mt_entry
WHERE entry_week_number IS NULL";
$result = $dbh->prepare($sql);
$result->execute();
$sqlUpdate =
"UPDATE mt_entry set entry_week_number = ? where entry_id = ?";
$update = $dbh->prepare($sqlUpdate);
while(my @row = $result->fetchrow_array)
{
$id = $row[0];
$week = UnixDate($row[1],'%Y%W');
$update->execute($week,$id);
}
Now, wasn't that fun?
