code checking for locked pages into a new "lockedit" plugin. Both are
* Avoid using lots of memory when copying large non-html files. Yes, you can keep videos in the wiki..master
parent
762ecf9461
commit
97aea86162
|
@ -231,9 +231,10 @@ sub srcfile ($) { #{{{
|
||||||
error("internal error: $file cannot be found");
|
error("internal error: $file cannot be found");
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
sub readfile ($;$) { #{{{
|
sub readfile ($;$$) { #{{{
|
||||||
my $file=shift;
|
my $file=shift;
|
||||||
my $binary=shift;
|
my $binary=shift;
|
||||||
|
my $wantfd=shift;
|
||||||
|
|
||||||
if (-l $file) {
|
if (-l $file) {
|
||||||
error("cannot read a symlink ($file)");
|
error("cannot read a symlink ($file)");
|
||||||
|
@ -242,16 +243,18 @@ sub readfile ($;$) { #{{{
|
||||||
local $/=undef;
|
local $/=undef;
|
||||||
open (IN, $file) || error("failed to read $file: $!");
|
open (IN, $file) || error("failed to read $file: $!");
|
||||||
binmode(IN) if ($binary);
|
binmode(IN) if ($binary);
|
||||||
|
return \*IN if $wantfd;
|
||||||
my $ret=<IN>;
|
my $ret=<IN>;
|
||||||
close IN;
|
close IN;
|
||||||
return $ret;
|
return $ret;
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
sub writefile ($$$;$) { #{{{
|
sub writefile ($$$;$$) { #{{{
|
||||||
my $file=shift; # can include subdirs
|
my $file=shift; # can include subdirs
|
||||||
my $destdir=shift; # directory to put file in
|
my $destdir=shift; # directory to put file in
|
||||||
my $content=shift;
|
my $content=shift;
|
||||||
my $binary=shift;
|
my $binary=shift;
|
||||||
|
my $wantfd=shift;
|
||||||
|
|
||||||
my $test=$file;
|
my $test=$file;
|
||||||
while (length $test) {
|
while (length $test) {
|
||||||
|
@ -274,6 +277,7 @@ sub writefile ($$$;$) { #{{{
|
||||||
|
|
||||||
open (OUT, ">$destdir/$file") || error("failed to write $destdir/$file: $!");
|
open (OUT, ">$destdir/$file") || error("failed to write $destdir/$file: $!");
|
||||||
binmode(OUT) if ($binary);
|
binmode(OUT) if ($binary);
|
||||||
|
return \*OUT if $wantfd;
|
||||||
print OUT $content;
|
print OUT $content;
|
||||||
close OUT;
|
close OUT;
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
|
@ -195,10 +195,25 @@ sub render ($) { #{{{
|
||||||
$oldpagemtime{$page}=time;
|
$oldpagemtime{$page}=time;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
my $content=readfile($srcfile, 1);
|
my $srcfd=readfile($srcfile, 1, 1);
|
||||||
delete $depends{$file};
|
delete $depends{$file};
|
||||||
will_render($file, $file, 1);
|
will_render($file, $file, 1);
|
||||||
writefile($file, $config{destdir}, $content, 1);
|
my $destfd=writefile($file, $config{destdir}, undef, 1, 1);
|
||||||
|
my $blksize = 16384;
|
||||||
|
my ($len, $buf, $written);
|
||||||
|
while ($len = sysread $srcfd, $buf, $blksize) {
|
||||||
|
if (! defined $len) {
|
||||||
|
next if $! =~ /^Interrupted/;
|
||||||
|
error("failed to read $srcfile: $!");
|
||||||
|
}
|
||||||
|
my $offset = 0;
|
||||||
|
while ($len) {
|
||||||
|
defined($written = syswrite OUT, $buf, $len, $offset)
|
||||||
|
or error("failed to write $file: $!");
|
||||||
|
$len -= $written;
|
||||||
|
$offset += $written;
|
||||||
|
}
|
||||||
|
}
|
||||||
$oldpagemtime{$file}=time;
|
$oldpagemtime{$file}=time;
|
||||||
}
|
}
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
|
@ -5,7 +5,7 @@ ikiwiki (1.42) UNRELEASED; urgency=low
|
||||||
* Add canedit hook, allowing arbitrary controls over when a page can be
|
* Add canedit hook, allowing arbitrary controls over when a page can be
|
||||||
edited.
|
edited.
|
||||||
* Move code forcing signing before edit to a new "signinedit" plugin, and
|
* Move code forcing signing before edit to a new "signinedit" plugin, and
|
||||||
code checking for locked pages into a new "lockedit" plugin. Both are
|
code checking for locked pages into a new "lockedit" plugin. Both are
|
||||||
enabled by default.
|
enabled by default.
|
||||||
* Remove the anonok config setting. This is now implemented by a new
|
* Remove the anonok config setting. This is now implemented by a new
|
||||||
"anonok" plugin. Anyone with a wiki allowing anonymous edits should
|
"anonok" plugin. Anyone with a wiki allowing anonymous edits should
|
||||||
|
@ -13,8 +13,10 @@ ikiwiki (1.42) UNRELEASED; urgency=low
|
||||||
* Add an opendiscussion plugin that allows anonymous users to edit
|
* Add an opendiscussion plugin that allows anonymous users to edit
|
||||||
discussion pages, on a wiki that is otherwise wouldn't allow it.
|
discussion pages, on a wiki that is otherwise wouldn't allow it.
|
||||||
* Lots of CGI code reorg and cleanup.
|
* Lots of CGI code reorg and cleanup.
|
||||||
|
* Avoid using lots of memory when copying large non-html files.
|
||||||
|
Yes, you can keep videos in the wiki..
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Thu, 1 Feb 2007 15:36:38 -0500
|
-- Joey Hess <joeyh@debian.org> Fri, 2 Feb 2007 21:59:04 -0500
|
||||||
|
|
||||||
ikiwiki (1.41) unstable; urgency=low
|
ikiwiki (1.41) unstable; urgency=low
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue