Esempio n. 1
0
function run()
{
    $default = TasksHolder::$tasks['default'];
    $scheduler = new Scheduler();
    $scheduler->newTask($default);
    $scheduler->run();
}
function addAODSchedulers()
{
    require_once 'modules/Schedulers/Scheduler.php';
    $scheduler = new Scheduler();
    $scheduler->retrieve_by_string_fields(array('job' => 'function::aodIndexUnindexed'));
    if ($scheduler->id == '') {
        $scheduler->name = "Perform Lucene Index";
        $scheduler->date_time_start = "2005-01-01 11:15:00";
        $scheduler->date_time_end = null;
        $scheduler->job_interval = "0::0::*::*::*";
        $scheduler->job = "function::aodIndexUnindexed";
        $scheduler->status = "Active";
        $scheduler->catch_up = 1;
        $scheduler->save();
    }
    $scheduler = new Scheduler();
    $scheduler->retrieve_by_string_fields(array('job' => 'function::aodOptimiseIndex'));
    if ($scheduler->id == '') {
        $scheduler->name = "Optimise AOD Index";
        $scheduler->date_time_start = "2005-01-01 11:15:00";
        $scheduler->date_time_end = null;
        $scheduler->job_interval = "0::*/3::*::*::*";
        $scheduler->job = "function::aodOptimiseIndex";
        $scheduler->status = "Active";
        $scheduler->catch_up = 1;
        $scheduler->save();
    }
}
function addAODSchedulers()
{
    require_once 'modules/Schedulers/Scheduler.php';
    $scheduler = new Scheduler();
    if (!count($scheduler->get_full_list('', 'job = "function::aodIndexUnindexed"'))) {
        $scheduler->name = "Perform Lucene Index";
        $scheduler->date_time_start = "2005-01-01 11:15:00";
        $scheduler->date_time_end = null;
        $scheduler->job_interval = "0::0::*::*::*";
        $scheduler->job = "function::aodIndexUnindexed";
        $scheduler->status = "Active";
        $scheduler->catch_up = 1;
        $scheduler->save();
    }
    $scheduler = new Scheduler();
    if (!count($scheduler->get_full_list('', 'job = "function::aodOptimiseIndex"'))) {
        $scheduler->name = "Optimise AOD Index";
        $scheduler->date_time_start = "2005-01-01 11:15:00";
        $scheduler->date_time_end = null;
        $scheduler->job_interval = "0::*/3::*::*::*";
        $scheduler->job = "function::aodOptimiseIndex";
        $scheduler->status = "Active";
        $scheduler->catch_up = 1;
        $scheduler->save();
    }
}
function updateScheduler()
{
    require_once 'modules/Schedulers/Scheduler.php';
    $scheduler = new Scheduler();
    $schedulers = $scheduler->get_full_list('', 'job = "function::pollMonitoredInboxesCustomAOP"');
    foreach ($schedulers as $scheduler) {
        $scheduler->job = "function::pollMonitoredInboxesAOP";
        $scheduler->save();
    }
}
function install_aor()
{
    require_once 'modules/Schedulers/Scheduler.php';
    $scheduler = new Scheduler();
    $scheduler->retrieve_by_string_fields(array('job' => 'function::aorRunScheduledReports'));
    if ($scheduler->id == '') {
        $scheduler->name = "Run Scheduled Reports";
        $scheduler->date_time_start = "2005-01-01 11:15:00";
        $scheduler->date_time_end = null;
        $scheduler->job_interval = "*::*::*::*::*";
        $scheduler->job = "function::aorRunScheduledReports";
        $scheduler->status = "Active";
        $scheduler->catch_up = 1;
        $scheduler->save();
    }
}
 function fireSelf($id)
 {
     require_once 'modules/Schedulers/Scheduler.php';
     $sched = new Scheduler();
     $sched->retrieve($id);
     $exJob = explode('::', $sched->job);
     if (is_array($exJob)) {
         $this->scheduler_id = $sched->id;
         $this->scheduler = $sched;
         $this->execute_time = $this->handleDateFormat('now');
         $this->save();
         if ($exJob[0] == 'function') {
             $GLOBALS['log']->debug('----->Scheduler found a job of type FUNCTION');
             require_once 'modules/Schedulers/_AddJobsHere.php';
             $this->setJobFlag(1);
             $func = $exJob[1];
             $GLOBALS['log']->debug('----->SchedulersJob firing ' . $func);
             $res = call_user_func($func);
             if ($res) {
                 $this->setJobFlag(2);
                 $this->finishJob();
                 return true;
             } else {
                 $this->setJobFlag(3);
                 return false;
             }
         } elseif ($exJob[0] == 'url') {
             if (function_exists('curl_init')) {
                 $GLOBALS['log']->debug('----->SchedulersJob found a job of type URL');
                 $this->setJobFlag(1);
                 $GLOBALS['log']->debug('----->SchedulersJob firing URL job: ' . $exJob[1]);
                 if ($this->fireUrl($exJob[1])) {
                     $this->setJobFlag(2);
                     $this->finishJob();
                     return true;
                 } else {
                     $this->setJobFlag(3);
                     return false;
                 }
             } else {
                 $this->setJobFlag(4);
                 return false;
             }
         }
     }
     return false;
 }
