本文整理汇总了PHP中Vtiger_Cron::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Cron::getInstance方法的具体用法?PHP Vtiger_Cron::getInstance怎么用?PHP Vtiger_Cron::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Cron
的用法示例。
在下文中一共展示了Vtiger_Cron::getInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vtDisplayWorkflowList
function vtDisplayWorkflowList($adb, $request, $requestUrl, $app_strings, $current_language)
{
global $theme;
$image_path = "themes/{$theme}/images/";
$module = new VTWorkflowApplication("workflowlist");
$util = new VTWorkflowUtils();
$mod = return_module_language($current_language, $module->name);
if (!$util->checkAdminAccess()) {
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
return;
}
$smarty = new vtigerCRM_Smarty();
$wfs = new VTWorkflowManager($adb);
$smarty->assign("moduleNames", $util->vtGetModules($adb));
$smarty->assign("returnUrl", $requestUrl);
$listModule = $request['list_module'];
$smarty->assign("listModule", $listModule);
if ($listModule == null || strtolower($listModule) == "all") {
$smarty->assign("workflows", $wfs->getWorkflows());
} else {
$smarty->assign("workflows", $wfs->getWorkflowsForModule($listModule));
}
$smarty->assign("MOD", array_merge(return_module_language($current_language, 'Settings'), return_module_language($current_language, $module->name)));
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("MODULE_NAME", $module->label);
$smarty->assign("PAGE_NAME", $mod['LBL_WORKFLOW_LIST']);
$smarty->assign("PAGE_TITLE", $mod['LBL_AVAILABLE_WORKLIST_LIST']);
$smarty->assign("module", $module);
$smarty->assign('MODULE', $module->name);
$smarty->assign("CRON_TASK", Vtiger_Cron::getInstance('Workflow'));
$smarty->display("{$module->name}/ListWorkflows.tpl");
}
示例2: vtigerCRM_Smarty
<?php
/*********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
require_once 'modules/Settings/MailScanner/core/MailScannerInfo.php';
require_once 'Smarty_setup.php';
require_once 'vtlib/Vtiger/Cron.php';
global $app_strings, $mod_strings, $currentModule, $theme, $current_language;
global $application_unique_key;
// defined in config.inc.php
$smarty = new vtigerCRM_Smarty();
$smarty->assign("MOD", return_module_language($current_language, 'Settings'));
$smarty->assign("CMOD", $mod_strings);
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", "themes/{$theme}/images/");
$scanners = Vtiger_MailScannerInfo::listAll();
$smarty->assign("SCANNERS", $scanners);
$smarty->assign("APP_KEY", $application_unique_key);
$smarty->assign("CRON_TASK", Vtiger_Cron::getInstance('MailScanner'));
$smarty->display('MailScanner/MailScannerInfo.tpl');
示例3: str_replace
$organization_name = $site_URLArray[2];
$organization_name = str_replace('.od1.vtiger.com', '', $organization_name);
$version = explode('.', phpversion());
$php = $version[0] * 10000 + $version[1] * 100 + $version[2];
if ($php < 50300) {
$hostName = php_uname('n');
} else {
$hostName = gethostname();
}
$mailbody = "Instance dir : {$root_directory} <br/> Company Name : {$organization_name} <br/> Site Url : {$site_URL} <br/> Host Name : {$hostName}<br/>";
$mailSubject = "[Alert] {$organization_name} ";
if (PHP_SAPI === "cli" || isset($_SESSION["authenticated_user_id"]) && isset($_SESSION["app_unique_key"]) && $_SESSION["app_unique_key"] == $application_unique_key) {
$cronTasks = false;
if (isset($_REQUEST['service'])) {
// Run specific service
$cronTasks = array(Vtiger_Cron::getInstance($_REQUEST['service']));
} else {
// Run all service
$cronTasks = Vtiger_Cron::listAllActiveInstances();
}
$cronRunId = microtime(true);
$cronStarts = date('Y-m-d H:i:s');
//set global current user permissions
global $current_user;
$current_user = Users::getActiveAdminUser();
echo sprintf('[CRON],"%s",%s,Instance,"%s","",[STARTS]', $cronRunId, $site_URL, $cronStarts) . "\n";
foreach ($cronTasks as $cronTask) {
try {
$cronTask->setBulkMode(true);
// Not ready to run yet?
if (!$cronTask->isRunnable()) {
示例4: chdir
chdir(dirname(__FILE__) . '/../');
/**
* Start the cron services configured.
*/
include_once 'include/Webservices/Relation.php';
include_once 'include/main/WebUI.php';
require_once 'vtlib/Vtiger/Cron.php';
require_once 'modules/Emails/mail.php';
Vtiger_Session::init();
if (PHP_SAPI === 'cli' || PHP_SAPI === 'cgi-fcgi' || !empty(Vtiger_Session::get('authenticated_user_id')) && !empty(Vtiger_Session::get('app_unique_key')) && Vtiger_Session::get('app_unique_key') == vglobal('application_unique_key')) {
$log = LoggerManager::getLogger('CRON');
vglobal('log', $log);
$cronTasks = false;
if (isset($_REQUEST['service'])) {
// Run specific service
$cronTasks = [Vtiger_Cron::getInstance($_REQUEST['service'])];
} else {
// Run all service
$cronTasks = Vtiger_Cron::listAllActiveInstances();
}
$cronStarts = date('Y-m-d H:i:s');
//set global current user permissions
$current_user = vglobal('current_user');
$current_user = Users::getActiveAdminUser();
echo sprintf('--------------- %s | Start CRON ----------', date('Y-m-d H:i:s')) . PHP_EOL;
foreach ($cronTasks as $cronTask) {
try {
// Timeout could happen if intermediate cron-tasks fails
// and affect the next task. Which need to be handled in this cycle.
if ($cronTask->hadTimeout()) {
echo sprintf('%s | %s - Cron task had timedout as it was not completed last time it run' . PHP_EOL, date('Y-m-d H:i:s'), $cronTask->getName());
示例5: array
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
/**
* Start the cron services configured.
*/
include_once 'vtlib/Vtiger/Cron.php';
require_once 'config.inc.php';
if (PHP_SAPI === "cli" || isset($_SESSION["authenticated_user_id"]) && isset($_SESSION["app_unique_key"]) && $_SESSION["app_unique_key"] == $application_unique_key) {
$cronTasks = false;
if (isset($_REQUEST['service'])) {
// Run specific service
$cronTasks = array(Vtiger_Cron::getInstance(vtlib_purify($_REQUEST['service'])));
} else {
// Run all service
$cronTasks = Vtiger_Cron::listAllActiveInstances();
}
foreach ($cronTasks as $cronTask) {
try {
$cronTask->setBulkMode(true);
// Not ready to run yet?
if (!$cronTask->isRunnable()) {
echo sprintf("[INFO]: %s - not ready to run as the time to run again is not completed\n", $cronTask->getName());
continue;
}
// Timeout could happen if intermediate cron-tasks fails
// and affect the next task. Which need to be handled in this cycle.
if ($cronTask->hadTimedout()) {
示例6: chdir
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
/**
* Start the cron services configured.
*/
chdir(__DIR__);
include_once 'vtlib/Vtiger/Cron.php';
require_once 'config.inc.php';
if (PHP_SAPI === "cli" || PHP_SAPI === "cgi-fcgi" || PHP_SAPI === "apache2handler" || isset($_SESSION["authenticated_user_id"]) && isset($_SESSION["app_unique_key"]) && $_SESSION["app_unique_key"] == $application_unique_key) {
$cronTasks = false;
if (isset($_REQUEST['service']) or $argc == 2 and !empty($argv[1])) {
// Run specific service
$srv = empty($argv[1]) ? $_REQUEST['service'] : $argv[1];
$srvcron = Vtiger_Cron::getInstance(vtlib_purify($srv));
if ($srvcron !== false) {
$cronTasks = array($srvcron);
} else {
echo "** Service {$srv} not found **";
die;
}
} else {
// Run all service
$cronTasks = Vtiger_Cron::listAllActiveInstances();
}
foreach ($cronTasks as $cronTask) {
try {
$cronTask->setBulkMode(true);
// Not ready to run yet?
if (!$cronTask->isRunnable()) {