We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am using the group field type in a few places and need to query based on a sub field in the group field. I used json syntax: https://statamic.dev/content-queries#json-where-clauses
But whenever I use it on windows it fails. I think this is due to the -> being an invalid set of characters in the filename.
->
Entry::query()->where('group_field->sub_field', 'test')->first()
[2024-08-20 05:12:20] local.ERROR: file_put_contents(D:\Herd\site\storage\framework/cache/data/stache/indexes/users/artist_info->old_id): Failed to open stream: No such file or directory {"exception":"[object] (ErrorException(code: 0): file_put_contents(D:\\Herd\\site\\storage\\framework/cache/data/stache/indexes/users/artist_info->old_id): Failed to open stream: No such file or directory at D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Filesystem\\Filesystem.php:204) [stacktrace] #0 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\HandleExceptions.php(256): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'file_put_conten...', 'D:\\\\Herd\\\\site...', 204) #1 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}(2, 'file_put_conten...', 'D:\\\\Herd\\\\site...', 204) #2 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Filesystem\\Filesystem.php(204): file_put_contents('D:\\\\Herd\\\\site...', '9999999999a:183...', 2) #3 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Cache\\FileStore.php(83): Illuminate\\Filesystem\\Filesystem->put('D:\\\\Herd\\\\site...', '9999999999a:183...', true) #4 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Cache\\FileStore.php(207): Illuminate\\Cache\\FileStore->put('stache::indexes...', Array, 0) #5 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Cache\\Repository.php(396): Illuminate\\Cache\\FileStore->forever('stache::indexes...', Array) #6 D:\\Herd\\site\\vendor\\statamic\\cms\\src\\Stache\\Indexes\\Index.php(113): Illuminate\\Cache\\Repository->forever('stache::indexes...', Array) #7 D:\\Herd\\site\\vendor\\statamic\\cms\\src\\Stache\\Indexes\\Index.php(101): Statamic\\Stache\\Indexes\\Index->cache() #8 D:\\Herd\\site\\vendor\\statamic\\cms\\src\\Stache\\Indexes\\Index.php(81): Statamic\\Stache\\Indexes\\Index->update() #9 D:\\Herd\\site\\vendor\\statamic\\cms\\src\\Stache\\Stores\\Store.php(47): Statamic\\Stache\\Indexes\\Index->load() #10 D:\\Herd\\site\\vendor\\statamic\\cms\\src\\Stache\\Query\\UserQueryBuilder.php(99): Statamic\\Stache\\Stores\\Store->index('artist_info->ol...') #11 D:\\Herd\\site\\vendor\\statamic\\cms\\src\\Stache\\Query\\UserQueryBuilder.php(89): Statamic\\Stache\\Query\\UserQueryBuilder->getKeysWithWhere(Array) #12 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Collections\\Traits\\EnumeratesValues.php(816): Statamic\\Stache\\Query\\UserQueryBuilder->Statamic\\Stache\\Query\\{closure}(Object(Illuminate\\Support\\Collection), Array, 1) #13 D:\\Herd\\site\\vendor\\statamic\\cms\\src\\Stache\\Query\\UserQueryBuilder.php(86): Illuminate\\Support\\Collection->reduce(Object(Closure)) #14 D:\\Herd\\site\\vendor\\statamic\\cms\\src\\Stache\\Query\\UserQueryBuilder.php(78): Statamic\\Stache\\Query\\UserQueryBuilder->getKeysWithWheres(Array) #15 D:\\Herd\\site\\vendor\\statamic\\cms\\src\\Stache\\Query\\Builder.php(27): Statamic\\Stache\\Query\\UserQueryBuilder->getFilteredKeys() #16 D:\\Herd\\site\\vendor\\statamic\\cms\\src\\Stache\\Query\\Builder.php(46): Statamic\\Stache\\Query\\Builder->resolveKeys() #17 D:\\Herd\\site\\vendor\\statamic\\cms\\src\\Query\\Concerns\\FakesQueries.php(18): Statamic\\Stache\\Query\\Builder->Statamic\\Stache\\Query\\{closure}() #18 D:\\Herd\\site\\vendor\\statamic\\cms\\src\\Stache\\Query\\Builder.php(45): Statamic\\Query\\Builder->withFakeQueryLogging(Object(Closure)) #19 D:\\Herd\\site\\vendor\\statamic\\cms\\src\\Query\\Builder.php(584): Statamic\\Stache\\Query\\Builder->Statamic\\Stache\\Query\\{closure}() #20 D:\\Herd\\site\\vendor\\statamic\\cms\\src\\Stache\\Query\\Builder.php(45): Statamic\\Query\\Builder->onceWithColumns(Array, Object(Closure)) #21 D:\\Herd\\site\\vendor\\statamic\\cms\\src\\Query\\Builder.php(539): Statamic\\Stache\\Query\\Builder->get() #22 D:\\Herd\\site\\app\\Console\\Commands\\ImportPortraits.php(147): Statamic\\Query\\Builder->first() #23 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Collections\\Traits\\EnumeratesValues.php(257): App\\Console\\Commands\\ImportPortraits->importPortrait(Object(stdClass), 0) #24 D:\\Herd\\site\\app\\Console\\Commands\\ImportPortraits.php(39): Illuminate\\Support\\LazyCollection->each(Object(Closure)) #25 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(36): App\\Console\\Commands\\ImportPortraits->handle() #26 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}() #27 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure)) #28 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure)) #29 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(690): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL) #30 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(213): Illuminate\\Container\\Container->call(Array) #31 D:\\Herd\\site\\vendor\\symfony\\console\\Command\\Command.php(279): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle)) #32 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(182): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle)) #33 D:\\Herd\\site\\vendor\\symfony\\console\\Application.php(1047): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #34 D:\\Herd\\site\\vendor\\symfony\\console\\Application.php(316): Symfony\\Component\\Console\\Application->doRunCommand(Object(App\\Console\\Commands\\ImportPortraits), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #35 D:\\Herd\\site\\vendor\\symfony\\console\\Application.php(167): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #36 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(197): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #37 D:\\Herd\\site\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(1203): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #38 D:\\Herd\\site\\artisan(13): Illuminate\\Foundation\\Application->handleCommand(Object(Symfony\\Component\\Console\\Input\\ArgvInput)) #39 {main} "}
Environment Application Name: Statamic Laravel Version: 11.20.0 PHP Version: 8.3.10 Composer Version: 2.7.7 Environment: local Debug Mode: ENABLED URL: site.test Maintenance Mode: OFF Timezone: UTC Locale: en Cache Config: NOT CACHED Events: NOT CACHED Routes: NOT CACHED Views: CACHED Drivers Broadcasting: log Cache: file Database: mysql Logs: stack / single Mail: log Queue: sync Session: file Statamic Addons: 5 Stache Watcher: Enabled Static Caching: Disabled Version: 5.22.1 PRO Statamic Addons jacksleight/statamic-bard-texstyle: 3.2.3 kolaente/statamic-snippet: 1.1.2 statamic-rad-pack/meilisearch: 3.3.0
Fresh statamic/statamic site via CLI
I was able to fix this by editing my cache index file - https://github.com/statamic/cms/blob/5.x/src/Stache/Indexes/Index.php#L136-L148
I changed it to look like so:
public function cacheKey() { $search = ['.', '/']; $replacements = ['::', '->']; if (windows_os()) { $replacements[1] = '-]'; $search[] = '->'; $replacements[] = '-]'; } return vsprintf('stache::indexes::%s::%s', [ $this->store->key(), str_replace($search, $replacements, $this->name), ]); }
This fixes the issue for me.
The text was updated successfully, but these errors were encountered:
Replacing -> in windows cache keys - Fixes statamic#10666
5cb1178
Successfully merging a pull request may close this issue.
Bug description
I am using the group field type in a few places and need to query based on a sub field in the group field. I used json syntax: https://statamic.dev/content-queries#json-where-clauses
But whenever I use it on windows it fails. I think this is due to the
->
being an invalid set of characters in the filename.How to reproduce
Logs
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
I was able to fix this by editing my cache index file - https://github.com/statamic/cms/blob/5.x/src/Stache/Indexes/Index.php#L136-L148
I changed it to look like so:
This fixes the issue for me.
The text was updated successfully, but these errors were encountered: