It seems connected to some hooks I am using in my config.php.
In fact, when I remove these hooks, the pages get saved quickly.
The hook in question is the following. It renames files names to match the page title.
// Rename and sanitize file names on panel save
kirby()->hook('panel.page.update', function($page) {
$count = 0;
$title = $page->title();
$images = $page->images();
foreach ($images as $image) {
$count++;
// Remove dots in name
$search = array(".");
$replace = array("");
$title = str_replace($search, $replace, $title);
// Add 0 before $count so that it is two digits
$count = str_pad($count, 2, '0', STR_PAD_LEFT);
$old_filename = $image->filename();
$filename = $title . "-" . $count;
if (strpos($old_filename, 'box') !== false) {
$filename = $filename . "-box";
} elseif (strpos($old_filename, 'logo') !== false) {
$filename = $filename . "-logo";
} elseif (strpos($old_filename, 'advertising') !== false) {
$filename = $filename . "-advertising";
}
$image->rename($filename);
};
});
I have tried commenting out all the function and leaving kist the empty hook, and it is still slow. If I do remove the hook, the panel returns to be quick …
The plugin uses the following hooks. Do you notice anything wrong I could try fix?
// Set id for new pages
kirby()->hook('panel.page.create', function($page) use ($plugin) {
return $plugin->onPageCreate($page);
});
// Set id for existing pages (if added later)
kirby()->hook('panel.page.update', function($page) use ($plugin) {
// trigger update only with version 2.2.2 or higher
$version = intval(str_replace('.', '', panel()->version()));
if($version >= 222) {
return $plugin->onPageUpdate($page);
} else {
// do nothing, because of a kirby bug: https://github.com/getkirby/panel/issues/667
}
});
It seems that since 2.3 we suddenly have this problem with multiple hooks that did not exist before.
If you don’t need the update hook for existing pages in the autoid plugin, you can try to simply remove that hook there. Then your update hook should work again.