but my problem seems to be with update in general. once i create a hook for panel.page.update the panel progress bar goes into a crawl. the hooked function can even be totally empty.
i am using most current kirby installation (CLI). mac, mamp pro.
tried pushing to webserver. still slow progressbar for panel.page hooks groupe. even tried clean kirby CLI installation with just adding these lines to config.php
function hook_log ($obj) {
file_put_contents('test8.log', 'hello');
}
kirby()->hook('panel.page.update', 'hook_log');
its caused if there are two or more hooks on the same type like ‘panel.page.update’. in my original case it was autoid and my hook. in my clean install it was revisions and my hook. once there is only one hook it works fine, both of them. i created a plugin from my config.php hook but same problem.
thx @texnixe. this fixed the issue with panel.page.update. i will search github issues next time before spending hours myself.
but i still get slow progress if renaming a file. both panel.file.update and panel.file.rename are triggered. i can skip rename hook if needed but i am curious why it fails.
my logging creates a slow progress for panel.page.create too because the panel.page.update is called along with it. is writing the logfile taking to long? how are hooks triggered?
i am writing to different files for each hook so it should not be a locking issue there, right?
@bnomei: I don’t quite understand what you mean. When a page/user/file etc. is created, only the panel.xxx.create hook is triggered, not the update hook?
so now i have the following issue using autoid. autoid registers a panel.page.create hook. on create it will call $page->update() to write the autoid. so far so good.
but i also have a custom hook listening to panel.page.update. so this one gets triggered causing the slow progressbar. a basic hook like this works fine.
but once i use my plugin in fails. in all other cases it works just when create is causing an update.
kirby()->hook('panel.page.create', function($page) use ($plugin) { $plugin->log($page, 'panel.page.create'); });
so my guess is that my plugin fails to process the update because its still processing the create. a nested call of the same plugin. any ideas how to fix this?
i check revisions from @jenstornell again. he uses only static functions and no issue in combination with autoid. good job.
but i refuse the idea to make my plugin static since its not causing the loop. autoid form @helllicht is causing it. so i can create an github issue there (which would require them to go static) or i find a workaround myself.
any ideas how to track if my class is called nested?