本文整理汇总了PHP中XenForo_Locale类的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Locale类的具体用法?PHP XenForo_Locale怎么用?PHP XenForo_Locale使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XenForo_Locale类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: rebuild
/**
* @see XenForo_CacheRebuilder_DailyStats::rebuild()
*/
public function rebuild($position = 0, array &$options = array(), &$detailedMessage = '')
{
$options['batch'] = isset($options['batch']) ? $options['batch'] : 28;
$options['batch'] = max(1, $options['batch']);
/* @var $userModel XenForo_Model_Stats */
$statsModel = XenForo_Model::create('XenForo_Model_Stats');
if ($position == 0) {
// delete old stats cache if required
if (!empty($options['delete'])) {
$statsModel->deleteStats();
}
$xenOptions = XenForo_Application::get('options');
// an appropriate date from which to start... first thread, or earliest user reg?
if ($xenOptions->th_noForo_noForum) {
$position = XenForo_Model::create('XenForo_Model_User')->getEarliestRegistrationDate();
} else {
$position = min(XenForo_Model::create('XenForo_Model_Thread')->getEarliestThreadDate(), XenForo_Model::create('XenForo_Model_User')->getEarliestRegistrationDate());
}
// start on a 24 hour increment point
$position = $position - $position % 86400;
} else {
if ($position > XenForo_Application::$time) {
return true;
}
}
XenForo_Db::beginTransaction();
$endPosition = $position + $options['batch'] * 86400;
$data = $statsModel->buildStatsData($position, $endPosition);
XenForo_Db::commit();
$detailedMessage = XenForo_Locale::date($position, 'absolute');
return $endPosition;
}
开发者ID:ThemeHouse-XF,项目名称:NoForo,代码行数:35,代码来源:DailyStats.php
示例2: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$data = array_merge(array('position' => 0, 'batch' => 100), $data);
$data['batch'] = max(1, $data['batch']);
/* @var $trophyModel XenForo_Model_Trophy */
$trophyModel = XenForo_Model::create('XenForo_Model_Trophy');
$trophies = $trophyModel->getAllTrophies();
if (!$trophies) {
return true;
}
/* @var $userModel XenForo_Model_User */
$userModel = XenForo_Model::create('XenForo_Model_User');
$userIds = $userModel->getUserIdsInRange($data['position'], $data['batch']);
if (sizeof($userIds) == 0) {
return true;
}
$data['position'] = end($userIds);
$users = $userModel->getUsers(array('user_state' => 'valid', 'is_banned' => 0, 'user_id' => $userIds), array('join' => XenForo_Model_User::FETCH_USER_FULL));
$userTrophies = $trophyModel->getUserTrophiesByUserIds(array_keys($users));
foreach ($users as $user) {
$trophyModel->updateTrophiesForUser($user, isset($userTrophies[$user['user_id']]) ? $userTrophies[$user['user_id']] : array(), $trophies);
$trophyModel->updateTrophyPointsForUser($user['user_id']);
}
$actionPhrase = new XenForo_Phrase('rebuilding');
$typePhrase = new XenForo_Phrase('trophies');
$status = sprintf('%s... %s (%s)', $actionPhrase, $typePhrase, XenForo_Locale::numberFormat($data['position']));
return $data;
}
开发者ID:Sywooch,项目名称:forums,代码行数:28,代码来源:Trophy.php
示例3: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$data = array_merge(array('position' => 0, 'batch' => 100, 'delete' => false), $data);
$data['batch'] = max(1, $data['batch']);
/* @var $statsModel XenForo_Model_Stats */
$statsModel = XenForo_Model::create('XenForo_Model_Stats');
if ($data['position'] == 0) {
// delete old stats cache if required
if (!empty($data['delete'])) {
$statsModel->deleteStats();
}
// an appropriate date from which to start... first thread, or earliest user reg?
$data['position'] = min(XenForo_Model::create('XenForo_Model_Thread')->getEarliestThreadDate(), XenForo_Model::create('XenForo_Model_User')->getEarliestRegistrationDate());
// start on a 24 hour increment point
$data['position'] = $data['position'] - $data['position'] % 86400;
} else {
if ($data['position'] > XenForo_Application::$time) {
return true;
}
}
$endPosition = $data['position'] + $data['batch'] * 86400;
$statsModel->buildStatsData($data['position'], $endPosition);
$data['position'] = $endPosition;
$actionPhrase = new XenForo_Phrase('rebuilding');
$typePhrase = new XenForo_Phrase('daily_statistics');
$status = sprintf('%s... %s (%s)', $actionPhrase, $typePhrase, XenForo_Locale::date($data['position'], 'absolute'));
return $data;
}
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:28,代码来源:DailyStats.php
示例4: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$data = array_merge(array('position' => 0, 'batch' => 5), $data);
$data['batch'] = max(1, $data['batch']);
/* @var $albumModel XenGallery_Model_Album */
$albumModel = XenForo_Model::create('XenGallery_Model_Album');
/* @var $mediaModel XenGallery_Model_Media */
$mediaModel = XenForo_Model::create('XenGallery_Model_Media');
$albumIds = $albumModel->getAlbumIdsInRange($data['position'], $data['batch']);
if (sizeof($albumIds) == 0) {
return true;
}
foreach ($albumIds as $albumId) {
$count = $mediaModel->countMedia(array('album_id' => $albumId));
$albumWriter = XenForo_DataWriter::create('XenGallery_DataWriter_Album');
$albumWriter->setExistingData($albumId);
$albumWriter->set('album_media_count', $count);
$albumWriter->save();
$data['position'] = $albumId;
}
$actionPhrase = new XenForo_Phrase('rebuilding');
$typePhrase = new XenForo_Phrase('xengallery_rebuilding_album_media_counts');
$status = sprintf('%s... %s (%s)', $actionPhrase, $typePhrase, XenForo_Locale::numberFormat($data['position']));
return $data;
}
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:25,代码来源:AlbumMediaCount.php
示例5: runDailyCleanUp
public static function runDailyCleanUp()
{
$options = XenForo_Application::get('options');
$model = XenForo_Model::create('Dark_TaigaChat_Model_TaigaChat');
if ($options->dark_taigachat_archivethread > 0) {
$messages = array_reverse($model->getMessagesToday());
if (count($messages) > 0) {
$userModel = XenForo_Model::create('XenForo_Model_User');
$post = "";
foreach ($messages as $message) {
$date = XenForo_Locale::dateTime($message['date'], 'absolute');
if ($message['user_id'] > 0) {
$url = XenForo_Link::convertUriToAbsoluteUri(XenForo_Link::buildPublicLink("members/" . $message['user_id']), true);
$user = "[url='{$url}']{$message['username']}[/url]";
} else {
$user = "[b]{$message['username']}[/b]";
}
$post .= "{$date} - {$user}: {$message['message']}\r\n";
}
$username = "TaigaChat";
if ($options->dark_taigachat_archiveuser > 0) {
$user = $userModel->getUserById($options->dark_taigachat_archiveuser);
$username = $user['username'];
}
$writer = XenForo_DataWriter::create('XenForo_DataWriter_DiscussionMessage_Post');
$writer->setOption(XenForo_DataWriter_DiscussionMessage::OPTION_IS_AUTOMATED, true);
$writer->set('user_id', $options->dark_taigachat_archiveuser);
$writer->set('username', $username);
$writer->set('message', $post);
$writer->set('thread_id', $options->dark_taigachat_archivethread);
$writer->save();
}
}
$model->deleteOldMessages();
}
开发者ID:Sywooch,项目名称:forums,代码行数:35,代码来源:CleanUp.php
示例6: rebuild
/**
* Rebuilds the data.
*
* @see XenForo_CacheRebuilder_Abstract::rebuild()
*/
public function rebuild($position = 0, array &$options = array(), &$detailedMessage = '')
{
$options['batch'] = max(1, isset($options['batch']) ? $options['batch'] : 10);
if ($position == 0) {
XenForo_Model::create('XenForo_Model_Node')->updateNestedSetInfo();
}
/* @var $forumModel XenForo_Model_Forum */
$forumModel = XenForo_Model::create('XenForo_Model_Forum');
$forums = $forumModel->getForums(array(), array('limit' => $options['batch'], 'offset' => $position));
XenForo_Db::beginTransaction();
foreach ($forums as $forum) {
$position++;
$forumDw = XenForo_DataWriter::create('XenForo_DataWriter_Forum', XenForo_DataWriter::ERROR_SILENT);
if ($forumDw->setExistingData($forum, true)) {
$forumDw->rebuildCounters();
$forumDw->save();
}
}
XenForo_Db::commit();
$detailedMessage = XenForo_Locale::numberFormat($position);
if (!$forums) {
return true;
} else {
return $position;
}
}
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:31,代码来源:Forum.php
示例7: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
return true;
$data = array_merge(array('position' => 0, 'batch' => 10), $data);
$data['batch'] = max(1, $data['batch']);
/* @var $feedbackModel NixFifty_XenTrader_Model_Feedback */
$feedbackModel = XenForo_Model::create('NixFifty_XenTrader_Model_Feedback');
$feedbackItems = $feedbackModel->getUserIdsInFeedbackRange($data['position'], $data['batch']);
if (sizeof($feedbackItems) == 0) {
return true;
}
$db = XenForo_Application::getDb();
XenForo_Db::beginTransaction($db);
foreach ($feedbackItems as $feedbackItem) {
$data['position'] = $item['media_id'];
$feedbackCount = $db->fetchOne('
SELECT COUNT(*)
FROM xf_nixfifty_xentrader_feedback
WHERE to_user_id = ?
', $feedbackItem);
$db->update('xf_nixfifty_xentrader_user', array('total' => $feedbackCount), 'user_id = ' . $db->quote($feedbackItem));
}
XenForo_Db::commit($db);
$actionPhrase = new XenForo_Phrase('rebuilding');
$typePhrase = 'fam i think im broken';
//new XenForo_Phrase('xengallery_rebuild_thumbnails');
$status = sprintf('%s... %s (%s)', $actionPhrase, $typePhrase, XenForo_Locale::numberFormat($data['position']));
return $data;
}
开发者ID:melvingb,项目名称:XenForo-XenTrader,代码行数:29,代码来源:FeedbackCount.php
示例8: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$data = array_merge(array('position' => 0, 'batch' => 10), $data);
$data['batch'] = max(1, $data['batch']);
/* @var $albumModel XenGallery_Model_Album */
$albumModel = XenForo_Model::create('XenGallery_Model_Album');
/* @var $mediaModel XenGallery_Model_Media */
$mediaModel = XenForo_Model::create('XenGallery_Model_Media');
$albumIds = $albumModel->getAlbumIdsInRange($data['position'], $data['batch']);
if (sizeof($albumIds) == 0) {
return true;
}
foreach ($albumIds as $albumId) {
$data['position'] = $albumId;
$writer = XenForo_DataWriter::create('XenGallery_DataWriter_Album');
$writer->setExistingData($albumId);
if (!$writer->get('manual_media_cache') && !$writer->get('album_thumbnail_date')) {
$media = $mediaModel->getMediaForAlbumCache($albumId);
$writer->bulkSet(array('media_cache' => serialize($media)));
$writer->save();
}
}
$actionPhrase = new XenForo_Phrase('rebuilding');
$typePhrase = new XenForo_Phrase('xengallery_rebuild_album_thumbnails');
$status = sprintf('%s... %s (%s)', $actionPhrase, $typePhrase, XenForo_Locale::numberFormat($data['position']));
return $data;
}
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:27,代码来源:AlbumThumbnail.php
示例9: currencyFormat
/**
* Formats the given number for a currency.
*
* @param float|integer $number Number to format
* @param int|null $currencyId Currency to override default
*
* @return string Formatted number
*/
public static function currencyFormat($number = 0)
{
$currency = array('symbol_left' => '', 'symbol_right' => ' VNĐ', 'value' => 1, 'decimal_place' => 0);
$negative = false;
$formated = '';
if (is_numeric($number)) {
if ($number < 0) {
$negative = true;
$number *= -1;
}
$number *= $currency['value'];
$number = XenForo_Locale::numberFormat($number, $currency['decimal_place']);
} else {
$number = XenForo_Locale::numberFormat(0, $currency['decimal_place']);
}
$formated = $negative ? ' - ' : '';
if ($currency['symbol_left']) {
$formated .= $currency['symbol_left'];
}
$formated .= $number;
if ($currency['symbol_right']) {
$formated .= $currency['symbol_right'];
}
return $formated;
}
开发者ID:darkearl,项目名称:projectT122015,代码行数:33,代码来源:Currency.php
示例10: rebuild
/**
* Rebuilds the data.
*
* @see XenForo_CacheRebuilder_Abstract::rebuild()
*/
public function rebuild($position = 0, array &$options = array(), &$detailedMessage = '')
{
$options['batch'] = max(1, isset($options['batch']) ? $options['batch'] : 10);
$socialForumModel = ThemeHouse_SocialGroups_SocialForum::getSocialForumModel();
if ($position == 0) {
$socialForumModel->unlinkMovedThreads();
}
$socialForums = $socialForumModel->getSocialForums(array(), array('limit' => $options['batch'], 'offset' => $position));
XenForo_Db::beginTransaction();
foreach ($socialForums as $socialForum) {
$position++;
/* @var $socialForumDw ThemeHouse_SocialGroups_DataWriter_SocialForum */
$socialForumDw = XenForo_DataWriter::create('ThemeHouse_SocialGroups_DataWriter_SocialForum', XenForo_DataWriter::ERROR_SILENT);
if ($socialForumDw->setExistingData($socialForum, true)) {
$socialForumDw->rebuildCounters();
$socialForumDw->save();
}
}
XenForo_Db::commit();
$detailedMessage = XenForo_Locale::numberFormat($position);
if (!$socialForums) {
return true;
} else {
return $position;
}
}
开发者ID:AndroidOS,项目名称:SocialGroups,代码行数:31,代码来源:SocialForum.php
示例11: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$data = array_merge(array('position' => 0, 'batch' => 100), $data);
$data['batch'] = max(1, $data['batch']);
if ($data['position'] == 0) {
XenForo_Model::create('XenForo_Model_Node')->updateNestedSetInfo();
}
/* @var $forumModel XenForo_Model_Forum */
$forumModel = XenForo_Model::create('XenForo_Model_Forum');
$forums = $forumModel->getForums(array(), array('limit' => $data['batch'], 'offset' => $data['position']));
if (!$forums) {
return false;
}
foreach ($forums as $forum) {
$data['position']++;
$forumDw = XenForo_DataWriter::create('XenForo_DataWriter_Forum', XenForo_DataWriter::ERROR_SILENT);
if ($forumDw->setExistingData($forum, true)) {
$forumDw->rebuildCounters();
$forumDw->save();
}
}
$rbPhrase = new XenForo_Phrase('rebuilding');
$typePhrase = new XenForo_Phrase('forums');
$status = sprintf('%s... %s (%s)', $rbPhrase, $typePhrase, XenForo_Locale::numberFormat($data['position']));
return $data;
}
开发者ID:Sywooch,项目名称:forums,代码行数:26,代码来源:Forum.php
示例12: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$inputHandler = new XenForo_Input($data);
$input = $inputHandler->filter(array('batch' => XenForo_Input::UINT, 'start' => XenForo_Input::UINT, 'extra_data' => XenForo_Input::ARRAY_SIMPLE, 'delay' => XenForo_Input::UNUM, 'content_type' => XenForo_Input::STRING, 'delete_index' => XenForo_Input::UINT));
if ($input['delay'] >= 0.01) {
usleep($input['delay'] * 1000000);
}
/* @var $searchModel XenForo_Model_Search */
$searchModel = XenForo_Model::create('XenForo_Model_Search');
$searchContentTypes = $searchModel->getSearchContentTypes();
$extraData = $input['extra_data'];
if (!isset($extraData['content_types']) || !is_array($extraData['content_types'])) {
if ($input['content_type'] && isset($searchContentTypes[$input['content_type']])) {
$extraData['content_types'] = array($input['content_type']);
} else {
$extraData['content_types'] = array_keys($searchContentTypes);
}
}
if (empty($extraData['current_type'])) {
$extraData['current_type'] = array_shift($extraData['content_types']);
}
if (empty($extraData['type_start'])) {
$extraData['type_start'] = 0;
}
$originalExtraData = $extraData;
while (!isset($searchContentTypes[$extraData['current_type']])) {
if (!$extraData['content_types']) {
return false;
}
$extraData['current_type'] = array_shift($extraData['content_types']);
}
if ($input['delete_index']) {
$source = XenForo_Search_SourceHandler_Abstract::getDefaultSourceHandler();
$source->deleteIndex($input['content_type'] ? $input['content_type'] : null);
}
$dataHandler = false;
$searchHandler = $searchContentTypes[$extraData['current_type']];
if (class_exists($searchHandler)) {
$dataHandler = XenForo_Search_DataHandler_Abstract::create($searchHandler);
$indexer = new XenForo_Search_Indexer();
$indexer->setIsRebuild(true);
$nextStart = $dataHandler->rebuildIndex($indexer, $extraData['type_start'], $input['batch']);
$indexer->finalizeRebuildSet();
} else {
$nextStart = false;
}
if ($nextStart === false) {
// move on to next type
$extraData['current_type'] = '';
$extraData['type_start'] = 0;
} else {
$extraData['type_start'] = $nextStart;
}
$data = array('batch' => $input['batch'], 'start' => $input['start'] + 1, 'extra_data' => $extraData, 'delay' => $input['delay']);
$actionPhrase = new XenForo_Phrase('rebuilding');
$typePhrase = new XenForo_Phrase('search_index');
$text = $dataHandler ? $dataHandler->getSearchContentTypePhrase() : new XenForo_Phrase($originalExtraData['current_type']);
$status = sprintf('%s... %s (%s)', $actionPhrase, $typePhrase, "{$text} " . XenForo_Locale::numberFormat($originalExtraData['type_start']));
return $data;
}
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:60,代码来源:SearchIndex.php
示例13: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$data = array_merge(array('position' => 0, 'batch' => 10), $data);
$data['batch'] = max(1, $data['batch']);
/* @var $albumModel XenGallery_Model_Album */
$albumModel = XenForo_Model::create('XenGallery_Model_Album');
$albumIds = $albumModel->getSharedAlbumIdsInRange($data['position'], $data['batch']);
if (sizeof($albumIds) == 0) {
return true;
}
$db = XenForo_Application::getDb();
XenForo_Db::beginTransaction($db);
foreach ($albumIds as $albumId) {
$data['position'] = $albumId;
$album = $albumModel->getAlbumByIdSimple($albumId);
$bind = array($album['album_id'], $album['album_user_id']);
$ownerShared = $db->fetchOne('SELECT shared_user_id FROM xengallery_shared_map WHERE album_id = ? AND shared_user_id = ?', $bind);
if (!$ownerShared) {
$db->query('
INSERT IGNORE INTO xengallery_shared_map
(album_id, shared_user_id)
VALUES
(?, ?)
', $bind);
}
}
XenForo_Db::commit($db);
$actionPhrase = new XenForo_Phrase('rebuilding');
$typePhrase = new XenForo_Phrase('xengallery_album_permissions');
$status = sprintf('%s... %s (%s)', $actionPhrase, $typePhrase, XenForo_Locale::numberFormat($data['position']));
return $data;
}
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:32,代码来源:901000570.php
示例14: _getPaidContentItemAddEditResponse
/**
* Helper to get the paid content add/edit form controller response.
*
* @param array $paidContentItem
*
* @return XenForo_ControllerResponse_View
*/
protected function _getPaidContentItemAddEditResponse(array $paidContentItem)
{
$paidContentItem = $this->_getPaidContentModel()->preparePaidContent($paidContentItem);
$userGroups = $this->_getUserGroupModel()->getAllUserGroups();
if (!empty($paidContentItem['paid_content_id'])) {
$selUserGroupIds = explode(',', $paidContentItem['user_group_ids']);
if (in_array(-1, $selUserGroupIds)) {
$allUserGroups = true;
$selUserGroupIds = array_keys($userGroups);
} else {
$allUserGroups = false;
}
} else {
$allUserGroups = true;
$selUserGroupIds = array_keys($userGroups);
}
if (empty($paidContentItem['start_date'])) {
$paidContentItem['startDate'] = XenForo_Locale::date(XenForo_Application::$time, 'picker');
}
if (empty($paidContentItem['end_date'])) {
$startTime = !empty($paidContentItem['start_date']) ? $paidContentItem['start_date'] : XenForo_Application::$time;
$paidContentItem['endDate'] = XenForo_Locale::date($startTime + 7 * 24 * 60 * 60, 'picker');
}
$viewParams = array('paidContentItem' => $paidContentItem, 'allUserGroups' => $allUserGroups, 'selUserGroupIds' => $selUserGroupIds, 'userGroups' => $userGroups);
return $this->responseView('ThemeHouse_PayForContent_ViewAdmin_PaidContentItem_Edit', 'th_paid_content_item_edit_payforcontent', $viewParams);
}
开发者ID:ThemeHouse-XF,项目名称:PayForContent,代码行数:33,代码来源:PaidContent.php
示例15: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$data = array_merge(array('userId' => null, 'cutOff' => null, 'count' => 0, 'total' => null), $data);
if (!$data['userId'] || $data['cutOff'] === null) {
return false;
}
$s = microtime(true);
/* @var $editHistoryModel XenForo_Model_EditHistory */
$editHistoryModel = XenForo_Model::create('XenForo_Model_EditHistory');
$edits = $editHistoryModel->getEditHistoryByUserSinceDate($data['userId'], $data['cutOff']);
if (!$edits) {
return false;
}
if ($data['total'] === null) {
$data['total'] = count($edits);
}
$continue = false;
foreach ($edits as $edit) {
$editHistoryModel->revertToHistoryId($edit['edit_history_id']);
$data['count']++;
if ($targetRunTime && microtime(true) - $s > $targetRunTime) {
$continue = true;
break;
}
}
if (!$continue) {
return false;
}
$actionPhrase = new XenForo_Phrase('reverting_edits');
$status = sprintf('%s... %s (%s/$s)', $actionPhrase, XenForo_Locale::numberFormat($data['count']), XenForo_Locale::numberFormat($data['total']));
return $data;
}
开发者ID:Sywooch,项目名称:forums,代码行数:32,代码来源:UserRevertMessageEdit.php
示例16: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$data = array_merge(array('position' => 0, 'batch' => 70), $data);
$data['batch'] = max(1, $data['batch']);
/* @var $userModel XenForo_Model_User */
$userModel = XenForo_Model::create('XenForo_Model_User');
/* @var $conversationModel XenForo_Model_Conversation */
$conversationModel = XenForo_Model::create('XenForo_Model_Conversation');
$userIds = $userModel->getUserIdsInRange($data['position'], $data['batch']);
if (sizeof($userIds) == 0) {
return true;
}
foreach ($userIds as $userId) {
$data['position'] = $userId;
/* @var $userDw XenForo_DataWriter_User */
$userDw = XenForo_DataWriter::create('XenForo_DataWriter_User', XenForo_DataWriter::ERROR_SILENT);
if ($userDw->setExistingData($userId)) {
XenForo_Db::beginTransaction();
$userDw->set('alerts_unread', $userModel->getUnreadAlertsCount($userId));
$userDw->set('conversations_unread', $conversationModel->countUnreadConversationsForUser($userId));
$userDw->save();
$userDw->rebuildUserGroupRelations();
$userDw->rebuildPermissionCombinationId();
$userDw->rebuildDisplayStyleGroupId();
$userDw->rebuildCustomFields();
$userDw->rebuildIgnoreCache();
XenForo_Db::commit();
}
}
$actionPhrase = new XenForo_Phrase('rebuilding');
$typePhrase = new XenForo_Phrase('users');
$status = sprintf('%s... %s (%s)', $actionPhrase, $typePhrase, XenForo_Locale::numberFormat($data['position']));
return $data;
}
开发者ID:Sywooch,项目名称:forums,代码行数:34,代码来源:User.php
示例17: rebuild
/**
* Rebuilds the data.
*
* @see XenForo_CacheRebuilder_Abstract::rebuild()
*/
public function rebuild($position = 0, array &$options = array(), &$detailedMessage = '')
{
$options['batch'] = isset($options['batch']) ? $options['batch'] : 75;
$options['batch'] = max(1, $options['batch']);
/* @var $userModel XenForo_Model_User */
$userModel = XenForo_Model::create('XenForo_Model_User');
/* @var $conversationModel XenForo_Model_Conversation */
$conversationModel = XenForo_Model::create('XenForo_Model_Conversation');
$userIds = $userModel->getUserIdsInRange($position, $options['batch']);
if (sizeof($userIds) == 0) {
return true;
}
XenForo_Db::beginTransaction();
foreach ($userIds as $userId) {
$position = $userId;
/* @var $userDw XenForo_DataWriter_User */
$userDw = XenForo_DataWriter::create('XenForo_DataWriter_User', XenForo_DataWriter::ERROR_SILENT);
if ($userDw->setExistingData($userId)) {
$userDw->set('alerts_unread', $userModel->getUnreadAlertsCount($userId));
$userDw->set('conversations_unread', $conversationModel->countUnreadConversationsForUser($userId));
$userDw->save();
$userDw->rebuildUserGroupRelations();
$userDw->rebuildPermissionCombinationId();
$userDw->rebuildDisplayStyleGroupId();
$userDw->rebuildIdentities();
}
}
XenForo_Db::commit();
$detailedMessage = XenForo_Locale::numberFormat($position);
return $position;
}
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:36,代码来源:User.php
示例18: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$data = array_merge(array('position' => 0, 'batch' => 70), $data);
$data['batch'] = max(1, $data['batch']);
/* @var $userModel XenForo_Model_User */
$userModel = XenForo_Model::create('XenForo_Model_User');
/* @var $conversationModel XenForo_Model_Conversation */
$conversationModel = XenForo_Model::create('XenForo_Model_Conversation');
$userIds = $userModel->getUserIdsInRange($data['position'], $data['batch']);
if (sizeof($userIds) == 0) {
return true;
}
foreach ($userIds as $userId) {
$data['position'] = $userId;
$userWriter = XenForo_DataWriter::create('XenForo_DataWriter_User');
$userWriter->setExistingData($userId);
$user = $userWriter->getMergedData();
$leecherLevel = $userModel->calculateLeecherLevel($user);
if ($leecherLevel !== false) {
$userWriter->set('leecher_level_unknown', 0);
$userWriter->set('leecher_level', $leecherLevel);
} else {
$userWriter->set('leecher_level_unknown', 1);
$userWriter->set('leecher_level', 0);
}
$userWriter->set('leecher_level_last_check', XenForo_Application::$time);
$userWriter->save();
}
$actionPhrase = new XenForo_Phrase('rebuilding');
$typePhrase = new XenForo_Phrase('users');
$status = sprintf('%s... %s (%s)', $actionPhrase, $typePhrase, XenForo_Locale::numberFormat($data['position']));
return $data;
}
开发者ID:ThemeHouse-XF,项目名称:LeecherLevel,代码行数:33,代码来源:Calculate.php
示例19: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$data = array_merge(array('batch' => 10, 'position' => 0, 'positionRebuild' => false), $data);
/* @var sonnb_XenGallery_Model_Location $locationModel */
$locationModel = XenForo_Model::create('sonnb_XenGallery_Model_Location');
$locations = $locationModel->getLocationsWithoutCoordinate($data['position'], $data['batch']);
if (count($locations) < 1) {
return false;
}
$db = XenForo_Application::getDb();
/** @var sonnb_XenGallery_Model_Location $locationModel */
$locationModel = XenForo_Model::create('sonnb_XenGallery_Model_Location');
foreach ($locations as $locationId => $location) {
$data['position'] = $location['location_id'];
try {
$client = XenForo_Helper_Http::getClient($locationModel->getGeocodeUrlForAddress($location['location_name']));
$response = $client->request('GET');
$response = @json_decode($response->getBody(), true);
if (empty($response['results'][0])) {
continue;
}
$address = $response['results'][0]['formatted_address'];
$lat = $response['results'][0]['geometry']['location']['lat'];
$lng = $response['results'][0]['geometry']['location']['lng'];
$db->update('sonnb_xengallery_location', array('location_name' => $address, 'location_lat' => $lat, 'location_lng' => $lng), array('location_id = ?' => $location['location_id']));
} catch (Exception $e) {
continue;
}
}
$actionPhrase = new XenForo_Phrase('rebuilding');
$typePhrase = new XenForo_Phrase('sonnb_xengallery_location');
$status = sprintf('%s... %s (%s)', $actionPhrase, $typePhrase, XenForo_Locale::numberFormat($data['position']));
return $data;
}
开发者ID:Sywooch,项目名称:forums,代码行数:34,代码来源:Location.php
示例20: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$data = array_merge(array('tagId' => null, 'position' => 0, 'deleteFirst' => false), $data);
if (!$data['tagId']) {
return false;
}
$db = XenForo_Application::getDb();
$matches = $db->fetchAll("\r\n\t\t\tSELECT tag_content_id, content_type, content_id\r\n\t\t\tFROM xf_tag_content\r\n\t\t\tWHERE tag_id = ?\r\n\t\t\t\tAND tag_content_id > ?\r\n\t\t\tORDER BY tag_content_id\r\n\t\t\tLIMIT 1000\r\n\t\t", array($data['tagId'], $data['position']));
if (!$matches) {
return false;
}
/** @var XenForo_Model_Tag $tagModel */
$tagModel = XenForo_Model::create('XenForo_Model_Tag');
XenForo_Db::beginTransaction($db);
$limitTime = $targetRunTime > 0;
$s = microtime(true);
foreach ($matches as $match) {
$data['position'] = $match['tag_content_id'];
if ($data['deleteFirst']) {
$db->delete('xf_tag_content', 'tag_content_id = ' . $match['tag_content_id']);
}
$tagModel->rebuildTagCache($match['content_type'], $match['content_id']);
if ($limitTime && microtime(true) - $s >= $targetRunTime) {
break;
}
}
XenForo_Db::commit($db);
$actionPhrase = new XenForo_Phrase('rebuilding');
$typePhrase = new XenForo_Phrase('tags');
$status = sprintf('%s... %s (%s)', $actionPhrase, $typePhrase, XenForo_Locale::numberFormat($data['position']));
return $data;
}
开发者ID:darkearl,项目名称:projectT122015,代码行数:32,代码来源:TagRecache.php
注:本文中的XenForo_Locale类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论