aks_cron
Cron inside Textpattern
Summary
Simple cron inside Textpattern. In cron job you may use any PHP code and call any TxP function inside Textpattern enviroment.
For sample: safe_update, safe_insert.
Now support only “Run Job Every”.
Installation
- Install this plugin.
- Go to Extension / aks_cron Tab
Admin interface

Changelog
Tags
Tags are not used.
Examples
Simple update one old post. PHP code in cron job:
$rs=safe_update("textpattern", "LastMod=now()", "status=4 and section='section1' ORDER BY LastMod, rand() limit 1");
if($rs){ return "OK"; }else{return "FALLED";}
Optimize all TxP tables:
$rs = safe_query("SHOW TABLES LIKE '".PFX."%'");
$table_names=array(); while ($row = mysql_fetch_row($rs)){ $table_names[] = $row[0]; }
$qq=join(",", $table_names);
$rs=safe_query("OPTIMIZE TABLE $qq");
if($rs){ return "OK"; }else{return "FALLED";}
Delete old TxP log entries:
// 2010-07-21T07:45:43+0000 delete old TxP log entries
global $prefs;
if($prefs['expire_logs_after']>0){ safe_delete("txp_log","TO_DAYS(NOW()) - TO_DAYS(time) >".$prefs['expire_logs_after']); }
return "OK";