diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-02-03 03:27:33 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-02-03 03:27:33 +0000 |
commit | 97aea861624d1a1c6127857adb19dce16eab510e (patch) | |
tree | b1527632de1de73d4415aedb4c8ca52a171826c8 /IkiWiki/Render.pm | |
parent | 762ecf946180e5cb5012114b58d297293529bcc1 (diff) | |
download | ikiwiki-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/Render.pm')
-rw-r--r-- | IkiWiki/Render.pm | 19 |
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; } } #}}} |