aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-02-03 03:27:33 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-02-03 03:27:33 +0000
commit97aea861624d1a1c6127857adb19dce16eab510e (patch)
treeb1527632de1de73d4415aedb4c8ca52a171826c8 /IkiWiki
parent762ecf946180e5cb5012114b58d297293529bcc1 (diff)
downloadikiwiki-97aea861624d1a1c6127857adb19dce16eab510e.tar
ikiwiki-97aea861624d1a1c6127857adb19dce16eab510e.tar.gz
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..
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Render.pm19
1 files changed, 17 insertions, 2 deletions
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index dcd107b81..2ad80ced3 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -195,10 +195,25 @@ sub render ($) { #{{{
$oldpagemtime{$page}=time;
}
else {
- my $content=readfile($srcfile, 1);
+ my $srcfd=readfile($srcfile, 1, 1);
delete $depends{$file};
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;
}
} #}}}