Please see the attached patch. It removes the escape for "/" because
wiki now accepts URLs of the form http://wiki.linux-ha.org/XXX/YYY
instead of http://wiki.linux-ha.org/XXX_2fYYY, also rearranges the
test for caching so that one unlink() is saved, and removes one
touch() and chmod() call which I think is unnecessary.


On 1/3/06, Xun Sun <[EMAIL PROTECTED]> wrote:
> On 1/3/06, Alan Robertson <[EMAIL PROTECTED]> wrote:
> > Xun Sun wrote:
> > > On 1/3/06, Kyle Hayes <[EMAIL PROTECTED]> wrote:
> > >> On Monday 02 January 2006 09:07, Alan Robertson wrote:
> > >>> Hi all,
> > >>>
> > >>> It looks like our update of the web site was successful.  Something in
> > >>> the process hammered a few pages with old versions, but I believe those
> > >>> are now fixed.
> > >>>
> > >>> The web site now uses UTF-8 for its character set, which allows pages to
> > >>> be written in any language.
> > >>>
> > >>> More details will be forthcoming on this.
> > >> Most of the links off of the RelatedTechnologies page seem to be blank
> > >> pages.  The links on that page that point to other sites appear to work.
> > >> It is just the links that point to the Linux HA site itself that end in
> > >> blank pages.
> > >
> > > Thanks for reporting this problem.
> > >
> > > They are fixed now (not in cvs, but directly on web server) to reflect
> > > the new wiki URL format, Alan may decide whether my fix is sufficient
> > > or not.
> >
> > Only if you tell me what you did (!)
>
> I modified moinmoin.php and trick.php, the special chars are not
> escaped now (at least the "/" should not be escaped now). I will come
> up with a patch againt cvs for your review.
> >
> > --
> >      Alan Robertson <[EMAIL PROTECTED]>
> >
> > "Openness is the foundation and preservative of friendship...  Let me
> > claim from you at all times your undisguised opinions." - William
> > Wilberforce
> > _______________________________________________________
> > Linux-HA-Dev: [email protected]
> > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > Home Page: http://linux-ha.org/
> >
> --
> Thanks & regards
> Xun Sun
>
--
Thanks & regards
Xun Sun
Index: moinmoin.php
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/website/moinmoin.php,v
retrieving revision 1.17
diff -u -r1.17 moinmoin.php
--- moinmoin.php        3 Jan 2006 14:19:34 -0000       1.17
+++ moinmoin.php        3 Jan 2006 15:45:25 -0000
@@ -75,21 +75,25 @@
        global $MOINMOINstandardreplace, $current_cache_prefix, 
$current_cache_relprefix, $PageTitle;
        global $MOINMOINfetched;
 
-       $PageTitle = str_replace("/","_", $ptitle);
+       # $PageTitle = str_replace("/","_", $ptitle);
+       $PageTitle = $ptitle;
        $filename = "$MOINMOINurl/$PageTitle";
-       $cachefile = 
"$MOINMOINcachedir/$MOINMOINalias$PageTitle$CACHESUFFIX.html";
+       # $cachefile = 
"$MOINMOINcachedir/$MOINMOINalias$PageTitle$CACHESUFFIX.html";
+       $cachefile = sprintf("%s/%s%s%s.html", $MOINMOINcachedir, 
$MOINMOINalias, str_replace("/","_2f", $ptitle), $CACHESUFFIX);
        # for attachments and the like
        $current_cache_prefix = 
"$MOINMOINcachedir/${MOINMOINalias}${PageTitle}__";
        $current_cache_relprefix = "${MOINMOINalias}${PageTitle}__";
        set_time_limit(30);
        umask(077);
        
-       if (MoinMoinNoCache($cachefile) && file_exists($cachefile)) {
-               unlink($cachefile);
-       }
-       if (!file_exists($cachefile))
-       {
-
+       if (!MoinMoinNoCache($cachefile) && file_exists($cachefile)) {
+               $body = implode("",file($cachefile));
+               $msg=sprintf("READ %d bytes from %s"
+               ,       filesize($cachefile), $cachefile);
+               LogIt($msg);
+       } else {
+               if (!file_exists($filename))
+                       return "<b>Not Found.</b>";
                $content = implode("",file($filename));
 
                if (!$GLOBALS["MOINMOINstandardregsloaded"])
@@ -112,19 +116,17 @@
                }
                $body = preg_replace ($MOINMOINallsearch, $MOINMOINallreplace, 
$content);
 
-               $fd = fopen($cachefile, "w");
-               fwrite($fd, $body);
-               fclose ($fd);
-               chmod($cachefile, $MOINMOINfilemod);
-               $msg=sprintf("EXPANDED %d bytes into %s"
-               ,       filesize($cachefile), $cachefile);
-               $MOINMOINfetched[$cachefile] = true;
+               if($fd = fopen($cachefile, "w"))
+               {
+                       fwrite($fd, $body);
+                       fclose ($fd);
+                       chmod($cachefile, $MOINMOINfilemod);
+                       $msg=sprintf("EXPANDED %d bytes into %s"
+                       ,       filesize($cachefile), $cachefile);
+                       LogIt($msg);
+                       $MOINMOINfetched[$cachefile] = true;
+               }
 
-       } else {
-               $body = implode("",file($cachefile));
-               $msg=sprintf("READ %d bytes from %s"
-               ,       filesize($cachefile), $cachefile);
-               LogIt($msg);
        }
 
        return $body;
@@ -329,8 +331,6 @@
        $datestamp=date("Y/m/d_H:i:s");
        if (file_exists($logfile) && filesize($logfile) > 1000000) {
                rename($logfile, "$logfile.OLD");
-               touch($logfile);
-               chmod($logfile, 0644);
        }
        error_log("$datestamp   $message\n", 3, $logfile);
        chmod($logfile, 0644);
Index: trick.php
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/website/trick.php,v
retrieving revision 1.11
diff -u -r1.11 trick.php
--- trick.php   3 Jan 2006 14:19:34 -0000       1.11
+++ trick.php   3 Jan 2006 15:45:25 -0000
@@ -91,7 +91,7 @@
 
 # in case there are some special chars in the page name, that are not yet 
escaped ...
 # $MOINMOINpagename is used to request that page from the wiki, or to read in 
the cache file
-$MOINMOINpagename = str_replace(array(" 
","!",",","-",".","/","'","(",")",":"), array("_20","_21","_2c", 
"_2d","_2e","_2f","_27", "_28", "_29", "_3a"), $MOINMOINpagename);
+$MOINMOINpagename = str_replace(array(" ","!",",","-",".","'","(",")",":"), 
array("_20","_21","_2c", "_2d","_2e","_27", "_28", "_29", "_3a"), 
$MOINMOINpagename);
        
 $content = MoinMoin($MOINMOINpagename);
 
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to