Marketplace Linter Fails "file_system_test"
Permalink
Hello Im trying to use the marketplace Linter to test my addon - and so far i've managed to troubleshoot most the minor errors.
Unfortunately there is one error that is escaping me.
The Linter says my package is failing the "file_system_test" due to this line in my package:
My questions is what is the "file_system_test" and why is that line a problem? Is there a more 'Concrete' way of writing that line?
I've attached a screenshot to help.
Unfortunately there is one error that is escaping me.
The Linter says my package is failing the "file_system_test" due to this line in my package:
file_put_contents($filePath, $content)
My questions is what is the "file_system_test" and why is that line a problem? Is there a more 'Concrete' way of writing that line?
I've attached a screenshot to help.
OK thank you for the quick reply!
Im still a bit confused though, im using that function above to basically PUT content back into a files (think theme files). I don't see this functionality supported in the File Helper API,
i see methods of directory retrieval and file extension manipulation but im looking for something similar to:
except instead of 'getContents' i'm need something like 'putContents()' if that makes sense..
Edit: i think i found my solution in using:
Im still a bit confused though, im using that function above to basically PUT content back into a files (think theme files). I don't see this functionality supported in the File Helper API,
i see methods of directory retrieval and file extension manipulation but im looking for something similar to:
$service->getContents($filePath, $contents);
except instead of 'getContents' i'm need something like 'putContents()' if that makes sense..
Edit: i think i found my solution in using:
$service->clear($filePath) && $service->append($filePath, $content);
Another option at this point is to use one of the core filesystem dependencies, the illuminate one is best for local file modifications.
$filesystem = new \Illuminate\Filesystem\Filesystem(); $filesystem->put($path, $contents);
Thanks, this worked beautifully! i replaced my previous workaround with this one now instead But im not really familiar with Core dependencies or with Illuminate for that matter, is there any documentation or can you expound on exactly what i'm using here?
@Korvin
Are you able to use the other Filesystem methods this way?
https://laravel.com/api/master/Illuminate/Filesystem/Filesystem.html...
Are you able to use the other Filesystem methods this way?
https://laravel.com/api/master/Illuminate/Filesystem/Filesystem.html...
https://www.concrete5.org/documentation/developers/5.6/files/helpers...
https://www.concrete5.org/documentation/developers/5.7/working-with-...
There are a range of php functions that are not allowed, either for security or portability (where the core provides interfaces that you should use instead). @goutnet has posted a howto listing them for pre c5.7 and the c5.7+ restrictions are very similar.
https://www.concrete5.org/documentation/how-tos/developers/forbidden...
Occasionally we will grant exceptions to the linter tests, for example, where a 3rd party library does stuff inside.