ComboStrap / combo

Dokuwiki Combo Plugin. Making Web Publication a Breeze
https://combostrap.com
GNU General Public License v2.0
15 stars 3 forks source link

Error updating or editing page rules #36

Closed listerr closed 2 years ago

listerr commented 2 years ago

Hi,

I added a page rule okay, but when trying to update it, it crashes with:

Dokuwiki: Igor, Php: 7.4

Edit Page Rule Error:

2022-08-11 19:42:33     /var/www/mysite/lib/plugins/combo/ComboStrap/PageRules.php(164)    Error: Call to a member function query() on null
  #0 /var/www/mysite/lib/plugins/combo/admin/pagerules.php(141): ComboStrap\PageRules->updateRule()
  #1 /var/www/mysite/inc/Action/Admin.php(33): admin_plugin_combo_pagerules->handle()
  #2 /var/www/mysite/inc/ActionRouter.php(83): dokuwiki\Action\Admin->preProcess()
  #3 /var/www/mysite/inc/ActionRouter.php(48): dokuwiki\ActionRouter->setupAction()
  #4 /var/www/mysite/inc/ActionRouter.php(60): dokuwiki\ActionRouter->__construct()
  #5 /var/www/mysite/inc/actions.php(16): dokuwiki\ActionRouter::getInstance()
  #6 /var/www/mysite/doku.php(126): act_dispatch()
  #7 {main}

Delete Page rule error:

2022-08-11 19:47:32     /var/www/mysite/lib/plugins/combo/ComboStrap/SqliteRequest.php(146)        TypeError: Argument 2 passed to ComboStrap\SqliteRequest::setQueryParametrized() must be of the type array, string given, called in /var/www/mysite/lib/plugins/combo/ComboStrap/PageRules.php on line 30
  #0 /var/www/mysite/lib/plugins/combo/ComboStrap/PageRules.php(30): ComboStrap\SqliteRequest->setQueryParametrized()
  #1 /var/www/mysite/lib/plugins/combo/admin/pagerules.php(151): ComboStrap\PageRules->deleteRule()
  #2 /var/www/mysite/inc/Action/Admin.php(33): admin_plugin_combo_pagerules->handle()
  #3 /var/www/mysite/inc/ActionRouter.php(83): dokuwiki\Action\Admin->preProcess()
  #4 /var/www/mysite/inc/ActionRouter.php(48): dokuwiki\ActionRouter->setupAction()
  #5 /var/www/mysite/inc/ActionRouter.php(60): dokuwiki\ActionRouter->__construct()
  #6 /var/www/mysite/inc/actions.php(16): dokuwiki\ActionRouter::getInstance()
  #7 /var/www/mysite/doku.php(126): act_dispatch()

Any ideas what's going wrong?

Thanks.

gerardnico commented 2 years ago

Oh man sorry for that. It seems that we missed it. Thanks for reaching out.

With the release of the router and of the page id, this feature was no more used heavily.

Are you trying to redirect to an external url ?

Can you delete and add ?

gerardnico commented 2 years ago

Ok you can't delete. I didn't read to the end.

listerr commented 2 years ago

I ended up deleting it directly from the SQLite table.

Interestingly I could not get the DW SQLite access page to show anything (?do=admin&page=sqlite) as this relies on there being a TOC in the page.

Turns out I had the renderer_xhtml set to DW xhtml and not Combo. When I changed it to Combo renderer, the TOC appears.

I was trying to do a redirect to make a shorter URL for example:

https://my.domain.com/members to a private area (effectively) https://my.domain.com/members/start

I found a way to do it using "Canonical" by first enabling the canonical feature and then adding to members:start the canonical name of "members".

Works but shows a message on the page: "You have been redirected from a permanent named link."

I turned off plugin»combo»ShowMessageClassic but it still seems to show.

The resulting URL is somehwat ugly: https://mysite/members/start?redirectId=members&redirectOrigin=canonical

