[ewiki] Re: ewiki_binary() patch, ewiki_control_links() refactor

> My team member, Jeff added error logging for binary file errors.  Also, I
> would like to add a meta data field to cached images.  The perm_liveuser
> functions use this to set cached images to have different rights than
> uploaded ones.

Yo, but there are rarely errors on fclose(), after fopen() it would
make far more sense. And then you simply could reduce it to one total
error_log call ("readin/writing failed for...").

(Btw, wouldn't copy() do it here?)


>
> also, can we add a set of binary_handlers?   These would run in
> binary_save_image() as follows:

The _binary_save_image() could need such a general plugin hook, of
course (and a new name also). But what plugins do you have in mind,
and is the hook applicable to other uses?

>         if ($pf_a = @$ewiki_plugins['binary_handler']) {
>   //xxx     ksort($pf_a);
>             foreach ($pf_a as $pf) {
>                 $pf($id, $data, 'save');

Also the hook should get a different name (_store or _save or so).
The existing ["binary_store"] appears to cannot be moved down any
further. But if your plugins would work with $data being filled
except for the {content} field, there was a way to reduce it to
one plugin hook here.


>
> I would like us to refactor ewiki_control_links() so that I can reuse the
> inner foreach in page_info, page_imagegallery, and the downloads system.
> The below code implements this and also adds a security check.  Can I commit
> this?

If it's reuseable, then just do it.
All fine for me, except for your editors after-tab spaces, as usual ;)

mario

Other related posts: