OblikStudio / kirby-git

Kirby plugin for updating content in the panel via Git
MIT License
84 stars 6 forks source link

oblik.git.repo produces fatal error #31

Closed movingwater closed 1 year ago

movingwater commented 1 year ago

When I customize the repo path it gives me fatal error: Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 12288 bytes) in .../kirby/src/Cms/Core.php on line 348 I just want to only use the content's git repo. So I changed it to 'repo' => kirby()->roots()->content() The content folder is excluded in the main repo and is a separate repo for its own. I use php 8.1.8 and git 2.37.1.

With the default value as repo it works great.

hdodov commented 1 year ago

My guess is that using kirby()->roots()->content() in your config file causes some kind of endless loop, since returning the roots requires Kirby to be initialized, which in turn depends on the config file that tried to get the roots in the first place.

Could you try to hard-code the return value of kirby()->roots()->content() and see if that works? Something like 'repo' => '/absolute/path/to/content/folder'.

movingwater commented 1 year ago

You are right... calling kirby() in the config file is the problem. Is it possible to have a dynamic path? With the hardcoded path it works fine.

movingwater commented 1 year ago

So this is a kirby issue and not the plugins fault...

hdodov commented 1 year ago

Yeah, I've dealt with this issue many times. You could try out the ready option and provide the setting only after Kirby has initialized. Something like this:

return [
    'ready' => function () {
        return [
            'oblik.git' => [
                'repo' => kirby()->roots()->content()
            ]
        ];
    }
];