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.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.pm')
-rw-r--r-- | IkiWiki.pm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index 2d692a978..dfd224062 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -231,9 +231,10 @@ sub srcfile ($) { #{{{ error("internal error: $file cannot be found"); } #}}} -sub readfile ($;$) { #{{{ +sub readfile ($;$$) { #{{{ my $file=shift; my $binary=shift; + my $wantfd=shift; if (-l $file) { error("cannot read a symlink ($file)"); @@ -242,16 +243,18 @@ sub readfile ($;$) { #{{{ local $/=undef; open (IN, $file) || error("failed to read $file: $!"); binmode(IN) if ($binary); + return \*IN if $wantfd; my $ret=<IN>; close IN; return $ret; } #}}} -sub writefile ($$$;$) { #{{{ +sub writefile ($$$;$$) { #{{{ my $file=shift; # can include subdirs my $destdir=shift; # directory to put file in my $content=shift; my $binary=shift; + my $wantfd=shift; my $test=$file; while (length $test) { @@ -274,6 +277,7 @@ sub writefile ($$$;$) { #{{{ open (OUT, ">$destdir/$file") || error("failed to write $destdir/$file: $!"); binmode(OUT) if ($binary); + return \*OUT if $wantfd; print OUT $content; close OUT; } #}}} |