X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/3adb47ec4f7374128d18a88cff54269104fc21fe..0e7b18d909bb70b407c9da14140e69dd80116385:/IkiWiki/Plugin/rename.pm?ds=sidebyside diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm index 537e91317..e871b815d 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm @@ -108,6 +108,7 @@ sub check_canrename ($$$$$$) { } } }); + return defined $canrename ? $canrename : 1; } sub rename_form ($$$) { @@ -125,12 +126,14 @@ sub rename_form ($$$) { method => 'POST', javascript => 0, params => $q, - action => $config{cgiurl}, + action => IkiWiki::cgiurl(), stylesheet => 1, fields => [qw{do page new_name attachment}], ); $f->field(name => "do", type => "hidden", value => "rename", force => 1); + $f->field(name => "sid", type => "hidden", value => $session->id, + force => 1); $f->field(name => "page", type => "hidden", value => $page, force => 1); $f->field(name => "new_name", value => pagetitle($page, 1), size => 60); if (!$q->param("attachment")) { @@ -286,6 +289,8 @@ sub sessioncgi ($$) { postrename($session); } elsif ($form->submitted eq 'Rename' && $form->validate) { + IkiWiki::checksessionexpiry($q, $session, $q->param('sid')); + # Queue of rename actions to perfom. my @torename; @@ -345,8 +350,9 @@ sub sessioncgi ($$) { $pagesources{$rename->{src}}=$rename->{destfile}; } IkiWiki::rcs_commit_staged( - sprintf(gettext("rename %s to %s"), $srcfile, $destfile), - $session->param("name"), $ENV{REMOTE_ADDR}) if $config{rcs}; + message => sprintf(gettext("rename %s to %s"), $srcfile, $destfile), + session => $session, + ) if $config{rcs}; # Then link fixups. foreach my $rename (@torename) { @@ -561,6 +567,7 @@ sub fixlinks ($$$) { } if ($needfix) { my $file=$pagesources{$page}; + next unless -e $config{srcdir}."/".$file; my $oldcontent=readfile($config{srcdir}."/".$file); my $content=renamepage_hook($page, $rename->{src}, $rename->{dest}, $oldcontent); if ($oldcontent ne $content) { @@ -568,11 +575,10 @@ sub fixlinks ($$$) { eval { writefile($file, $config{srcdir}, $content) }; next if $@; my $conflict=IkiWiki::rcs_commit( - $file, - sprintf(gettext("update for rename of %s to %s"), $rename->{srcfile}, $rename->{destfile}), - $token, - $session->param("name"), - $ENV{REMOTE_ADDR} + file => $file, + message => sprintf(gettext("update for rename of %s to %s"), $rename->{srcfile}, $rename->{destfile}), + token => $token, + session => $session, ); push @fixedlinks, $page if ! defined $conflict; }