Symlinked content directory can't modify drafts

Hi everyone

I recently moved some directories out of content and symlinked them from within the Kirby content (to make deployments easier). Everything works fine (displaying, adding drafts, panel etc) until I need to publish a draft. The panel says it can’t be moved, but if I close the modal and check the site the draft is actually published.

I checked directory permissions, symlink ownership, everything looks ok. I’m not sure what’s tripping the panel error despite the fact the operation is successful.

Hm, I don’t know, but instead of symlinking the content folder you could use a custom folder setup which would probably solve this issue?

Thanks. The tricky issue is that some of the directories under content need to stay in git to track changes, while others (purely image based content) don’t need to be tracked

So your content folder is not a repo on its own?

No, it’s part of the same repo. Some directories under /content are actual directories tracked in git, the rest are just symlinked outside. You can see the structure on github if you like

Does the console maybe provide any more hints?

Not much more, the request returns 400 with the same error message

How do you deploy? This is partly why im a big of rSync because it allows me to exclude certain folders from being pushed to live. So i use Git locally on eveything, but deploy via rSync and exclude certain folder where i need.

Are you doing this on a mac or Linux? I dont think ive ever done with with content folders, but i often symlink my own plugins in on a mac without issue.

And this only happens in the symlinked folders not in not-symlinked ones? Does this happen on a remote server or in your local dev environment?

Mac in dev and Linux in production. Usually I just ssh and git pull (+ composer install when required). Then I got tired of git complaining that the merge would conflict with existing “changes” even though those directories are just static content like images, nothing that really needs to be in git.

I guess I can just put back the directory in git and add it to .gitignore but now I’m really curious to know why this isn’t working :stuck_out_tongue:

I work locally, under git and push to a remote as a backup (Github or BitBucket). rSync works in both directions, so i just commit locally, trash my local content folder (if i know the client has made changes on live), then rSync down from live to bring mine up to date. Then i just push back up with rSync when ive done whatever tweak they wanted.

You can feed rSync a txt file with an exclude list in it which works basically the same as gitignore. Its recursive too, so if you just toss .DS_Store on a line in there, it will exclude those files where ever they are in the folder tree. Its pretty neat. You can do it with folder names too.

It’s happening on my live server and in my dev environment, but only the symlinked directories. The odd thing is that the operation actually succeeds, just that the panel says it doesn’t.

Don’t really know what to make of it. I’ll see if I get to try it out in my dev env later.

I was trying to revert my changes back to using directories instead of symlinks and now it happens in the directories too, but only some of them. This is really strange.

Now none of my content subdirectories are symlinks anymore, but some of them I’m able to move drafts between listed/unlisted with no problem, the other ones give an error.

I compared filesystem permissions between both directories and they’re the same. I even chmod 777 on the problematic ones to check but the problem persists.

I should mention I’m running Kirby 3.3.5, not sure if that’s relevant.

What’s the recommended umask to use with content folders? is there a panel cache I can clear or something? :confused:

UPDATE: I’ve traced the issue down to the face that php rename here is returning true, and for some reason this always evaluates it to false. I’m not sure why this is happening, it’s quite strange

UPDATE 2: It seems to be related to the size of the directory. This particularly problematic content directory has about 550 subdirectories (page entries). In a test, I moved everything out and kept only a handful of directories and now the problem disappears

Hm, maybe you are running into a script runtime error here? What’s your max_execution_time set to?

It was set to 30, I set it to 60 and doubled the memory_limit too, but no effect

Does it work with subdirectories of the same size that are not symlinked? I think the real question here is if it is a problem with the symlinks or with the size of your directories in general. Do these folders contain just text files or also images?

This same directory used to work fine when it wasn’t symlinked, no issues.
Then I had the bright idea of making it a symlink for git reasons, it broke.
So I reverted that change, put everything back as a real subdirectory (thinking the symlink was the issue) but that big subdirectory still has the same issue. The other subdirectories have no problems.

So confusing :confused:

Ok, finally found the issue !

A bunch of subdirectories somehow ended up with the same prefix, for example I had two starting with 355_. Not sure how this happened, maybe corruption because of the big filesystem move ? In any case, I fixed all the sequences and now the problem is gone. Phew !

Thanks for all the help