本文整理汇总了PHP中XenForo_Error类的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Error类的具体用法?PHP XenForo_Error怎么用?PHP XenForo_Error使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XenForo_Error类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$data = array_merge(array('position' => 0, 'queryKeys' => array('xengallery_media_drop', 'xengallery_media_add', 'xengallery_album', 'xengallery_comment', 'xengallery_user_tag', 'xf_user')), $data);
if (!$data['queryKeys']) {
return true;
}
$s = microtime(true);
$db = XenForo_Application::getDb();
$status = sprintf('%s... %s %s', 'Adding', 'XFMG Table Indexes', str_repeat(' . ', $data['position']));
foreach ($data['queryKeys'] as $key => $name) {
$data['position']++;
$query = $this->_getQueryToExecute($name);
if (!$query) {
continue;
}
try {
$db->query($query);
unset($data['queryKeys'][$key]);
} catch (Zend_Db_Exception $e) {
if ($name != 'xengallery_media_drop') {
XenForo_Error::logException($e, false, "XenForo Media Gallery: Error adding index(es) ({$name}): ");
}
unset($data['queryKeys'][$key]);
continue;
}
if ($targetRunTime && microtime(true) - $s > $targetRunTime) {
break;
}
}
return $data;
}
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:31,代码来源:901000470.php
示例2: isValid
/**
* Determines if CAPTCHA is valid (passed).
*
* @see XenForo_Captcha_Abstract::isValid()
*/
public function isValid(array $input)
{
if (!$this->_cKey) {
return true;
// if not configured, always pass
}
if (empty($input['adcopy_challenge']) || empty($input['adcopy_response'])) {
return false;
}
try {
$client = XenForo_Helper_Http::getClient('http://verify.solvemedia.com/papi/verify');
$client->setParameterPost(array('privatekey' => $this->_vKey, 'challenge' => $input['adcopy_challenge'], 'response' => $input['adcopy_response'], 'remoteip' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''));
$contents = trim($client->request('POST')->getBody());
$parts = explode("\n", $contents, 3);
$result = trim($parts[0]);
$error = isset($parts[1]) ? trim($parts[1]) : null;
if ($result == 'true') {
return true;
}
switch ($error) {
case 'wrong answer':
case 'invalid remoteip':
// generally end user mistakes
return false;
default:
// this is likely a configuration error, log and let it through
XenForo_Error::logError("Solve Media CAPTCHA error: {$error}");
return true;
}
} catch (Zend_Http_Client_Adapter_Exception $e) {
// this is an exception with the underlying request, so let it go through
XenForo_Error::logException($e, false, "Solve Media connection error: ");
return true;
}
}
开发者ID:Sywooch,项目名称:forums,代码行数:40,代码来源:SolveMedia.php
示例3: runMailQueue
public function runMailQueue($targetRunTime)
{
$s = microtime(true);
$transport = XenForo_Mail::getTransport();
$db = $this->_getDb();
do {
$queue = $this->getMailQueue($targetRunTime ? 20 : 0);
foreach ($queue as $id => $record) {
if (!$db->delete('xf_mail_queue', 'mail_queue_id = ' . $db->quote($id))) {
// already been deleted - run elsewhere
continue;
}
$mailObj = @unserialize($record['mail_data']);
if (!$mailObj instanceof Zend_Mail) {
continue;
}
$thisTransport = XenForo_Mail::getFinalTransportForMail($mailObj, $transport);
try {
$mailObj->send($thisTransport);
} catch (Exception $e) {
$toEmails = implode(', ', $mailObj->getRecipients());
XenForo_Error::logException($e, false, "Email to {$toEmails} failed: ");
// pipe may be messed up now, so let's be sure to get another one
unset($transport);
$transport = XenForo_Mail::getTransport();
}
if ($targetRunTime && microtime(true) - $s > $targetRunTime) {
$queue = false;
break;
}
}
} while ($queue);
return $this->hasMailQueue();
}
开发者ID:Sywooch,项目名称:forums,代码行数:34,代码来源:MailQueue.php
示例4: actionDiscordLink
public function actionDiscordLink()
{
$this->_assertPostOnly();
$visitor = XenForo_Visitor::getInstance();
if (!$visitor->hasPermission('general', 'linkDiscord')) {
return $this->responseNoPermission();
}
$tokenModel = $this->_getTokenmodel();
$generate = $this->_input->filterSingle('create', XenForo_Input::STRING, array('default' => ''));
if (strlen($generate)) {
$dw = XenForo_DataWriter::create('DiscordAuth_DataWriter_Token');
$existing = $tokenModel->getTokenByUserId($visitor['user_id']);
if ($existing === false || !$existing['valid']) {
if ($existing !== false) {
$dw->setExistingData($existing, true);
}
try {
$dw->set('user_id', $visitor['user_id']);
$dw->set('token', self::generateToken());
$dw->save();
// self::generateToken may throw Exception
} catch (Exception $e) {
XenForo_Error::logException($e, false);
}
}
}
$unlink = $this->_input->filterSingle('unlink', XenForo_Input::STRING, array('default' => ''));
if (strlen($unlink)) {
$dw = XenForo_DataWriter::create('XenForo_DataWriter_User');
$dw->setExistingData($visitor['user_id']);
$dw->set('da_discord_id', null);
$dw->save();
}
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $this->getDynamicRedirect(XenForo_Link::buildPublicLink('account/discord')));
}
开发者ID:Hornwitser,项目名称:DiscordAuthorizer,代码行数:35,代码来源:Account.php
示例5: processUsers
public function processUsers(XenForo_DataWriter_DiscussionMessage_Post $dw)
{
if ($this->_controller->getInput()->filterSingle('ImageRestrictionDataIsComing', XenForo_Input::UINT)) {
$usernames = $this->_controller->getInput()->filterSingle('ImageRestrictionUsers', XenForo_Input::STRING, array('array' => true));
foreach (array_keys($usernames) as $i) {
if (empty($usernames[$i])) {
unset($usernames[$i]);
}
}
if (!empty($usernames)) {
$userModel = $this->_controller->getModelFromCache('XenForo_Model_User');
$fetchOptions = array();
$invalidNames = array();
$users = $userModel->getUsersByNames($usernames, $fetchOptions, $invalidNames);
try {
if (!empty($invalidNames)) {
throw new XenForo_Exception(new XenForo_Phrase('th_imagerestriction_users_not_found_x_imagerestriction', array('users' => implode(', ', $invalidNames))), true);
}
} catch (Exception $e) {
XenForo_Error::logException($e);
}
$dw->setImageRestrictionUsers($users);
} else {
$dw->setImageRestrictionUsers(array());
}
}
}
开发者ID:ThemeHouse-XF,项目名称:ImageRestrict,代码行数:27,代码来源:ImageRestriction.php
示例6: isValid
/**
* Determines if CAPTCHA is valid (passed).
*
* @see XenForo_Captcha_Abstract::isValid()
*/
public function isValid(array $input)
{
if (!$this->_keyUserId) {
return true;
// if not configured, always pass
}
if (empty($input['keycaptcha_code']) || !is_string($input['keycaptcha_code'])) {
return false;
}
$parts = explode('|', $input['keycaptcha_code']);
if (count($parts) < 4) {
return false;
}
if ($parts[0] !== md5('accept' . $parts[1] . $this->_privateKey . $parts[2])) {
return false;
}
if (substr($parts[2], 0, 7) !== 'http://') {
return false;
}
try {
$client = XenForo_Helper_Http::getClient($parts[2]);
$contents = trim($client->request('GET')->getBody());
return $contents == '1';
} catch (Zend_Http_Client_Adapter_Exception $e) {
// this is an exception with the underlying request, so let it go through
XenForo_Error::logException($e, false, 'KeyCAPTCHA connection error:');
return true;
}
}
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:34,代码来源:KeyCaptcha.php
示例7: unreadLinkPost
/**
* Checks if the $post is the one specified in the $unreadLink. If the $unreadLink is
* empty or there is no post id in the link, true will be return asap.
* Please note that for the entire request, this method only return true once.
*
* Usage: {xen:helper wf_unreadLinkPost, $unreadLink, $post, $posts}
* Recommended position: hook:message_below
*
* @param string $unreadLink
* @param array $post
* @param array $posts
* @return bool
*/
public function unreadLinkPost($unreadLink, $post, $posts)
{
static $found = false;
static $postFragment = '#post-';
if ($found) {
// return true once
return false;
}
if (!is_array($post) || !isset($post['post_id']) || !is_array($posts)) {
// incorrect usage...
if (XenForo_Application::debugMode()) {
XenForo_Error::logError('{xen:helper wf_unreadLinkPost} requires (string $unreadLink),' . ' (array $post), (array $posts)');
}
$found = true;
} else {
$postPos = strpos($unreadLink, $postFragment);
if ($postPos === false) {
// wait for the last post and return true
$postIds = array_keys($posts);
$lastPostId = array_pop($postIds);
$found = $lastPostId == $post['post_id'];
} else {
// return true for the specified unread post
$unreadLinkPostId = substr($unreadLink, $postPos + strlen($postFragment));
$found = $unreadLinkPostId == $post['post_id'];
}
}
return $found;
}
开发者ID:maitandat1507,项目名称:bdWidgetFramework,代码行数:42,代码来源:Conditional.php
示例8: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$s = microtime(true);
/* @var $cronModel XenForo_Model_Cron */
$cronModel = XenForo_Model::create('XenForo_Model_Cron');
XenForo_Application::defer('Cron', array(), 'cron', false, XenForo_Application::$time + 300);
$entries = $cronModel->getCronEntriesToRun();
foreach ($entries as $entry) {
if (!$cronModel->updateCronRunTimeAtomic($entry)) {
continue;
}
try {
$cronModel->runEntry($entry);
} catch (Exception $e) {
// suppress so we don't get stuck
XenForo_Error::logException($e);
}
$runTime = microtime(true) - $s;
if ($targetRunTime && $runTime > $targetRunTime) {
break;
}
}
$cronModel->updateMinimumNextRunTime();
return false;
}
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:25,代码来源:Cron.php
示例9: renderRaw
public function renderRaw()
{
$attachment = $this->_params['attachment'];
if (!headers_sent() && function_exists('header_remove')) {
header_remove('Expires');
header('Cache-control: private');
}
$extension = XenForo_Helper_File::getFileExtension($attachment['filename']);
$imageTypes = array('svg' => 'image/svg+xml', 'gif' => 'image/gif', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpe' => 'image/jpeg', 'png' => 'image/png');
if (isset($imageTypes[$extension]) && ($attachment['width'] && $attachment['height'])) {
$this->_response->setHeader('Content-type', $imageTypes[$extension], true);
$this->setDownloadFileName($attachment['filename'], true);
} else {
$this->_response->setHeader('Content-type', 'application/octet-stream', true);
$this->setDownloadFileName($attachment['filename']);
}
$this->_response->setHeader('ETag', '"' . $attachment['attach_date'] . '"', true);
$this->_response->setHeader('Content-Length', $attachment['file_size'], true);
$this->_response->setHeader('X-Content-Type-Options', 'nosniff');
$attachmentFile = $this->_params['attachmentFile'];
$options = XenForo_Application::getOptions();
if ($options->SV_AttachImpro_XAR) {
if (SV_AttachmentImprovements_AttachmentHelper::ConvertFilename($attachmentFile)) {
if (XenForo_Application::debugMode() && $options->SV_AttachImpro_log) {
XenForo_Error::debug('X-Accel-Redirect:' . $attachmentFile);
}
$this->_response->setHeader('X-Accel-Redirect', $attachmentFile);
return '';
}
if (XenForo_Application::debugMode() && $options->SV_AttachImpro_log) {
XenForo_Error::debug('X-Accel-Redirect skipped');
}
}
return new XenForo_FileOutput($attachmentFile);
}
开发者ID:Xon,项目名称:XenForo-AttachmentImprovements,代码行数:35,代码来源:View.php
示例10: logExceptionByType
/** DEBUG FUNCTION **/
private static function logExceptionByType($m, $t)
{
if ($m && ($t === 1 && self::$dCacheHit || $t === 2 && self::$dFetching)) {
return XenForo_Error::logException(new XenForo_Exception($m));
} else {
return false;
}
}
开发者ID:BobbyWibowo,项目名称:EH_SocialShare,代码行数:9,代码来源:Listener2.php
示例11: logExceptionByType
private static function logExceptionByType($message, $type)
{
if ($type === 1 && self::$debugCacheHit || $type === 2 && self::$debugCurl) {
return XenForo_Error::logException(new XenForo_Exception($message));
} else {
return false;
}
}
开发者ID:BobbyWibowo,项目名称:EH_SocialShare,代码行数:8,代码来源:Listener.php
示例12: createUser
public static function createUser(array $data, array $provider, array $externalToken, array $externalVisitor, XenForo_Model_UserExternal $userExternalModel)
{
$user = null;
/** @var bdApiConsumer_XenForo_Model_UserExternal $userExternalModel */
$options = XenForo_Application::get('options');
/** @var XenForo_DataWriter_User $writer */
$writer = XenForo_DataWriter::create('XenForo_DataWriter_User');
if ($options->registrationDefaults) {
$writer->bulkSet($options->registrationDefaults, array('ignoreInvalidFields' => true));
}
if (!isset($data['timezone']) and isset($externalVisitor['user_timezone_offset'])) {
$tzOffset = $externalVisitor['user_timezone_offset'];
$tzName = timezone_name_from_abbr('', $tzOffset, 1);
if ($tzName !== false) {
$data['timezone'] = $tzName;
}
}
if (!empty($data['user_id'])) {
$writer->setImportMode(true);
}
$writer->bulkSet($data);
if (!empty($data['user_id'])) {
$writer->setImportMode(false);
}
$writer->set('email', $externalVisitor['user_email']);
if (!empty($externalVisitor['user_gender'])) {
$writer->set('gender', $externalVisitor['user_gender']);
}
if (!empty($externalVisitor['user_dob_day']) && !empty($externalVisitor['user_dob_month']) && !empty($externalVisitor['user_dob_year'])) {
$writer->set('dob_day', $externalVisitor['user_dob_day']);
$writer->set('dob_month', $externalVisitor['user_dob_month']);
$writer->set('dob_year', $externalVisitor['user_dob_year']);
}
if (!empty($externalVisitor['user_register_date'])) {
$writer->set('register_date', $externalVisitor['user_register_date']);
}
$userExternalModel->bdApiConsumer_syncUpOnRegistration($writer, $externalToken, $externalVisitor);
$auth = XenForo_Authentication_Abstract::create('XenForo_Authentication_NoPassword');
$writer->set('scheme_class', $auth->getClassName());
$writer->set('data', $auth->generate(''), 'xf_user_authenticate');
$writer->set('user_group_id', XenForo_Model_User::$defaultRegisteredGroupId);
$writer->set('language_id', XenForo_Visitor::getInstance()->get('language_id'));
$writer->advanceRegistrationUserState(false);
// TODO: option for extra user group
$writer->preSave();
if ($writer->hasErrors()) {
return $user;
}
try {
$writer->save();
$user = $writer->getMergedData();
$userExternalModel->bdApiConsumer_updateExternalAuthAssociation($provider, $externalVisitor['user_id'], $user['user_id'], array_merge($externalVisitor, array('token' => $externalToken)));
XenForo_Model_Ip::log($user['user_id'], 'user', $user['user_id'], 'register_api_consumer');
} catch (XenForo_Exception $e) {
XenForo_Error::logException($e, false);
}
return $user;
}
开发者ID:billyprice1,项目名称:bdApi,代码行数:58,代码来源:AutoRegister.php
示例13: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$data = array_merge(array('batch' => 100, 'position' => 0), $data);
/* @var $attachmentModel XenForo_Model_Attachment */
$attachmentModel = XenForo_Model::create('XenForo_Model_Attachment');
$s = microtime(true);
$dataIds = $attachmentModel->getAttachmentDataIdsInRange($data['position'], $data['batch']);
if (sizeof($dataIds) == 0) {
return false;
}
foreach ($dataIds as $dataId) {
$data['position'] = $dataId;
$dw = XenForo_DataWriter::create('XenForo_DataWriter_AttachmentData', XenForo_DataWriter::ERROR_SILENT);
if ($dw->setExistingData($dataId) && $dw->get('width') && XenForo_Image_Abstract::canResize($dw->get('width'), $dw->get('height'))) {
$attach = $dw->getMergedData();
$attachFile = $attachmentModel->getAttachmentDataFilePath($attach);
$imageInfo = @getimagesize($attachFile);
if ($imageInfo) {
try {
$image = XenForo_Image_Abstract::createFromFile($attachFile, $imageInfo[2]);
} catch (Exception $e) {
XenForo_Error::logException($e, false, "Thumbnail rebuild error {$attachFile}: ");
continue;
}
if ($image) {
if ($image->thumbnail(XenForo_Application::get('options')->attachmentThumbnailDimensions)) {
ob_start();
$image->output($imageInfo[2]);
$thumbData = ob_get_contents();
ob_end_clean();
} else {
// no resize necessary, use the original
$thumbData = file_get_contents($attachFile);
}
$dw->set('thumbnail_width', $image->getWidth());
$dw->set('thumbnail_height', $image->getHeight());
$dw->setExtraData(XenForo_DataWriter_AttachmentData::DATA_THUMB_DATA, $thumbData);
try {
$dw->save();
} catch (Exception $e) {
XenForo_Error::logException($e, false, "Thumb rebuild for #{$dataId}: ");
}
unset($image);
}
}
}
if ($targetRunTime && microtime(true) - $s > $targetRunTime) {
break;
}
}
$actionPhrase = new XenForo_Phrase('rebuilding');
$typePhrase = new XenForo_Phrase('attachment_thumbnails');
$status = sprintf('%s... %s (%s)', $actionPhrase, $typePhrase, XenForo_Locale::numberFormat($data['position']));
return $data;
}
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:55,代码来源:AttachmentThumb.php
示例14: actionStaffShare
public function actionStaffShare()
{
$visitor = XenForo_Visitor::getInstance();
if (!$visitor->hasPermission('general', 'bdSocialShare_staffShare')) {
return $this->responseNoPermission();
}
$url = $this->_input->filterSingle('url', XenForo_Input::STRING);
if (empty($url)) {
return $this->responseView('bdSocialShare_ViewPublic_Misc_StaffShare_UrlForm', 'bdsocialshare_staff_share_url_form');
}
$request = new Zend_Controller_Request_Http($url);
$request->setParamSources(array());
$routeMatch = bdSocialShare_Listener::getDependencies()->route($request);
$shareable = $this->getModelFromCache('bdSocialShare_Model_Publisher')->getShareableForRouteMatchAndRequest($routeMatch, $request);
if (empty($shareable)) {
return $this->responseMessage(new XenForo_Phrase('bdsocialshare_url_x_is_not_supported', array('url' => $url)));
}
$userModel = $this->getModelFromCache('XenForo_Model_User');
$viewingUserGuest = $userModel->getVisitingGuestUser();
$userModel->bdSocialShare_prepareViewingUser($viewingUserGuest);
$shareable->setViewingUser($viewingUserGuest);
$publisherModel = $this->getModelFromCache('bdSocialShare_Model_Publisher');
$facebookAccounts = false;
if (bdSocialShare_Option::hasPermissionFacebook($viewingUserGuest)) {
$facebookAccounts = $this->getModelFromCache('bdSocialShare_Model_Facebook')->getAccounts();
}
$twitterAccounts = false;
if (bdSocialShare_Option::hasPermissionTwitter($viewingUserGuest)) {
$twitterAccounts = $this->getModelFromCache('bdSocialShare_Model_Twitter')->getAccounts();
}
if ($this->isConfirmedPost()) {
$target = $this->_input->filterSingle('target', XenForo_Input::STRING);
$targetId = $this->_input->filterSingle('target_id', XenForo_Input::STRING);
$data = $this->_input->filter(array('userText' => XenForo_Input::STRING, 'title' => XenForo_Input::STRING, 'description' => XenForo_Input::STRING, 'image' => XenForo_Input::STRING));
$data['link'] = $shareable->getLink($publisherModel);
$staffShareSharable = new bdSocialShare_Shareable_StaffShare($data);
$published = false;
try {
$published = $publisherModel->publish($target, $targetId, $staffShareSharable, $viewingUserGuest);
} catch (XenForo_Exception $e) {
XenForo_Error::logException($e);
}
if ($published) {
XenForo_Model_Log::logModeratorAction('bdsocialshare_all', $data, $target, array('target_id' => $targetId));
return $this->responseMessage(new XenForo_Phrase('bdsocialshare_staff_share_published_successfully'));
} else {
return $this->responseError(new XenForo_Phrase('unexpected_error_occurred'));
}
}
$viewParams = array('facebookAccounts' => $facebookAccounts, 'twitterAccounts' => $twitterAccounts, 'hasAdminPermissionOption' => $visitor->hasAdminPermission('option'), 'url' => $url, 'link' => $shareable->getLink($publisherModel), 'userText' => strval($shareable->getUserText($publisherModel)), 'title' => strval($shareable->getTitle($publisherModel)), 'description' => strval($shareable->getDescription($publisherModel)), 'image' => $shareable->getImage($publisherModel));
return $this->responseView('bdSocialShare_ViewPublic_Misc_StaffShare', 'bdsocialshare_staff_share', $viewParams);
}
开发者ID:Sywooch,项目名称:forums,代码行数:52,代码来源:Misc.php
示例15: insertTranscodeQueue
public function insertTranscodeQueue(array $data)
{
XenForo_Application::getDb()->insert('xengallery_transcode_queue', array('queue_data' => @serialize($data), 'queue_date' => XenForo_Application::$time));
if (!$this->isDeferredQueued()) {
try {
XenForo_Application::defer('XenGallery_Deferred_TranscodeQueue', array(), 'TranscodeQueue');
} catch (Exception $e) {
// need to just ignore this and let it get picked up later
XenForo_Error::logException($e, false);
}
}
return true;
}
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:13,代码来源:Transcode.php
示例16: _postDelete
protected function _postDelete()
{
parent::_postDelete();
$discordId = $this->getExisting('da_discord_id');
if ($discordId !== null) {
XenForo_CodeEvent::addListener('controller_post_dispatch', function ($c, $r, $n, $a) use($discordId) {
try {
self::refreshDiscordId($discordId);
} catch (Exception $e) {
XenForo_Error::logException($e, false);
}
});
}
}
开发者ID:Hornwitser,项目名称:DiscordAuthorizer,代码行数:14,代码来源:User.php
示例17: getUserInfo
/**
* Gets Facebook user info from the specified place.
*
* @param string $accessToken FB access token (from code swap, or given by user); may be empty
* @param string $path Path to access (defaults to "me")
*
* @return array Info; may be error
*/
public static function getUserInfo($accessToken, $path = 'me')
{
try {
$client = XenForo_Helper_Http::getClient('https://graph.facebook.com/' . $path);
if ($accessToken) {
$client->setParameterGet('access_token', $accessToken);
}
$response = $client->request('GET');
return json_decode($response->getBody(), true);
} catch (Zend_Http_Client_Exception $e) {
XenForo_Error::logException($e, false);
return false;
}
}
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:22,代码来源:Facebook.php
示例18: _postSave
protected function _postSave()
{
if ($this->isInsert()) {
$function = sprintf('_sendAlerts_%s', $this->get('comment_type'));
$comment = $this->getMergedData();
$team = $this->_getTeamData();
try {
$this->{$function}($comment, $team);
} catch (Exception $e) {
XenForo_Error::logException($e);
}
// should be update new feed!
$this->_publishToNewsFeed();
$db = $this->_db;
$db->update('xf_team', array('last_activity' => XenForo_Application::$time), 'team_id = ' . $db->quote($this->get('team_id')));
}
}
开发者ID:Sywooch,项目名称:forums,代码行数:17,代码来源:Comment.php
示例19: run
/**
* Run all (or as many as possible) outstanding cron entries.
* Confirms via an atomic update that the entries are runnable first.
*/
public function run()
{
/* @var $cronModel XenForo_Model_Cron */
$cronModel = XenForo_Model::create('XenForo_Model_Cron');
$entries = $cronModel->getCronEntriesToRun();
foreach ($entries as $entry) {
if (!$cronModel->updateCronRunTimeAtomic($entry)) {
continue;
}
try {
$cronModel->runEntry($entry);
} catch (Exception $e) {
// suppress so we don't get stuck
XenForo_Error::logException($e);
}
}
$cronModel->updateMinimumNextRunTime();
}
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:22,代码来源:Cron.php
示例20: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
/* @var $emailModel XenForo_Model_EmailBounce */
$emailModel = XenForo_Model::create('XenForo_Model_EmailBounce');
if (!isset($data['start'])) {
$data['start'] = time();
}
$s = microtime(true);
try {
$connection = $emailModel->openBounceHandlerConnection();
if (!$connection) {
return false;
}
} catch (Zend_Mail_Exception $e) {
XenForo_Error::logException($e);
return false;
}
$total = $connection->countMessages();
if (!$total) {
return false;
}
$finished = true;
for ($messageId = $total, $i = 0; $messageId > 0; $messageId--, $i++) {
if ($i > 0 && $targetRunTime && microtime(true) - $s >= $targetRunTime) {
$finished = false;
break;
}
$headers = $connection->getRawHeader($messageId);
$content = $connection->getRawContent($messageId);
$connection->removeMessage($messageId);
$rawMessage = trim($headers) . "\r\n\r\n" . trim($content);
$emailModel->processBounceEmail($rawMessage);
}
$connection->close();
if ($finished) {
return false;
} else {
if (time() - $data['start'] > 60 * 30) {
// don't let a single run of this run for more than 30 minutes
return false;
}
return $data;
}
}
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:44,代码来源:EmailBounce.php
注:本文中的XenForo_Error类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论