Ideally, I'd like to get rid of the "/start" for the default namespace pages ends of the URL, but I didn't find a way to do that.

If the URL is, say, "/members/" then DW seems to redirect that. If it's just "/members" then combo redirects it.

Combo Page Rule doesn't add the "/start" on the end, but it would seem to bypass the ACL on the page. If I access it directly as a not logged-in user, then it prompts for a login. If I access it via a page rule then it displays the page anyway.

Maybe the answer is just to forward it permanently using the web server from "^/members$" to "/members/"

Thanks,

Rob

gerardnico commented 2 years ago

That's a pretty good idea to redirect 'members' to 'members/' if the page 'members/start' exists (without any message obviously).

I plan it for the next release (over a month).

gerardnico commented 2 years ago

The ShowMessageClassic configuration should work. We will check that too.

gerardnico commented 2 years ago

The toc for the admin page was already reported and corrected but the patch is in the next release.

We don't use any template, therefore it should work ;)

Thanks for sharing.

gerardnico commented 2 years ago

For the redirect message, it seems that the configuration ShowMessageClassic is a ghost configuration.

It was never implemented. Just added. It's not even in the doc. https://combostrap.com/router/combostrap-url-management-redirection-message-urmu40sr

I'm taking a loot at it now.

The idea if I remember well was to hide the message for public / reader user only. Meaning that a writer would see it as it develops the application.

gerardnico commented 2 years ago

The branch 1.24.1 has the implementation of 'ShowMessageClassic'.

It's a patch branch, to test it, you can install the zip manually within the extension plugin of Dokuwiki.

If this configuration is unset, a reader (public user) will not see any message for a planned redirection (ie page rules or canonical).

gerardnico commented 2 years ago

I have just repaired the modify and delete page rule actions.

A refactoring has broken it unfortunately and we don't saw it as the forms part where not yet automatically tested, we have patch this error.

Thanks. Installation of the zip branch will bring you the patch.

listerr commented 2 years ago

Have just tested this, the errors have gone away. :)

If the redirect goes to a page protected with ACL (i.e. only logged in user is allowed to access) then it bypasses the ACL completely when it does the redirect.

I can't seem to get the Redirection -> Page Aliases fields to save in Metadata Manager.

i.e. - Enter the alias, click save.. go back.. not saved. :(

combo_aliases

Interestingly, I noticed that if the browser window is too narrow when opened (Chrome desktop) then the Metadata Manager page doesn't allow any text input fields to be filled in.

Rob

gerardnico commented 2 years ago

You're right. Alias path is also a bug that has been corrected but in the next release

You can do it manually (The bug is too wide to be quickly corrected).

Example:

---json
{
    "aliases": [
        { "path": ":other:doc" }
    ]
}
---
gerardnico commented 2 years ago

I found it for metadata manager field not accessible

You can install the strap template patch branch.

Commit: https://github.com/ComboStrap/dokuwiki-template-strap/commit/12c4c620fc949f701d9b56525a6d3d383701cf7f

listerr commented 2 years ago

Thanks for the update :)

url alias redirect - An alias redirect (not synonym) does an http redirection, meaning that they just performs a new http query. > You should not have any ACL problem with that .... strange

My testing was on the ComboStrap - Pagerules (admin) section which seems to bypass the ACL. Haven't yet tried aliases, but a redirect from the canonical name seems to work properly.

gerardnico commented 2 years ago

Yeah you are still right. It was a bug and was modified in the last release to a URL redirection I'll do it for the branch patch

gerardnico commented 2 years ago

Done.

You can install the fix if you want via the zip patch branch

gerardnico commented 2 years ago

I'm closing the thread. Incredible how you have found the quirks in the last release :) Don't hesitate to open any other if needed. Best!

gerardnico commented 2 years ago

And by the way, the TOC in the admin for sqlite should have been solved if you have installed the strap branch patch