Jump to content

Edit History

Andrei H

Andrei H

Hello,

You have a couple of options to achieve what you want.

The easiest one is to create a file, script.php (the name does not matter), inside the PrestaShop root. Its content should be:

<?php

require dirname(__FILE__) . '/config/config.inc.php';

Db::getInstance()->execute('TRUNCATE ps_test1');
Db::getInstance()->execute('TRUNCATE ps_test2');

Then you can add it to the existing cronjobs (e.g.: * * * * * php <full_path_to_prestashop_root>/script.php). This should work as expected.

The other option would be to create a custom module that can:

1. Use the actionAdminControllerSetMedia hook, so it gets called each time you access an admin page

2. Create a Symfony Command that you can use in your cronjobs

If you want, I can provide some code for this option as well.

Andrei H

Andrei H

Hello,

You have a couple of options to achieve what you want.

The easiest one is to create a file, script.php (the name does not matter), inside the PrestaShop root. Its content should be:

<?php

require dirname(__FILE__) . '/config/config.inc.php';

Db::getInstance()->execute('TRUNCATE ps_test1');
Db::getInstance()->execute('TRUNCATE ps_test2');

Then you can add it to the existing cronjobs (e.g.: * * * * * php <full_path_to_prestashop_root>/script.php). This should work as expected.

The other option would be to create a custom module that can:

1. Use the actionAdminControllerSetMedia hook, so it gets called each time you access an admin page

2. Create a Symfony Command that you can use in your cronjobs

If you want, I can provide some code for this option, as well.

×
×
  • Create New...