Move Pages Plugin

Ahh, I see now. Let me check the issue.

Iā€™ve found the issue. Iā€™ll fix the issue in next release. Thanks for help.

1 Like

Version 2.3.0

:bug: Fixes

  • Hook argument issue fixed with cloning fix

:warning: Breaking Changes

  • Dropped PHP 7.4 support

Thanks @ahmetbora for the pluginā€™s new version butā€¦ It doesnā€™t work yet.

[...]
    'page.move:after' => function (Kirby\Cms\Page $newPage, Kirby\Cms\Page $oldPage, ?Kirby\Cms\Page $parent = null) 
    { 
      Db::update('Pages', ['pagePath' => $newPage->uri()], ['pageAutoID' => $newPage->pageAutoID()]);
      file_put_contents('page.move.after.log', $newPage->uri().'|'.$oldPage->pageAutoID() . PHP_EOL . PHP_EOL, FILE_APPEND);
    },

$oldPage->pageAutoID() (but $newPage->pageAutoID() as well) are null (see the screenshot after the pipe)

ā€¦Let me add one (strange) thing: I found moved pages are quite slower to load than other pages. I donā€™t have data to prove what Iā€™m saying, and I donā€™t know how to track the page loading time in a simple way. I wonder if the old URI is cached somewhere (even if I deleted the cache folder), orā€¦ Donā€™t know.

Where the pageAutoID comes from? From content file, model or custom page method?

content file

I think Iā€™ve fixed the issue in last release as 2.3.1. Could you test it, please?

Ok, now it seems to work! Thank you!

Thank you so much for reporting and testing :yellow_heart:

ā€¦Let me add one (strange) thing: I found moved pages are quite slower to load than other pages. I donā€™t have data to prove what Iā€™m saying, and I donā€™t know how to track the page loading time in a simple way. I wonder if the old URI is cached somewhere (even if I deleted the cache folder), orā€¦ Donā€™t know.

This may be because if there are images on the page, images are processing (thumbs in media directory) for the new path for the first time.

Hm, canā€™t get the query language to work with the plugin. When I use

options:
  move:
    - templateName

this works fine, except I want the order reversed which would be something like:

options:
  move:
    - site.children.filterBy('template', 'issue').sortBy('title', 'desc')

but even site.children or kirby.page('archive').children (found here) does not return anything in the panel options. Any idea what the problem could be?

Using Kirby 3.9.1, MovePages 2.3.1 on PHP 8.1.14.

Try like that

options:
  move: site.children.filterBy('template', 'issue').sortBy('title', 'desc')

Donā€™t forget! To move a page under the another page, the parent page must support the page template you are moving. This option must be a query language string or an array of templates and must be a collection of pages, not a single page.

Oh, interesting and thanks for the hint! Why does it work when not using the yaml list? This implies that I have to either choose KQL or the list feature but cannot combine both, right?

Exactly!

1 Like

One more thing unrelated to the previous issue: Would it be possible or do you plan to add support for moving multiple pages to a new destination?

Not in our agenda but Iā€™ll note this idea our list.

1 Like

Version 2.3.2

:sparkles: Enhancements

  • Added new user permission
# /site/blueprints/users/editor.yml
title: Editor
permissions:
  owebstudio.move-pages:
    move: false