Esempio n. 7
0
 public function testInitUser()
 {
     // Check if the initUser() function returns an Admin user
     $user = Scheduler::initUser();
     $this->assertNotEquals(false, $user, "No admnin users found in the system.");
     $this->assertEquals(1, $user->is_admin, "User returned is not admin.");
     $this->assertEquals("Active", $user->status, "User returned is not active.");
 }
function AddScheduler()
{
    include_once 'install/install_utils.php';
    require_once 'modules/Schedulers/Scheduler.php';
    $scheduler = new Scheduler();
    $scheduler->retrieve_by_string_fields(array('job' => 'function::processAOW_Workflow'));
    if ($scheduler->id == '') {
        $scheduler->name = 'Run AOW WorkFlow';
        $scheduler->job = 'function::processAOW_Workflow';
        $scheduler->date_time_start = create_date(2005, 1, 1) . ' ' . create_time(0, 0, 1);
        $scheduler->date_time_end = create_date(2020, 12, 31) . ' ' . create_time(23, 59, 59);
        $scheduler->job_interval = '*::*::*::*::*';
        $scheduler->status = 'Active';
        $scheduler->created_by = '1';
        $scheduler->modified_user_id = '1';
        $scheduler->catch_up = '0';
        $scheduler->save();
    }
}
function updateScheduler()
{
    require_once 'modules/Schedulers/Scheduler.php';
    $scheduler = new Scheduler();
    if (count($scheduler->get_full_list('', "job = 'function::pollMonitoredInboxesAOP'"))) {
        return;
    }
    $scheduler->name = "AOP Check Inbound Mailboxes";
    $scheduler->date_time_start = "2005-01-01 11:15:00";
    $scheduler->date_time_end = "2020-12-31 00:00:00";
    $scheduler->job_interval = "*/1::*::*::*::*";
    $scheduler->job = "function::pollMonitoredInboxesAOP";
    $scheduler->status = "Active";
    $scheduler->catch_up = 0;
    $scheduler->save();
    $oldSchedules = $scheduler->get_full_list('', "job = 'function::pollMonitoredInboxes'");
    foreach ($oldSchedules as $oldSchedule) {
        $oldSchedule->status = "Inactive";
        $oldSchedule->save();
    }
}
 public function index()
 {
     if (!Auth::check()) {
         return Redirect::to('/');
     }
     $user = Auth::user();
     if (Scheduler::where('uid', '=', $user->id)->count() > 0) {
         return Redirect::to('/inline');
     }
     $count_matches = History::where('uid', '=', $user->id)->count();
     //return Scheduler::where('uid', '=', $user->id)->count();
     return View::make('sessions.index', ['count' => $count_matches]);
 }
Esempio n. 11
0
/**
 * The Richards benchmark simulates the task dispatcher of an
 * operating system.
 **/
