How do I clear output cache in Pimcore programmatically? - pimcore

Note that this is not disable output cache which only disable for certain request, as what the documentation specified.

Pimcore provide a cli script to clear the cache
php pimcore/cli/console.php cache:clear
You can run the same command programmatically in any of the php file with exec() function

Found this in Pimcore 4 source code in pimcore/models/Object/ClassDefinition.php
// empty output cache
try {
Cache::clearTag("output");
} catch (\Exception $e) {
} ?>
Although I don't really agree on how this works (they did not specify that "output" is a reserved keyword for cache tags).

Please use this command your project root
php bin/console cache:clear
php bin/console pimcore:cache:clear

Related

How can I execute only one Maintenance task in Pimcore? (not all)

I created maintenance job SomeNameDoerTask in Pimcore 10.
But when I try to execute it,
bin/console pimcore:maintenance --async
bin/console messenger:consume pimcore_core pimcore_maintenance pimcore_image_optimize --time-limit=300
it is that deep in the queue so I can't see it called.
How to execute it explicitely?
Pimcore gives us an ability to run only 1 job:
bin/console pimcore:maintenance --force --job=SomeNameDoer --async
where the name SomeNameDoer type from tags from Resources/config/maintenance.yml
Was you ever wandering why constructor was called but execute() method was not? Check that you use tag type, not class name.
If you need xDebug it, disable asynchronous run and enable verbosity:
bin/console pimcore:maintenance --force --job=SomeNameDoer -vvv
To see all available options and MaintenanceTasks:
bin/console pimcore:maintenance --help
For example,
--env=ENV
allows you to emulate PROD environment.
Please see that pimcore allows to exclude some job when running all others:
bin/console pimcore:maintenance --excludedJobs=SomeNameDoerTask,ImportTask,CleanupTask

Laravel php artisan queue work and stop if jobs are empty

How to execute php artisan queue:work --stop-when-empty inside controller i tried to call it inside php artisan like below
$execute = artisan::call('php artisan queue:work --stop-when-empty');
But nothing happened, can you kindly help
\Artisan::call('queue:work --stop-when-empty');
It can be called anywhere in the Class. Like if you want to start the queue working and want it would stop whenever the queue's empty then you can use this. I would prefer you to use the queue: work in scheduler instead of calling directly. Like this.
protected function schedule(Schedule $schedule)
{
$schedule->command('queue:work --stop-when-empty')->everyMinute();
}

Desired State Configuration Verbose Logging

When attempting to debug issues with Desired State Configuration, I've found the following command invaluable;
start-dscconfiguration -wait -verbose -useexisting
This will (obviously) allow viewing of all the verbose logs.
The problem is that if the server needs to reboot as part of the configuration, or - more importantly - it's running normally (e.g. non-interactively as part of a pull configuration) it's not as easy to view these logs.
Is there any way to get the /exact/ same output logged to a specific location?
I do not have any .json files in the C:\Windows\system32\configuration\configurationstatus folder as suggested in one of the answers?
Set RebootNodeIfNeeded to false in meta configuration:
[DscLocalConfigurationManager()]
configuration Settings
{
Settings
{
ActionAfterReboot = 'StopConfiguration'
RebootNodeIfNeeded = $false
}
}
And run the existing configuration again:
Start-DscConfiguration -Wait -UseExisting -Verbose
(Adding this for posterity as other answers only contain links.)
Source: http://nanalakshmanan.com/blog/DSC-get-job-details-post-reboot/
You can follow the steps outlined in this blog to get the results post a reboot http://nanalakshmanan.com/blog/DSC-get-job-details-post-reboot/
You can also view the historical job logs as described in this blog http://nanalakshmanan.com/blog/Historical-Job-Logs/

Location / path of phpunit.xml

Where the phpunit.xml configuration file of PHPUNIT test framework is located on linux server, please?
I can't google this information anywhere..
let's assume you use ubuntu, but this should not change much:
you can put it anywhere you want and use the following switch to use 'your' config:
--configuration <file>
Read configuration from XML file.
see: http://manpages.ubuntu.com/manpages/raring/en/man1/phpunit.1.html

How can I set the php CLI version for Symfony2 without changing the code?

My setup
shared hosting
no root access
shell access
symfony 2.1
capifony for deployment (well, at least, that's the plan)
build_bootstrap.php uses
#!/usr/bin/env php
This is linked to the php4 cli in
/usr/local/bin/php
PHP4 does of course not work. The php 5.3 cli is in
/usr/local/bin/php53
Is there a central place to tell Symfony 2.1 to change the env? Something with putenv? Export path in bash config files?
Update:
I am now using an alias for php in my bashrc as #thecatontheflat suggested.
Unfortunately Symfony brings its own logic where to look for the php binaries.
One option is to set PHP_PATH via putenv.
I added it both to app/console and app/autoload.php as both files are involved in the Capifony tasks
Solution:
add two settings to .bashrc/.bash_profile
alias php="/usr/local/bin/php53"
export PHP_PATH = "/usr/local/bin/php53"
and also set php_bin in Capifony's deploy.rb
set :php_bin, " /usr/local/bin/php53"

Resources