[ewiki] Re: reworked plugin hooks [init]

Andy wrote:
> subject to modification by the EWIKI_AUTO_EDIT code.  This is ok but I
> will have to move my piclogocntrl init plugin to become a self-unsetting
> handler since it uses meta data.  What was the purpose of this change?

I've changed the ["handler"] call to pass a fourth parameter (should
be ignored by other plugins) with the assigned array $index. This will
allow ["handler"] plugins to deregister themselves easily (and saves
us another plugin hook):

  unset($ewiki_plugins["handler"][$param4]):


#

comments on comments:
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
> 
> +//Get all the links from $id as an array of pagenames
> function ewiki_get_links($id) {
>    if ($data = ewiki_database("GET", array("id"=>$id))) {
>       $refs = explode("\n", trim($data["refs"]));

It appears it would be more senseful to serialize() the datebase {refs}
entry (instead of using "\n") like it's already done for {meta}. The
db layer can already transparently encode/decode arrays, so thi would
eventually ease a lot of things.
The "refs" is an important field (and btw, missing in a few other Wiki
implementations); and changing it carries the risk of damaging existing
code, and we again need backwards compatibility here.


>             $add_meta = array(
>                "Content-Location" => urlencode($id),
>-               "Content-Disposition" => 'inline; 
>filename="'.urlencode(basename($id)).'"'
>+               "Content-Disposition" => 'inline; 
>filename="'.urlencode(basename($id)).'"',
>+               'PageType' => 'CachedImage'
>             );

Since this is for images only, I wouldn't call that field 'Page..' but
simply 'type' with 'cached' as parameter (we already have 'class'=>'image').
"PageType" also makes sense, but should be a {meta}{meta} entry instead.


>+
>+      //This call will be very slow ~20 sec if your webserver does 
>+      // not resolve DNS
>    $hostname = gethostbyaddr($ip);
>    $remote = (($ip != $hostname) ? $hostname . " " : "")

If this is that slow, we should make it deconfigureable. Other major
Wiki engines however have it too, so I'd say we keep it enabled per
default.

mario

Other related posts: