]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/po.pm
po: make the "backlinks involve dependencies" feature optional
[git.ikiwiki.info.git] / IkiWiki / Plugin / po.pm
index 363720e1dfefc55230c6bda250256172ed58e8ca..6f716a91f2a741253141b998e30aed74eb3fc83b 100644 (file)
@@ -126,6 +126,13 @@ sub getsetup () {
                        safe => 1,
                        rebuild => 1,
                },
+               po_strictly_refresh_backlinks => {
+                       type => "boolean",
+                       example => 1,
+                       description => "refresh a page when a backlinked page is changed (can hit performance)",
+                       safe => 1,
+                       rebuild => 1,
+               },
 }
 
 sub checkconfig () {
@@ -166,6 +173,10 @@ sub checkconfig () {
            ! defined $config{po_translation_status_in_links}) {
                $config{po_translation_status_in_links}=1;
        }
+       if (! exists $config{po_strictly_refresh_backlinks} ||
+           ! defined $config{po_strictly_refresh_backlinks}) {
+               $config{po_strictly_refresh_backlinks}=1;
+       }
        push @{$config{wiki_file_prune_regexps}}, qr/\.pot$/;
 }
 
@@ -266,7 +277,7 @@ sub pagetemplate (@) {
                $template->param(percenttranslated => percenttranslated($page));
        }
        if ($template->query(name => "istranslation")) {
-               $template->param(istranslation => istranslation($page));
+               $template->param(istranslation => scalar istranslation($page));
        }
        if ($template->query(name => "istranslatable")) {
                $template->param(istranslatable => istranslatable($page));
@@ -307,8 +318,10 @@ sub pagetemplate (@) {
 
 sub postscan (@) {
        my %params = @_;
-       my $page = $params{page};
 
+       return unless $config{po_strictly_refresh_backlinks};
+
+       my $page = $params{page};
        # backlinks involve back-dependencies, so that nicepagetitle effects,
        # such as translation status displayed in links, are updated
        use IkiWiki::Render;