function runRichards()
{
    $scheduler = new Scheduler();
    $scheduler->addIdleTask(ID_IDLE, 0, NULL, COUNT);
    $queue = new Packet(NULL, ID_WORKER, KIND_WORK);
    $queue = new Packet($queue, ID_WORKER, KIND_WORK);
    $scheduler->addWorkerTask(ID_WORKER, 1000, $queue);
    $queue = new Packet(NULL, ID_DEVICE_A, KIND_DEVICE);
    $queue = new Packet($queue, ID_DEVICE_A, KIND_DEVICE);
    $queue = new Packet($queue, ID_DEVICE_A, KIND_DEVICE);
    $scheduler->addHandlerTask(ID_HANDLER_A, 2000, $queue);
    $queue = new Packet(NULL, ID_DEVICE_B, KIND_DEVICE);
    $queue = new Packet($queue, ID_DEVICE_B, KIND_DEVICE);
    $queue = new Packet($queue, ID_DEVICE_B, KIND_DEVICE);
    $scheduler->addHandlerTask(ID_HANDLER_B, 3000, $queue);
    $scheduler->addDeviceTask(ID_DEVICE_A, 4000, NULL);
    $scheduler->addDeviceTask(ID_DEVICE_B, 5000, NULL);
    $scheduler->schedule();
    if ($scheduler->queueCount != EXPECTED_QUEUE_COUNT || $scheduler->holdCount != EXPECTED_HOLD_COUNT) {
        $error = "Error during execution: queueCount = " . $scheduler->queueCount . ", holdCount = " . $scheduler->holdCount . ".";
        throw new Exception($error);
    }
}
 public static function initTimer($wsGetArray, $wsPostArray, $cachetimeLbl, $lastrequestLbl)
 {
     self::$timeOnInit = time();
     self::$wsGetList = $wsGetArray;
     self::$wsPostList = $wsPostArray;
     self::$cachetimeLbl = $cachetimeLbl;
     self::$lastrequestLbl = $lastrequestLbl;
     $completeWslist = array_merge(self::$wsGetList, self::$wsPostList);
     foreach ($completeWslist as $ws) {
         // ex 'OSI_CACHETIME_WSO-G002'
         $WSOInfosList[] = self::$cachetimeLbl . $ws;
         // ex 'OSI_LASTREQUEST_WSO-G002'
         $WSOInfosList[] = self::$lastrequestLbl . $ws;
     }
     self::$wsInfosList = configuration::getMultiple($WSOInfosList);
 }
