Skip to content

Commit

Permalink
Item13817: Don't re-read topic repeatedly
Browse files Browse the repository at this point in the history
Change ERP from using Func::getRevisionInfo() to use Meta functions on
the loaded meta object.  Very significant performance boost for large
tables.
  • Loading branch information
gac410 committed Oct 19, 2015
1 parent f379321 commit b8d4648
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
12 changes: 9 additions & 3 deletions EditRowPlugin/lib/Foswiki/Plugins/EditRowPlugin/Table.pm
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ sub getTopic {
return $this->{meta}->topic();
}

sub getTopicObject {
my $this = shift;
return $this->{meta};
}

# Calculate row labels
sub _assignLabels {
my $this = shift;
Expand Down Expand Up @@ -455,11 +460,12 @@ sub getParams {

$prefix ||= '';

# Get the active (most recent) version number for the topic with this table
my @ri = Foswiki::Func::getRevisionInfo( $this->getWeb, $this->getTopic );
my $meta = $this->getTopicObject();
my $info = $meta->getRevisionInfo();

return (
"${prefix}topic" => $this->getWeb . '.' . $this->getTopic,
"${prefix}version" => "$ri[2]_$ri[0]",
"${prefix}version" => "$info->{version}_$info->{date}",
"${prefix}table" => $this->getID()
);
}
Expand Down
3 changes: 3 additions & 0 deletions EditRowPlugin/test/unit/EditRowPlugin/HTML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ sub loadExtraConfig {
my $this = shift;

$this->SUPER::loadExtraConfig();
$Foswiki::cfg{Plugins}{EditRowPlugin}{Enabled} = 1;
$Foswiki::cfg{Plugins}{EditRowPlugin}{Macro} = 'EDITTABLE';
$Foswiki::cfg{Plugins}{EditTablePlugin}{Enabled} = 0;
}

sub test_simple_view {
Expand Down
3 changes: 3 additions & 0 deletions EditRowPlugin/test/unit/EditRowPlugin/Parser.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ sub loadExtraConfig {
my $this = shift;

$this->SUPER::loadExtraConfig();
$Foswiki::cfg{Plugins}{EditRowPlugin}{Enabled} = 1;
$Foswiki::cfg{Plugins}{EditRowPlugin}{Macro} = 'EDITTABLE';
$Foswiki::cfg{Plugins}{EditTablePlugin}{Enabled} = 0;
}

sub test_EDITTABLE {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ sub set_up {
$Foswiki::cfg{AllowInlineScript} = 0;
$Foswiki::cfg{Plugins}{TablePlugin}{DefaultAttributes} =
'tableborder="1" valign="top" headercolor="#fff" headerbg="#687684" headerbgsorted="#334455" databg="#ddd,#edf4f9" databgsorted="#f1f7fc,#ddebf6" tablerules="rows" headerrules="cols"';
$Foswiki::cfg{Plugins}{EditRowPlugin}{Enabled} = 0;
$Foswiki::cfg{Plugins}{EditTablePlugin}{Enabled} = 1;

local $ENV{SCRIPT_NAME} = ''; # required by fake sort URLs in expected text

Expand Down

0 comments on commit b8d4648

Please sign in to comment.