-
-
Notifications
You must be signed in to change notification settings - Fork 601
[6.x] Support storing meta data as content #11998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 6.x
Are you sure you want to change the base?
[6.x] Support storing meta data as content #11998
Conversation
|
I might need some help fixing these tests; they are working on my Windows machine. It might be a UNIX path issue? |
|
No problem, we'll handle them. 👍 Thanks for the PR |
|
@godismyjudge95 its because line 326 (metaPath) has a ltrim() - it seems to be trying to make the path relative. Updating the function to something like this seems to ensure the tests pass: public function metaPath()
{
if (config('statamic.assets.meta_as_content')) {
return implode('/', [
Stache::store('assets')->directory(),
$this->container()->handle(),
dirname($this->path()),
$this->basename() . '.yaml',
]);
}
$path = implode('/', [
dirname($this->path()),
'.meta',
$this->basename().'.yaml',
]);
return Str::of($path)->replaceFirst('./', '')->ltrim('/')->value();
} |
|
What are the chances that this PR finds its way into v6 alpha/beta? 👀 |
This PR has the potential to resolve a lot of issues people have with remote storage of assets.
Related issues:
There are also a lot of Discord discussions about S3 storage being slow. These almost all are resolved by moving the meta data to local storage through the eloquent driver.
The problem with both S3 and eloquent driver storage of meta data is that you lose one of the key features of Statamic - flat file git tracking. This means that if the focal point, custom fields, or other meta data is changed it is not tracked via git.
This PR provides the option to store the asset meta data as content - in the content directory and thus available to be tracked/synced by git.
--
I only provided two tests atm because I am not sure how deeply this needs to be tested as it just changes the paths where things are stored. Let me know if there are other points I need to test at and I will add them.
Also, I could foresee people requesting a command to migrate the asset meta from the standard storage mechanism and back.
Maybe in the future this feature gets turned on by default? 😄