Esempio n. 13
0
 /**
  * batch getOrCreateWorker returns a worker by name, create it if doesnt exist
  * 
  * @param Scheduler $scheduler The scheduler object
  * @param int $workerConfigId The worker configured id
  * @param KalturaBatchJobType $workerType The type of the remote worker
  * @param string $workerName The name of the remote worker
  * @return Worker
  */
 private function getOrCreateWorker(Scheduler $scheduler, $workerConfigId, $workerType = null, $workerName = null)
 {
     if (!is_null($workerType) && !is_numeric($workerType)) {
         $workerType = kPluginableEnumsManager::apiToCore('BatchJobType', $workerType);
     }
     $c = new Criteria();
     $c->add(SchedulerWorkerPeer::SCHEDULER_CONFIGURED_ID, $scheduler->getConfiguredId());
     $c->add(SchedulerWorkerPeer::CONFIGURED_ID, $workerConfigId);
     $workerDb = SchedulerWorkerPeer::doSelectOne($c, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
     if ($workerDb) {
         $shouldSave = false;
         if (!is_null($workerName) && $workerDb->getName() != $workerName) {
             $workerDb->setName($workerName);
             $shouldSave = true;
         }
         if (!is_null($workerType) && $workerDb->getType() != $workerType) {
             $workerDb->setType($workerType);
             $shouldSave = true;
         }
         if ($shouldSave) {
             $workerDb->save();
         }
         return $workerDb;
     }
     $workerDb = new SchedulerWorker();
     $workerDb->setLastStatus(time());
     $workerDb->setCreatedBy("Scheduler: " . $scheduler->getName());
     $workerDb->setUpdatedBy("Scheduler: " . $scheduler->getName());
     $workerDb->setSchedulerId($scheduler->getId());
     $workerDb->setSchedulerConfiguredId($scheduler->getConfiguredId());
     $workerDb->setConfiguredId($workerConfigId);
     $workerDb->setDescription('');
     if (!is_null($workerType)) {
         $workerDb->setType($workerType);
     }
     if (!is_null($workerName)) {
         $workerDb->setName($workerName);
     }
     $workerDb->save();
     return $workerDb;
 }
Esempio n. 14
0
 /**
  * nextScheduledDate
  *
  * @param   string  $unix_mhdmd  Param
  * @param   string  $now         Param
  *
  * @return	string
  */
 public static function nextScheduledDate($unix_mhdmd, $now = 'now')
 {
     JLoader::import('extly.scheduler.scheduler');
     try {
         $cron = Scheduler::getParser($unix_mhdmd);
         $cron->setExpression($unix_mhdmd);
         $nextDate = $cron->getNextRunDate($now)->getTimestamp();
         $nextDate = JFactory::getDate($nextDate);
         return $nextDate;
     } catch (Exception $e) {
         $logger = AutotweetLogger::getInstance();
         $logger->log(JLog::ERROR, 'nextScheduledDate: ' . $e->getMessage());
         return null;
     }
 }
Esempio n. 15
0
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
echo get_module_title('Administration', $mod_strings['LBL_REBUILD_SCHEDULERS_TITLE'] . ":", true);
if (isset($_REQUEST['perform_rebuild']) && $_REQUEST['perform_rebuild'] == 'true') {
    require_once 'install/install_utils.php';
    $focus = new Scheduler();
    $focus->rebuildDefaultSchedulers();
    $admin_mod_strings = return_module_language($current_language, 'Administration');
    ?>
<table cellspacing="{CELLSPACING}" class="otherview">
	<tr> 
		<td scope="row" width="35%"><?php 
    echo $admin_mod_strings['LBL_REBUILD_SCHEDULERS_DESC_SUCCESS'];
    ?>
</td>
		<td><a href="index.php?module=Administration&action=Upgrade"><?php 
    echo $admin_mod_strings['LBL_RETURN'];
    ?>
</a></td>
	</tr>
</table>
Esempio n. 16
0
    installLog($mod_strings['LBL_PERFORM_DEFAULT_USERS']);
    create_default_users();
    echo $mod_strings['LBL_PERFORM_DONE'];
} else {
    echo $line_entry_format . $mod_strings['LBL_PERFORM_ADMIN_PASSWORD'] . $line_exit_format;
    installLog($mod_strings['LBL_PERFORM_ADMIN_PASSWORD']);
    $db->setUserName($setup_db_sugarsales_user);
    $db->setUserPassword($setup_db_sugarsales_password);
    set_admin_password($setup_site_admin_password);
    echo $mod_strings['LBL_PERFORM_DONE'];
}
installerHook('post_createUsers');
// default OOB schedulers
echo $line_entry_format . $mod_strings['LBL_PERFORM_DEFAULT_SCHEDULER'] . $line_exit_format;
installLog($mod_strings['LBL_PERFORM_DEFAULT_SCHEDULER']);
$scheduler = new Scheduler();
installerHook('pre_createDefaultSchedulers');
$scheduler->rebuildDefaultSchedulers();
installerHook('post_createDefaultSchedulers');
echo $mod_strings['LBL_PERFORM_DONE'];
// Enable Sugar Feeds and add all feeds by default
installLog("Enable SugarFeeds");
enableSugarFeeds();
// Enable the InsideView connector and add all modules
installLog("Enable InsideView Connector");
enableInsideViewConnector();
// Install the logic hook for FTS
installLog("Creating FTS logic hook");
if (!function_exists('createFTSLogicHook')) {
    function createFTSLogicHook($filePath = 'application/Ext/LogicHooks/logichooks.ext.php')
    {
Esempio n. 17
0
 *    (i) the "Powered by SugarCRM" logo and
 *    (ii) the SugarCRM copyright notice
 * in the same form as they appear in the distribution.  See full license for
 * requirements.
 *
 * The Original Code is: SugarCRM Open Source
 * The Initial Developer of the Original Code is SugarCRM, Inc.
 * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 ********************************************************************************/
/*********************************************************************************
 * Description:  
 ********************************************************************************/
require_once 'modules/Schedulers/Scheduler.php';
$focus = new Scheduler();
$focus->retrieve($_REQUEST['record']);
// deal with empty values
if (!empty($_REQUEST['date_end']) && !empty($_REQUEST['time_hour_end']) && !empty($_REQUEST['time_minute_end'])) {
    $date_time_end = $_REQUEST['date_end'] . " " . str_pad($_REQUEST['time_hour_end'], 2, '0', STR_PAD_LEFT) . ":" . str_pad($_REQUEST['time_minute_end'], 2, '0', STR_PAD_LEFT) . $_REQUEST['time_end_meridiem'];
} else {
    $date_time_end = '';
}
if ((!empty($_REQUEST['time_hour_from']) || $_REQUEST['time_hour_from'] == '0') && (!empty($_REQUEST['time_minute_from']) || $_REQUEST['time_minute_from'] == '0')) {
    $time_from = str_pad($_REQUEST['time_hour_from'], 2, '0', STR_PAD_LEFT) . ":" . str_pad($_REQUEST['time_minute_from'], 2, '0', STR_PAD_LEFT);
    if (!empty($_REQUEST['time_from_meridiem'])) {
        $time_from .= $_REQUEST['time_from_meridiem'];
    }
} else {
    $time_from = '';
}
Esempio n. 18
0
 public static function getJobsList()
 {
     if (empty(self::$job_strings)) {
         global $mod_strings;
         include_once 'modules/Schedulers/_AddJobsHere.php';
         // job functions
         self::$job_strings = array('url::' => 'URL');
         foreach ($job_strings as $v) {
             if (preg_match('/^class\\:\\:(.+)$/', $v, $match)) {
                 self::$job_strings[$v] = $mod_strings['LBL_' . strtoupper($match[1])];
             } else {
                 self::$job_strings['function::' . $v] = $mod_strings['LBL_' . strtoupper($v)];
             }
         }
     }
     return self::$job_strings;
 }
<?php

include_once '../AutoLoader.php';
AutoLoader::registerDirectory('../src/classes');
require "config.php";
$user = $_SESSION['user'];
$scheduler = new Scheduler();
if (empty($_SESSION['user'])) {
    header("Location: ../index.php");
    die("Redirecting to index.php");
} else {
    if (empty($_GET['room_id'])) {
        header("Location: search_rooms.php");
        die("Redirecting to search_rooms.php");
    } else {
        if (isset($_GET['submitted']) && $_GET['submitted'] == "true") {
            $getParams = "room_id=" . $_GET['room_id'] . "&date=" . $_GET['date'] . "&time_slot=" . $_GET['time_slot'];
            header("Location: insert_waitlist.php?" . $getParams);
            die("Redirecting to schedule_reservation.php");
        }
    }
}
?>

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Conference Room</title>
    <meta name="description" content="Conference room management system for Database Systems">
    <meta name="author" content="Team 6">
 /**
  * This function retrieves valid jobs, parses the cron format, then returns
  * an array of [JOB_ID][EXEC_TIME][JOB]
  * 
  * @return	$executeJobs	multi-dimensional array 
  * 							[job_id][execute_time]
  */
 function retrieveSchedulers()
 {
     $GLOBALS['log']->info('Gathering Schedulers');
     $executeJobs = array();
     $query = "SELECT id " . "FROM schedulers " . "WHERE deleted=0 " . "AND status = 'Active' " . "AND date_time_start < " . db_convert("'" . gmdate('Y-m-d H:i:s') . "'", 'datetime') . " " . "AND (date_time_end > " . db_convert("'" . gmdate('Y-m-d H:i:s') . "'", 'datetime') . " OR date_time_end IS NULL)";
     $result = $this->db->query($query);
     $rows = 0;
     $executeTimes = array();
     $executeIds = array();
     $executeJobTimes = array();
     while (($arr = $this->db->fetchByAssoc($result)) != null) {
         $focus = new Scheduler();
         $focus->retrieve($arr['id']);
         $executeTimes[$rows] = $this->deriveDBDateTimes($focus);
         if (count($executeTimes) > 0) {
             foreach ($executeTimes as $k => $time) {
                 $executeIds[$rows] = $focus->id;
                 $executeJobTimes[$rows] = $time;
             }
         }
         $rows++;
     }
     $executeJobs['ids'] = $executeIds;
     $executeJobs['times'] = $executeJobTimes;
     return $executeJobs;
 }
 /**
  * Registers the functions that are required by the indexing sub-system.
  *
  */
 function registerIndexingTasks()
 {
     $ext = OS_WINDOWS ? 'bat' : 'sh';
     $year = date('Y');
     $mon = date('m');
     $day = date('d');
     $hour = date('H');
     $min = date('i');
     $min = floor($min / 5) * 5;
     $oScheduler = new Scheduler('Indexing');
     $oScheduler->setScriptPath(KT_DIR . '/bin/indexingTask.' . $ext);
     $oScheduler->setFrequency('1min');
     $oScheduler->setFirstRunTime(date('Y-m-d H:i', mktime($hour, $min, 0, $mon, $day, $year)));
     $oScheduler->registerTask();
     $oScheduler = new Scheduler('Index Migration');
     $oScheduler->setScriptPath(KT_DIR . '/bin/indexMigrationTask.' . $ext);
     $oScheduler->setFrequency('5mins');
     $oScheduler->setFirstRunTime(date('Y-m-d H:i', mktime($hour, $min, 0, $mon, $day, $year)));
     $oScheduler->registerTask();
     $oScheduler = new Scheduler('Index Optimisation');
     $oScheduler->setScriptPath(KT_DIR . '/bin/optimizeIndexes.' . $ext);
     $oScheduler->setFrequency('weekly');
     $oScheduler->setFirstRunTime(date('Y-m-d 00:00'));
     $oScheduler->registerTask();
 }
Esempio n. 22
0
        write_array_to_file('timestamp', array(strtotime(date('H:i'))), $cachePath . '/' . $pid);
        require_once $cachePath . '/' . $pid;
    } else {
        $GLOBALS['log']->fatal('Scheduler cannot write PID file.  Please check permissions on ' . $cachePath);
    }
} else {
    if (is_writable($cachePath . '/' . $pid)) {
        require_once $cachePath . '/' . $pid;
    } else {
        $GLOBALS['log']->fatal('Scheduler cannot read the PID file.  Please check permissions on ' . $cachePath);
    }
}
////	END PREP FOR SCHEDULER PID
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
////	EXECUTE IF VALID TIME (NOT DDOS)
if ($timestamp[0] < strtotime(date('H:i'))) {
    if (is_writable($cachePath . '/' . $pid)) {
        write_array_to_file('timestamp', array(strtotime(date('H:i'))), $cachePath . '/' . $pid);
        require 'modules/Schedulers/Scheduler.php';
        $s = new Scheduler();
        $s->flushDeadJobs();
        $s->checkPendingJobs();
    } else {
        $GLOBALS['log']->fatal('Scheduler cannot write PID file.  Please check permissions on ' . $cachePath);
    }
} else {
    $GLOBALS['log']->fatal('If you see a whole string of these, there is a chance someone is attacking your system.');
}
$exit_on_cleanup = true;
sugar_cleanup($exit_on_cleanup);
Esempio n. 23
0
 ********************************************************************************/
global $current_user;
if (!is_admin($current_user)) {
    sugar_die("Unauthorized access to administration.");
}
$_REQUEST['edit'] = 'true';
$header_text = '';
global $mod_strings;
global $app_list_strings;
global $app_strings;
global $current_user;
global $timedate;
$email = new Email();
/* Start standard EditView setup logic */
$mod_strings = return_module_language($current_language, 'Schedulers');
$focus = new Scheduler();
$focus->checkCurl();
if (isset($_REQUEST['record'])) {
    Log::debug("In Scheduler edit view, about to retrieve record: " . $_REQUEST['record']);
    $result = $focus->retrieve($_REQUEST['record']);
    if ($result == null) {
        sugar_die($app_strings['ERROR_NO_RECORD']);
    }
}
if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
    Log::debug("isDuplicate found - duplicating record of id: " . $focus->id);
    $focus->id = "";
}
$params = array();
$params[] = "<a href='index.php?module=Schedulers&action=index'>{$mod_strings['LBL_MODULE_TITLE']}</a>";
if (empty($focus->id)) {
Esempio n. 24
0
<?php

set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . PATH_SEPARATOR);
require_once 'includes/common.php';
require_once 'jwrCommonsPhp/Scheduler.php';
require_once 'includes/classes/ScheduledTaskNewsletter.php';
require_once 'includes/classes/ScheduledTaskKeepalive.php';
$s = new Scheduler($db);
if (in_array('--force', $_SERVER['argv'])) {
    $s->executeEverything();
} else {
    $s->executeOverdueJobs();
}
Esempio n. 25
0
    $sched5->created_by = '1';
    $sched5->modified_user_id = '1';
    $sched5->catch_up = '1';
    $sched5->save();
    $sched6 = new Scheduler();
    $sched6->name = 'Run Nightly Mass Email Campaigns';
    $sched6->job = 'function::runMassEmailCampaign';
    $sched6->date_time_start = create_date(2005, 1, 1) . ' ' . create_time(0, 0, 1);
    $sched6->date_time_end = create_date(2020, 12, 31) . ' ' . create_time(23, 59, 59);
    $sched6->job_interval = '0::2-6::*::*::*';
    $sched6->status = 'Active';
    $sched6->created_by = '1';
    $sched6->modified_user_id = '1';
    $sched6->catch_up = '1';
    $sched6->save();
    $sched7 = new Scheduler();
    $sched7->name = 'Prune Database on 1st of Month';
    $sched7->job = 'function::pruneDatabase';
    $sched7->date_time_start = create_date(2005, 1, 1) . ' ' . create_time(0, 0, 1);
    $sched7->date_time_end = create_date(2020, 12, 31) . ' ' . create_time(23, 59, 59);
    $sched7->job_interval = '0::4::1::*::*';
    $sched7->status = 'Inactive';
    $sched7->created_by = '1';
    $sched7->modified_user_id = '1';
    $sched7->catch_up = '0';
    $sched7->save();
} else {
    $scheduler->rebuildDefaultSchedulers();
}
echo $mod_strings['LBL_PERFORM_DONE'];
// Enable Sugar Feeds and add all feeds by default
Esempio n. 26
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Scheduler $value A Scheduler object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Scheduler $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Esempio n. 27
0
 public static function getJobsList()
 {
     if (empty(self::$job_strings)) {
         global $mod_strings;
         include_once 'modules/Schedulers/_AddJobsHere.php';
         // job functions
         self::$job_strings = array('url::' => 'URL');
         foreach ($job_strings as $k => $v) {
             self::$job_strings['function::' . $v] = $mod_strings['LBL_' . strtoupper($v)];
         }
     }
     return self::$job_strings;
 }
