+
+sub do_rename ($$$) { #{{{
+ my $srcfile=shift;
+ my $destfile=shift;
+ my $session=shift;
+
+ # Actual file rename happens here.
+ # First, ensure that the dest directory exists and is ok.
+ IkiWiki::prep_writefile($destfile, $config{srcdir});
+ if ($config{rcs}) {
+ IkiWiki::rcs_rename($srcfile, $destfile);
+ IkiWiki::rcs_commit_staged(
+ sprintf(gettext("rename %s to %s"), $srcfile, $destfile),
+ $session->param("name"), $ENV{REMOTE_ADDR});
+ }
+ else {
+ if (! rename("$config{srcdir}/$srcfile", "$config{srcdir}/$destfile")) {
+ error("rename: $!");
+ }
+ }
+} # }}}