// End foreach.
            unset($item);
            unset($item_name);
        }
        // End foreach.
        unset($event);
        unset($hook_name);
    }
    // End if is_numeric.
}
// End foreach.
unset($cron_item);
unset($time);
// Cleanup any old notifications.
$notifications = backupbuddy_core::getNotifications();
// Load notifications.
$updateNotifications = false;
$maxTimeDiff = pb_backupbuddy::$options['max_notifications_age_days'] * 24 * 60 * 60;
foreach ($notifications as $i => $notification) {
    if (time() - $notification['time'] > $maxTimeDiff) {
        unset($notifications[$i]);
        $updateNotifications = true;
    }
}
if (true === $updateNotifications) {
    pb_backupbuddy::status('details', 'Periodic cleanup: Replacing notifications.');
    backupbuddy_core::replaceNotifications($notifications);
}
@clearstatcache();
// Clears file info stat cache.
pb_backupbuddy::status('message', 'Finished cleanup procedure.');
Esempio n. 2
0
function backupbuddy_sync_add_notices($arguments, $urgent = false)
{
    require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
    $notifications = backupbuddy_core::getNotifications();
    foreach ($notifications as &$notification) {
        // Skip if in the inapplicable mode.
        if (false === $urgent && true === $notification['urgent']) {
            // If NOT seeking urgents, skip urgents.
            continue;
        }
        if (true === $urgent && false === $notification['urgent']) {
            // If seeking urgents, skip non-urgents.
            continue;
        }
        if (true === $notification['syncSent']) {
            // Only send once.
            continue;
        }
        $notification['syncSent'] = true;
        // Compile data.
        //$data = array();
        $data = $notification['data'];
        /*
        if ( ! empty( $arguments['verbose'] ) ) { // The verbose argument can be checked for in order to provide additional information that may not always be necessary.
        	$data = $notification['data'];
        }
        */
        // Send notice.
        if (false === $urgent) {
            ithemes_sync_add_notice('backupbuddy', $notification['slug'], $notification['title'], $notification['message'], $data);
        } elseif (true === $urgent) {
            ithemes_sync_send_urgent_notice('backupbuddy', $notification['slug'], $notification['title'], $notification['message'], $data);
        }
    }
    backupbuddy_core::replaceNotifications($notifications);
    // Save with syncSent updates for all notifications.
    return true;
}
Esempio n. 3
0
function backupbuddy_sync_add_notices($arguments, $urgent = false)
{
    require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
    $notifications = backupbuddy_core::getNotifications();
    foreach ($notifications as &$notification) {
        // Skip if in the inapplicable mode.
        if (false === $urgent && true === $notification['urgent']) {
            // If NOT seeking urgents, skip urgents.
            continue;
        }
        if (true === $urgent && false === $notification['urgent']) {
            // If seeking urgents, skip non-urgents.
            continue;
        }
        if (true === $notification['syncSent']) {
            // Only send once.
            continue;
        }
        $notification['syncSent'] = true;
        $notification['data']['datestamp'] = date('Y-m-d', $notification['time']);
        // Added v6.3.3.10.
        // Send notice.
        if (false === $urgent) {
            ithemes_sync_add_notice('backupbuddy', $notification['slug'], $notification['title'], $notification['message'], $notification['data']);
        } elseif (true === $urgent) {
            ithemes_sync_send_urgent_notice('backupbuddy', $notification['slug'], $notification['title'], $notification['message'], $notification['data']);
        }
    }
    backupbuddy_core::replaceNotifications($notifications);
    // Save with syncSent updates for all notifications.
    return true;
}
Esempio n. 4
0
 public static function trim_old_notifications()
 {
     $notifications = backupbuddy_core::getNotifications();
     // Load notifications.
     $updateNotifications = false;
     $maxTimeDiff = pb_backupbuddy::$options['max_notifications_age_days'] * 24 * 60 * 60;
     foreach ($notifications as $i => $notification) {
         if (time() - $notification['time'] > $maxTimeDiff) {
             unset($notifications[$i]);
             $updateNotifications = true;
         }
     }
     if (true === $updateNotifications) {
         pb_backupbuddy::status('details', 'Periodic cleanup: Replacing notifications.');
         backupbuddy_core::replaceNotifications($notifications);
     }
 }