Esempio n. 28
0
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
require_once 'include/DetailView/DetailView.php';
global $mod_strings;
global $app_strings;
global $timedate;
/* start standard DetailView layout process */
$GLOBALS['log']->info("Schedulers DetailView");
$focus = new Scheduler();
$focus->checkCurl();
$detailView = new DetailView();
$offset = 0;
if (isset($_REQUEST['offset']) or isset($_REQUEST['record'])) {
    $result = $detailView->processSugarBean("SCHEDULER", $focus, $offset);
    if ($result == null) {
        sugar_die($app_strings['ERROR_NO_RECORD']);
    }
    $focus = $result;
} else {
    header("Location: index.php?module=Schedulers&action=index");
}
if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
    $focus->id = "";
}
Esempio n. 29
0
 public function rest()
 {
     //To all the restaurants that were checked, add auth::user to DB
     $user = Auth::user();
     $selected = 0;
     $gender = Session::get('gender');
     for ($i = 0; $i < Input::get('count'); $i++) {
         if (Input::get($i) == 'yes') {
             $selected++;
             Scheduler::create(['uid' => $user->id, 'rid' => Input::get($i . '-id'), 'rname' => Input::get($i . '-name'), 'raddress' => Input::get($i . '-locations'), 'rurl' => Input::get($i . '-url'), 'gender' => $gender[0]]);
         }
     }
     if ($selected == 0) {
         return Redirect::route('results.index');
     }
     return Redirect::to('/thankyou');
 }
Esempio n. 30
0
<?php

if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}
/*
 * Your installation or use of this SugarCRM file is subject to the applicable
 * terms available at
 * http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/.
 * If you do not agree to all of the applicable terms or do not have the
 * authority to bind the entity as an authorized representative, then do not
 * install or use this SugarCRM file.
 *
 * Copyright (C) SugarCRM Inc. All rights reserved.
 */
require_once 'modules/WorkFlow/WorkFlowSchedule.php';
global $app_list_strings, $app_strings, $current_language;
$mod_strings = return_module_language('en_us', 'WorkFlow');
//run as admin
global $current_user;
$current_user = Scheduler::initUser();
$process_object = new WorkFlowSchedule();
$process_object->process_scheduled();
unset($process_object);
//sugar_cleanup(); // moved to cron.php