Hooks Cleanup Script
The Hooks cleanup script will loop through all configs provided (passed in as 'dbs') and check every centre's assets/hooks path. Any files or directories that are found here which exceed the "days" parameter will be removed.
The asset path checked is constructed from inc.Settings; $settings→_AssetsPath / centreDirName / assets / hooks
You can invoke the script as follows:
php coredna_engine/coreDNA11/cron/cron_hooks_cleanup.php --db randys,cougar --days 35 |
Arguments:
- --db: comma-separated list of configs to check, the code will change database and check every centre here
- --days: age limit for files & directories, if they exceed this number they will be removed.
The script will output in the terminal and (if configured) via Slack webhook
Example Output
Hooks Cleanup ScriptThe following batches have been attempted to be removed on: 2021-04-15 14:17:38Databases: randys, cougarBatches Dirs checked if they are over 1 days oldTotal Batches Found: 141Batch Delete Success: 141Batch Delete Error: 0(!) Errors:• This asset path does not exist: "/var/virtual/assets/randys/randysworldwidecom-stage/assets/hooks", skipping• This asset path does not exist: "/var/virtual/assets/randys/mediacenterrandysworldwidecom/assets/hooks", skipping• This asset path does not exist: "/var/virtual/assets/randys/mediacenterrandysworldwidecom-stage/assets/hooks", skipping• This asset path does not exist: "/var/virtual/assets/randys/usastandardgearcom/assets/hooks", skipping• This asset path does not exist: "/var/virtual/assets/randys/usastandardgearcom-stage/assets/hooks", skipping• This asset path does not exist: "/var/virtual/assets/randys/yukongearcom/assets/hooks", skippingResults:• (✓) Batch 'randys/randysworldwidecom/assets/hooks/06a01f24' Delete Successful• (✓) Batch 'randys/randysworldwidecom/assets/hooks/11f27c14' Delete Successful• (✓) Batch 'randys/randysworldwidecom/assets/hooks/26442fdf' Delete Successful• (✓) Batch 'randys/randysworldwidecom/assets/hooks/274bb8cd' Delete Successful• (✓) Batch 'randys/randysworldwidecom/assets/hooks/274caf45' Delete Successful• (✓) Batch 'randys/randysworldwidecom/assets/hooks/298de4e1' Delete Successful• (✓) Batch 'randys/randysworldwidecom/assets/hooks/2a4ab792' Delete Successful• (✓) Batch 'randys/randysworldwidecom/assets/hooks/2aa43aeb' Delete Successful• (✓) Batch 'randys/randysworldwidecom/assets/hooks/43b799c7' Delete Successful• (✓) Batch 'randys/randysworldwidecom/assets/hooks/48a5bc79' Delete Successful• (✓) Batch 'randys/randysworldwidecom/assets/hooks/4b3bc4c5' Delete Successful• (✓) Batch 'randys/randysworldwidecom/assets/hooks/5104f47d' Delete Successful• (✓) Batch 'randys/randysworldwidecom/assets/hooks/5a523999' Delete Successful• (✓) Batch 'randys/randysworldwidecom/assets/hooks/7c8ad295' Delete Successful• (✓) Batch 'randys/randysworldwidecom/assets/hooks/85124fd5' Delete Successful... |