[pmwiki-users] shared storage via http? and upload via http

Stefan Schimanski sts at 1stein.org
Thu Oct 26 09:37:19 CDT 2006


So, here you are:

--------
class RemotePageStore extends PageStore {
  function RemotePageStore( $dir ) {
    $this->PageStore( $dir );
  }

  function exists($pagename) {
    if (!$pagename) return false;
    $pagefile = $this->pagefile($pagename);
    if( $pagefile ) {
      $f = fopen($pagefile, "r");
      if( $f ) {
        fclose( $f );
        return true;
      }
    }
    return false;
  }
}                                                                                                                                                                                                    
$WikiLibDirs[] = new RemotePageStore('http://test.1stein.org/remote-wiki.d/{$FullName}');
---------

And that's how it looks like: http://test.1stein.org/Remote/Test
And the proof:

    192.168.0.3 - - [26/Oct/2006:16:42:15 +0200] "GET /remote-wiki.d/Remote.Test HTTP/1.0" 200 540 "-" "-"  

Schimmi

> I guess the problem is that PHP cannot "stat" files with http:// urls:
>
>   http://de3.php.net/manual/en/wrappers.http.php
>
> The PageStore calls file_exists which then tries to stat the page which
> fails. Probably replacing the file_exists in the PageStore by some fopen
> (which is supported for http://) construction will give you an http://
> enabled PageStore.
>
> Schimmi
>
>> If I'm correct, it's possible from php to read data via http/ftp and so 
>> I tried this:
>>
>> $LockFile = "$FarmD/shared.d/.flock";
>>     $WikiLibDirs = array(
>>       &$WikiDir,
>>       new PageStore('http://www.ddy.ch/pm/laden/wiki.d/$FullName'),
>>       new PageStore('$FarmD/shared.d/$FullName', 1),
>>       new PageStore('$FarmD/wikilib.d/$FullName'));
>>
>> There ist no error, but additonal pages are not found either.
>> Question:
>> Would it theoretically possible to extend a wiki like that?
>> May be it would be extremly slow?
>>
>> Also for the upload it would be nice to be able to *copie* data via http.
>> It doesn't work (but the upload-page works with a html-mechanisme to 
>> upload files, which is a different case).
>>
>> regards
>> Patrick Ogay





More information about the pmwiki-users mailing list