本文整理汇总了PHP中PerformancePrefs::get方法的典型用法代码示例。如果您正苦于以下问题:PHP PerformancePrefs::get方法的具体用法?PHP PerformancePrefs::get怎么用?PHP PerformancePrefs::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PerformancePrefs
的用法示例。
在下文中一共展示了PerformancePrefs::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeCron
public function executeCron($who_trigger)
{
$log = vglobal('log');
$log->debug('Start executeCron');
$row = self::getActiveScan();
if ($row > 0) {
$log->warn(vtranslate('ERROR_ACTIVE_CRON', 'OSSMailScanner'));
return vtranslate('ERROR_ACTIVE_CRON', 'OSSMailScanner');
}
$OSSMailModel = Vtiger_Record_Model::getCleanInstance('OSSMail');
$OSSMailScannerModel = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
$countEmails = 0;
$scanId = 0;
$accounts = $OSSMailModel->getAccountsList();
if (!$accounts) {
$log->warn('There are no accounts to be scanned');
return false;
}
self::setCronStatus('2');
$scanId = $OSSMailScannerModel->add_scan_history(array('user' => $who_trigger));
foreach ($OSSMailModel->getAccountsList() as $account) {
$log->debug('Start checking account: ' . $account['username']);
foreach ($OSSMailScannerModel->getConfigFolderList() as $key => $folders) {
if ($folders != null) {
$folderArray = array();
if (strpos($folders, ',')) {
$folderArray = explode(",", $folders);
} else {
$folderArray[0] = $folders;
}
foreach ($folderArray as $folder) {
$log->debug('Start checking folder: ' . $folder);
$mbox = $OSSMailModel->imapConnect($account['username'], $account['password'], $account['mail_host'], $folder, false);
if (!$mbox) {
$log->fatal('Incorrect mail access data: ' . $account['username']);
continue;
}
$countEmails = $OSSMailScannerModel->mail_Scan($mbox, $account, $folder, $scanId, $countEmails);
imap_close($mbox);
if ($countEmails >= PerformancePrefs::get('NUMBERS_EMAILS_DOWNLOADED_DURING_ONE_SCANNING')) {
$log->warn('Reached the maximum number of scanned mails');
$OSSMailScannerModel->update_scan_history($scanId, ['status' => '0', 'count' => $countEmails, 'action' => 'Action_CronMailScanner']);
self::setCronStatus('1');
return 'ok';
}
}
}
}
}
$OSSMailScannerModel->update_scan_history($scanId, ['status' => '0', 'count' => $countEmails, 'action' => 'Action_CronMailScanner']);
self::setCronStatus('1');
$log->debug('End executeCron');
return 'ok';
}
示例2: executeCron
public function executeCron($who_trigger)
{
$row = self::getActiveScan();
if ($row > 0) {
return vtranslate('ERROR_ACTIVE_CRON', 'OSSMailScanner');
}
$OSSMailModel = Vtiger_Record_Model::getCleanInstance('OSSMail');
$OSSMailScannerModel = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
$countEmails = 0;
$scanId = 0;
$accounts = $OSSMailModel->getAccountsList();
if (!$accounts) {
return false;
}
self::setCronStatus('2');
$scanId = $OSSMailScannerModel->add_scan_history(array('user' => $who_trigger));
foreach ($OSSMailModel->getAccountsList() as $account) {
foreach ($OSSMailScannerModel->getConfigFolderList() as $key => $folders) {
if ($folders != null) {
$folderArray = array();
if (strpos($folders, ',')) {
$folderArray = explode(",", $folders);
} else {
$folderArray[0] = $folders;
}
foreach ($folderArray as $folder) {
$mbox = $OSSMailModel->imap_connect($account['username'], $account['password'], $folder);
$countEmails = $OSSMailScannerModel->mail_Scan($mbox, $account, $folder, $scanId, $countEmails);
imap_close($mbox);
if ($countEmails >= PerformancePrefs::get('NUMBERS_EMAILS_DOWNLOADED_DURING_ONE_SCANNING')) {
$OSSMailScannerModel->update_scan_history($scanId, ['status' => '0', 'count' => $countEmails, 'action' => 'Action_CronMailScanner']);
self::setCronStatus('1');
return 'ok';
}
}
}
}
}
$OSSMailScannerModel->update_scan_history($scanId, ['status' => '0', 'count' => $countEmails, 'action' => 'Action_CronMailScanner']);
self::setCronStatus('1');
return 'ok';
}