Skip to content

Commit

Permalink
[jan] Purge old tasks from versions < 2.3 too.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Apr 3, 2014
1 parent cc23669 commit b28da4f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions nag/docs/CHANGES
Expand Up @@ -2,6 +2,7 @@
v4.2.0-git
----------

[jan] Purge old tasks from versions < 2.3 too.
[jan] Allow to synchronize shared task lists via CalDAV (Request #12380).
[jan] Add script to import tasks from Open-Xchange.
[jan] Add recurrence controls to basic view (Request #11545).
Expand Down
10 changes: 5 additions & 5 deletions nag/lib/LoginTasks/Task/PurgeCompleted.php
Expand Up @@ -38,21 +38,21 @@ public function execute()
global $injector, $prefs;

/* Get the current UNIX timestamp minus the number of days specified
* in 'purge_completed_keep'. If a message has a timestamp prior to
* in 'purge_completed_keep'. If a task has a timestamp prior to
* this value, it will be deleted. */
$del_time = new Horde_Date(time() - ($prefs->getValue('purge_completed_keep') * 86400));
$del_time = new Horde_Date($_SERVER['REQUEST_TIME'] - ($prefs->getValue('purge_completed_keep') * 86400));
$del_time = $del_time->timestamp();
$tasklists = Nag::listTasklists(true, Horde_Perms::DELETE, false);
$tasks = Nag::listTasks(array(
'completed' => Nag::VIEW_COMPLETE,
'tasklists' => array_keys($tasklists),
'include_history' => false)
'tasklists' => array_keys($tasklists))
);
$factory = $GLOBALS['injector']->getInstance('Nag_Factory_Driver');
$count = 0;
$tasks->reset();
while ($task = $tasks->each()) {
if (($task->completed_date) && $task->completed_date < $del_time) {
if (($task->completed_date && $task->completed_date < $del_time) ||
(!$task->completed_date && $task->modified && $task->modified->timestamp() < $del_time)) {
try {
$factory->create($task->tasklist)->delete($task->id);
++$count;
Expand Down
6 changes: 4 additions & 2 deletions nag/package.xml
Expand Up @@ -22,7 +22,7 @@
<email>mrubinsk@horde.org</email>
<active>yes</active>
</lead>
<date>2014-03-20</date>
<date>2014-04-02</date>
<version>
<release>4.2.0</release>
<api>4.2.0</api>
Expand All @@ -33,6 +33,7 @@
</stability>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
* [jan] Purge old tasks from versions &lt; 2.3 too.
* [jan] Allow to synchronize shared task lists via CalDAV (Request #12380).
* [jan] Add script to import tasks from Open-Xchange.
* [jan] Add recurrence controls to basic view (Request #11545).
Expand Down Expand Up @@ -1477,9 +1478,10 @@
<stability>
<release>stable</release>
<api>stable</api></stability>
<date>2014-03-20</date>
<date>2014-04-02</date>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
* [jan] Purge old tasks from versions &lt; 2.3 too.
* [jan] Allow to synchronize shared task lists via CalDAV (Request #12380).
* [jan] Add script to import tasks from Open-Xchange.
* [jan] Add recurrence controls to basic view (Request #11545).
Expand Down

0 comments on commit b28da4f

Please sign in to comment.