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

Sync not possible when remote side is read-only #52

Open
cziehr opened this issue Nov 10, 2019 · 1 comment
Open

Sync not possible when remote side is read-only #52

cziehr opened this issue Nov 10, 2019 · 1 comment

Comments

@cziehr
Copy link

cziehr commented Nov 10, 2019

If the user who is syncing has only read permissions on the remote wiki, the sync fails, because pages can't be locked.

I helped myself by commenting out the lines

foreach((array) $data['lockfail'] as $id){
$this->_listOut($this->getLang('lockfail').' '.hsc($id),'error');
unset($synclist[$id]);
}

in lib/plugins/sync/admin.php

but this is rather quick'n'dirty and lost after every upgrade of the plugin.

It would be nice if the sync plugin recognizes when a page or a namespace is read only in the remote wiki and skips locking in this case - because locking isn't necessary when the page can't be edited.

@rwaight
Copy link

rwaight commented Aug 3, 2023

Thanks for sharing the fix @cziehr. Just to clarify the code that causes the couldn't lock and will skip error is in lines 366-369 of admin.php, which is:

        foreach((array) $data['lockfail'] as $id){
            $this->_listOut($this->getLang('lockfail').' '.hsc($id),'error');
            unset($synclist[$id]);
        }

I'm sure there is a reason that @splitbrain has this section in the code, but it would be good to have the option to skip that check.

For anyone looking for a fix to this (until a code update is made), you can either delete the lines listed above or make the following updates to admin.php (also available in this branch):

        // allow read-only access to the remote wiki
        // the below code causes sync to fail when the remote
        // user only has read access to the remote wiki
        // foreach((array) $data['lockfail'] as $id){
        //     $this->_listOut($this->getLang('lockfail').' '.hsc($id),'error');
        //     unset($synclist[$id]);
        // }

Once the update is made, you can start the synchronization again and should get a pull succeded response for the files.

This is also related to #51

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

2 participants