Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media manager errors from uploaded files (history tab) #53

Open
megatron-uk opened this issue Nov 28, 2024 · 0 comments
Open

Media manager errors from uploaded files (history tab) #53

megatron-uk opened this issue Nov 28, 2024 · 0 comments

Comments

@megatron-uk
Copy link

After installation of dokuwiki-plugin-approve, I notice that accessing any uploaded media files cause an error when you attempt to view their 'history' tab in media manager, with this error being triggered by approve/helper/acl.php:

media_manager_history

This references the following function in acl.php:

public function useApproveHere($id) {
        /** @var helper_plugin_approve_db $db */
        $db = $this->loadHelper('approve_db');
        $page_metadata = $db->getPageMetadata($id);
        if ($page_metadata === null) { // do not use approve plugin here
            return false;
        }
        return true;
    }

I'm not sure why this doesn't work out-of-the-box for media-manager, but it would seem the following change fixes the behaviour:

public function useApproveHere($id) {
        /** @var helper_plugin_approve_db $db */
        if ($id === null) { // do not use approve plugin here
            return false;
        }
        $db = $this->loadHelper('approve_db');
        $page_metadata = $db->getPageMetadata($id);
        if ($page_metadata === null) { // do not use approve plugin here
            return false;
        }
        return true;
    }

i.e. do not attempt to follow the approve plugin workflow if the $id of the object is null.

I'm not a PHP developer, or overly familiar with the internals of Dokuwiki, so I would appreciate it if anyone could identify whether this is a proper fix, or if it will break some other functionality.

This is on Dokuwiki 2024-02-06b, with dokuwiki-approve-plugin head from 25/11/2024.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant