public static function getInstance()
 {
     if (!isset(self::$_singleton)) {
         self::$_singleton = new self();
     }
     return self::$_singleton;
 }
 /**
  *
  */
 function clearReminder($dont_check = false)
 {
     $ev = new EventQueue();
     $event_list = $ev->find('tasks', 'remind', $this->task_id);
     if (count($event_list)) {
         foreach ($event_list as $id => $data) {
             if ($dont_check || $this->task_percent_complete >= 100) {
                 $ev->remove($id);
             }
         }
     }
 }
Example #3
0
 /**
  * Queue mail to allow the queue manager to trigger
  * the email transfer.
  *
  * @access private
  */
 function QueueMail()
 {
     global $AppUI;
     require_once $AppUI->getSystemClass('event_queue');
     $ec = new EventQueue();
     $vars = get_object_vars($this);
     return $ec->add(array('Mail', 'SendQueuedMail'), $vars, 'libmail', TRUE);
 }
function dPsessionGC($maxlifetime)
{
    global $dPconfig;
    global $AppUI;
    dprint(__FILE__, __LINE__, 11, "Session Garbage collection running");
    $now = time();
    $max = dPsessionConvertTime('max_lifetime');
    $idle = dPsessionConvertTime('idle_time');
    // Find all the session
    $q = new DBQuery();
    $q->setDelete('sessions');
    $q->addWhere("UNIX_TIMESTAMP() - UNIX_TIMESTAMP(session_updated) > {$idle} OR UNIX_TIMESTAMP() - UNIX_TIMESTAMP(session_created) > {$max}");
    $q->exec();
    $q->clear();
    if (isset($dPconfig['session_gc_scan_queue']) && $dPconfig['session_gc_scan_queue']) {
        // We need to scan the event queue.  If $AppUI isn't created yet
        // And it isn't likely that it will be, we create it and run the
        // queue scanner.
        if (!isset($AppUI)) {
            $AppUI = new CAppUI();
            $queue = new EventQueue();
            $queue->scan();
        }
    }
    return true;
}
Example #5
0
<?php

// Function to scan the event queue and execute any functions required.
require_once 'base.php';
require_once W2P_BASE_DIR . '/includes/config.php';
require_once W2P_BASE_DIR . '/includes/main_functions.php';
require_once W2P_BASE_DIR . '/includes/db_adodb.php';
require_once W2P_BASE_DIR . '/classes/ui.class.php';
require_once W2P_BASE_DIR . '/classes/event_queue.class.php';
require_once W2P_BASE_DIR . '/classes/query.class.php';
$AppUI = new CAppUI();
$AppUI->setUserLocale();
$queue = new EventQueue();
$queue->scan();
/*
 This is the first piece of a simple hook system to allow for regularly 
 scheduled maintenance tasks to occur.  This could be data validation and 
 cleanup, sending email notifications, or workflow related tasks.
 
 The model for this functionality was based on Drupal's methods for laying 
 out and interacting with hooks.  It should not be considered complete at 
 this time.
*/
$moduleList = $AppUI->getLoadableModuleList();
foreach ($moduleList as $module) {
    $object = new $module['mod_main_class']();
    if (is_callable(array($object, 'hook_cron'))) {
        $object->hook_cron();
    }
}
Example #6
0
function dPsessionGC($maxlifetime)
{
    global $AppUI;
    dprint(__FILE__, __LINE__, 11, 'Session Garbage collection running');
    $now = time();
    $max = dPsessionConvertTime('max_lifetime');
    $idle = dPsessionConvertTime('idle_time');
    // First pass is to kill any users that are logged in at the time of the session.
    $where = 'UNIX_TIMESTAMP() - UNIX_TIMESTAMP(session_updated) > ' . $idle . ' OR UNIX_TIMESTAMP() - UNIX_TIMESTAMP(session_created) > ' . $max;
    $q = new DBQuery();
    $q->addTable('sessions');
    $q->addQuery('session_user');
    $q->addWhere($where);
    $sql2 = $q->prepare(true);
    $q->addTable('user_access_log');
    $q->addUpdate('date_time_out', date('Y-m-d H:i:s'));
    $q->addWhere('user_access_log_id IN (' . $sql2 . ')');
    $q->exec();
    $q->clear();
    // Now we simply delete the expired sessions.
    $q->setDelete('sessions');
    $q->addWhere($where);
    $q->exec();
    $q->clear();
    if (dPgetConfig('session_gc_scan_queue')) {
        // We need to scan the event queue.  If $AppUI isn't created yet
        // And it isn't likely that it will be, we create it and run the
        // queue scanner.
        if (!isset($AppUI)) {
            $AppUI = new CAppUI();
            $queue = new EventQueue();
            $queue->scan();
        }
    }
    return true;
}
Example #7
0
 /**
  *  Queue mail to allow the queue manager to trigger
  *  the email transfer.
  *  
  *  @access private
  */
 function QueueMail()
 {
     global $AppUI;
     require_once $AppUI->getSystemClass('event_queue');
     $ec = EventQueue::getInstance();
     $vars = get_object_vars($this);
     return $ec->add($this, $vars, 'SendQueuedMail');
 }
Example #8
0
The full text of the GPL is in the COPYING file.
*/
// Function to scan the event queue and execute any functions required.
require_once 'base.php';
require_once DP_BASE_DIR . '/includes/config.php';
require_once DP_BASE_DIR . '/includes/main_functions.php';
require_once DP_BASE_DIR . '/includes/db_connect.php';
require_once DP_BASE_DIR . '/classes/ui.class.php';
require_once DP_BASE_DIR . '/classes/event_queue.class.php';
require_once DP_BASE_DIR . '/classes/query.class.php';
$AppUI = new CAppUI();
$AppUI->setUserLocale();
$perms =& $AppUI->acl();
echo "Scanning Queue ...\n";
$queue = EventQueue::getInstance();
# Determine if we are called from the command line or from a web page,
# In either case we may have an argument telling us if we are scanning
# the batch or the immediate queue.  If no argument, scan everything.
$batch = null;
if (isset($_REQUEST['batch'])) {
    $batch = strtolower($_REQUEST['batch']);
} else {
    if (isset($argv) && !empty($argv[1])) {
        $batch = strtolower($argv[1]);
    }
}
if (!empty($batch)) {
    if (is_numeric($batch)) {
        $batch = intval($batch);
        if ($batch[0] == 'y' || $batch[0] == 't') {
Example #9
0
 /**
  * Queue mail to allow the queue manager to trigger
  * the email transfer.
  *
  * @access private
  */
 public function QueueMail()
 {
     global $AppUI;
     $ec = new EventQueue();
     $vars = get_object_vars($this);
     return $ec->add(array('Mail', 'SendQueuedMail'), $vars, 'libmail', true);
 }