| 1 | package Kwiki::Archive; | ||||||||||||
| 2 | 2 | ▶ | use Kwiki::Plugin -Base; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 2 | ▶ | |||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | const class_id => 'archive'; | |||||||||||
| 5 | 2 | const class_title => 'Page Archive'; | |||||||||||
| 6 | 2 | const show_revisions => 1; | |||||||||||
| 7 | |||||||||||||
| 8 | 0 | ▶ | sub register { | ||||||||||
|
Subroutine
register: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 9 | 0 | my $registry = shift; | |||||||||||
| 10 | 0 | $registry->add(hook => 'page:store', post => 'commit_hook'); | |||||||||||
| 11 | } | ||||||||||||
| 12 | |||||||||||||
| 13 | 1 | ▶ | sub init { | ||||||||||
|
Subroutine
init: called CC=2 SCAR=9.2
Pod
documented
| |||||||||||||
| 14 | 1 | ▶ | if ($self->empty) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 15 | 0 | $self->generate; | |||||||||||
| 16 | 0 | $self->commit_all; | |||||||||||
| 17 | }; | ||||||||||||
| 18 | } | ||||||||||||
| 19 | |||||||||||||
| 20 | 1 | ▶ | sub empty { | ||||||||||
|
Subroutine
empty: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||
| 21 | 1 | my $dir = io($self->plugin_directory); | |||||||||||
| 22 | 1 | ▶ | $dir->exists and $dir->empty; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 23 | } | ||||||||||||
| 24 | |||||||||||||
| 25 | 0 | ▶ | sub generate { | ||||||||||
|
Subroutine
generate: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 26 | 0 | my $dir = $self->plugin_directory; | |||||||||||
| 27 | 0 | umask 0000; | |||||||||||
| 28 | 0 | chmod 0777, $dir; | |||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | 0 | ▶ | sub commit_hook { | ||||||||||
|
Subroutine
commit_hook: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 32 | 0 | my $hook = pop; | |||||||||||
| 33 | 0 | ▶ | return unless $hook->returned_true; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 34 | 0 | my $page = $self; | |||||||||||
| 35 | 0 | $self = $page->hub->archive; | |||||||||||
| 36 | 0 | $self->commit($page); | |||||||||||
| 37 | } | ||||||||||||
| 38 | |||||||||||||
| 39 | 0 | ▶ | sub commit_all { | ||||||||||
|
Subroutine
commit_all: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 40 | 0 | for my $page ($self->pages->all) { | |||||||||||
| 41 | 0 | $self->commit($page); | |||||||||||
| 42 | } | ||||||||||||
| 43 | } | ||||||||||||
| 44 | |||||||||||||
| 45 | 0 | ▶ | sub page_properties { | ||||||||||
|
Subroutine
page_properties: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||
| 46 | 0 | my $page = shift; | |||||||||||
| 47 | 0 | my $properties = $page->metadata->to_hash; | |||||||||||
| 48 | 0 | ▶ | $properties->{edit_by} ||= ''; | ||||||||||
|
Condition0%0/2
$properties->{"edit_by"} ||= ""
MC/DC0%0/1
$properties->{"edit_by"} ||= ""
$properties->{"edit_by"}
Truth table0%0/2
A
A= $properties->{"edit_by"}
| |||||||||||||
| 49 | 0 | ▶ | $properties->{edit_time} ||= scalar(gmtime); | ||||||||||
|
Condition0%0/2
$properties->{"edit_time"} ||= scalar gmtime
MC/DC0%0/1
$properties->{"edit_time"} ||= scalar gmtime
$properties->{"edit_time"}
Truth table0%0/2
A
A= $properties->{"edit_time"}
| |||||||||||||
| 50 | 0 | ▶ | $properties->{edit_unixtime} ||= scalar(time); | ||||||||||
|
Condition0%0/2
$properties->{"edit_unixtime"} ||= scalar time
MC/DC0%0/1
$properties->{"edit_unixtime"} ||= scalar time
$properties->{"edit_unixtime"}
Truth table0%0/2
A
A= $properties->{"edit_unixtime"}
| |||||||||||||
| 51 | 0 | return $properties; | |||||||||||
| 52 | } | ||||||||||||
| 53 | |||||||||||||
| 54 | 0 | ▶ | sub revision_number { | ||||||||||
|
Subroutine
revision_number: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 55 | 0 | ▶ | $self->history(shift)->[0]->{revision_id} || 0; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 56 | } | ||||||||||||
| 57 | |||||||||||||
| 58 | 0 | ▶ | sub revision_numbers { | ||||||||||
|
Subroutine
revision_numbers: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 59 | 0 | my $page = shift; | |||||||||||
| 60 | 0 | [map $_->{revision_id}, @{$self->history($page)}]; | |||||||||||
| 61 | } | ||||||||||||
| 62 | |||||||||||||
| 63 | 2 | __DATA__ | |||||||||||