diff --git a/module/action/control.php b/module/action/control.php index 08dc85bf7a..4690757eac 100755 --- a/module/action/control.php +++ b/module/action/control.php @@ -453,4 +453,15 @@ class action extends control return true; } + + /** + * Clear dynamic records older than one month. + * + * @access public + * @return void + */ + public function cleanActions() + { + $this->action->cleanActions(); + } } diff --git a/module/action/model.php b/module/action/model.php index 2c1e099cd2..89b4c07bf4 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -2394,4 +2394,17 @@ class actionModel extends model $this->create($deletedAction->objectType, $deletedAction->objectID, 'undeleted'); } } + + /** + * Clear dynamic records older than one month. + * + * @access public + * @return void + */ + public function cleanActions() + { + $lastMonth = date('Y-m-d', strtotime('-1 month')); + $this->dao->delete()->from(TABLE_ACTIONLATEST)->where('date')->lt($lastMonth)->exec(); + return !dao::isError(); + } }