tag 442398 etch
thanks
On Thu, Sep 20, 2007 at 08:54:46AM +0300, Niko Tyni wrote:
> - the bug shows up when $RT::WebPath is changed after the database
> has been initialized. At initialization time, the variable is
> interpolated correctly.
>
> - the suggested 'rt-setup-database --action insert' is not an optimal
> fix for existing databases: it will duplicate the database content
>
> - the database contents are serialized by Storable, so the upgrade script
> must be done by using the RT API and not by modifying the database
> directly. This would probably have been a good idea in any case.
>
> I'll look into the upgrade script.
I'm attaching a Perl script that fixes the wrong attribute content in
an existing database. This should help Etch users suffering from the bug.
I'll include a variant of this in the postinst script for the next upload
to unstable.
Ivan: I'm quite sceptical about getting this fixed in Etch. The impact is
quite low, and the bug doesn't affect all users. Furthermore, a proper
fix with something like this script run on upgrade would be quite a
complex and error-prone change for stable.
Do you think we should try to get just a fixed initialdata file into Etch?
Cheers,
--
Niko Tyni [EMAIL PROTECTED]
#!/usr/bin/perl -w
use strict;
use lib "/usr/share/request-tracker3.6/lib";
use RT;
RT::LoadConfig;
$RT::LogToScreen = 'notice';
RT::InitLogging;
$RT::Logger->debug("Connecting to the database");
require RT::Handle;
$RT::Handle = RT::Handle->new();
$RT::Handle->Connect();
my $CurrentUser = new RT::CurrentUser();
my $attr = RT::Attribute->new($CurrentUser);
$RT::Logger->debug("Loading the possibly broken attribute");
$attr->LoadByCols(Name => "Search - My Tickets");
my $format = $attr->SubValue('Format');
$RT::Logger->debug("Format value: $format");
my @matches = ($format =~ m{href="([^"]*)/Ticket/Display.html}g);
for my $match (@matches) {
next if $match eq "__WebPath__";
$RT::Logger->notice("Replacing webpath \"$match\" with __WebPath__");
$format =~ s{href="\Q$match\E/Ticket/Display.html}{href="__WebPath__/Ticket/Display.html};
$attr->SetSubValues(Format => $format);
$RT::Logger->debug("Format now: $format");
}
$RT::Logger->debug("Finished");