当前位置: 首页>>代码示例>>PHP>>正文


PHP KunenaForumCategoryHelper::fixAliases方法代码示例

本文整理汇总了PHP中KunenaForumCategoryHelper::fixAliases方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaForumCategoryHelper::fixAliases方法的具体用法?PHP KunenaForumCategoryHelper::fixAliases怎么用?PHP KunenaForumCategoryHelper::fixAliases使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KunenaForumCategoryHelper的用法示例。


在下文中一共展示了KunenaForumCategoryHelper::fixAliases方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: stepFinish

 public function stepFinish()
 {
     KunenaForum::setup();
     $entryfiles = array(array(KPATH_ADMIN, 'api', 'php'), array(KPATH_ADMIN, 'admin.kunena', 'php'), array(KPATH_SITE, 'router', 'php'), array(KPATH_SITE, 'kunena', 'php'));
     $lang = JFactory::getLanguage();
     $lang->load('com_kunena', JPATH_SITE) || $lang->load('com_kunena', KPATH_SITE);
     $this->createMenu(false);
     // Fix broken category aliases (workaround for < 2.0-DEV12 bug)
     $count = KunenaForumCategoryHelper::fixAliases();
     $md5 = md5_file(KPATH_ADMIN . '/api.new.php');
     foreach ($entryfiles as $fileparts) {
         list($path, $filename, $ext) = $fileparts;
         if (is_file("{$path}/{$filename}.new.{$ext}")) {
             $success = JFile::delete("{$path}/{$filename}.{$ext}");
             if (!$success) {
                 $this->addStatus(JText::_('COM_KUNENA_INSTALL_DELETE_STATUS_FAIL') . " {$filename}.{$ext}", false, '');
             }
             $success = JFile::move("{$path}/{$filename}.new.{$ext}", "{$path}/{$filename}.{$ext}");
             if (!$success) {
                 $this->addStatus(JText::_('COM_KUNENA_INSTALL_RENAMING_FAIL') . " {$filename}.new.{$ext}", false, '');
             }
         }
     }
     // Clean cache, just in case
     KunenaMenuHelper::cleanCache();
     JFactory::getCache('com_kunena')->clean();
     // Test if api file has been fully copied
     $this->waitFile(KPATH_ADMIN . "/api.php", $md5);
     if (!$this->getInstallError()) {
         $this->updateVersionState('');
         $this->addStatus(JText::_('COM_KUNENA_INSTALL_SUCCESS'), true, '');
         $this->setStep($this->getStep() + 1);
     }
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:34,代码来源:model.php

示例2: stepFinish

 public function stepFinish()
 {
     KunenaForum::setup();
     $lang = JFactory::getLanguage();
     $lang->load('com_kunena', JPATH_SITE) || $lang->load('com_kunena', KUNENA_INSTALLER_SITEPATH);
     $this->createMenu(false);
     // Fix broken category aliases (workaround for < 2.0-DEV12 bug)
     KunenaForumCategoryHelper::fixAliases();
     // Clean cache, just in case
     KunenaMenuHelper::cleanCache();
     /** @var JCache|JCacheController $cache */
     $cache = JFactory::getCache();
     $cache->clean('com_kunena');
     // Delete installer file (only if not using GIT build).
     if (!KunenaForum::isDev()) {
         JFile::delete(KPATH_ADMIN . '/install.php');
     }
     if (!$this->getInstallError()) {
         $this->updateVersionState('');
         $this->addStatus(JText::_('COM_KUNENA_INSTALL_SUCCESS'), true, '');
         $this->setStep($this->getStep() + 1);
     }
 }
开发者ID:sillysachin,项目名称:teamtogether,代码行数:23,代码来源:model.php

示例3: dorecount

 /**
  * Perform recount on statistics in smaller chunks.
  *
  * @return void
  * @throws Exception
  */
 public function dorecount()
 {
     $ajax = $this->input->getWord('format', 'html') == 'json';
     if (!JSession::checkToken('request')) {
         $this->setResponse(array('success' => false, 'header' => JText::_('COM_KUNENA_AJAX_ERROR'), 'message' => JText::_('COM_KUNENA_AJAX_DETAILS_BELOW'), 'error' => JText::_('COM_KUNENA_ERROR_TOKEN')), $ajax);
         $this->setRedirect(KunenaRoute::_($this->baseurl, false));
         return;
     }
     $state = $this->app->getUserState('com_kunena.admin.recount', null);
     try {
         $this->checkTimeout();
         while (1) {
             // Topic count per run.
             // TODO: count isn't accurate as it can overflow total.
             $count = mt_rand(4500, 5500);
             switch ($state->step) {
                 case 0:
                     if ($state->topics) {
                         // Update topic statistics
                         KunenaForumTopicHelper::recount(false, $state->start, $state->start + $count);
                         $state->start += $count;
                         $msg = JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_TOPICS_X', round(min(100 * $state->start / $state->maxId + 1, 100)) . '%');
                     }
                     break;
                 case 1:
                     if ($state->usertopics) {
                         // Update user's topic statistics
                         KunenaForumTopicUserHelper::recount(false, $state->start, $state->start + $count);
                         $state->start += $count;
                         $msg = JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_USERTOPICS_X', round(min(100 * $state->start / $state->maxId + 1, 100)) . '%');
                     }
                     break;
                 case 2:
                     if ($state->categories) {
                         // Update category statistics
                         KunenaForumCategoryHelper::recount();
                         KunenaForumCategoryHelper::fixAliases();
                         $msg = JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_CATEGORIES_X', '100%');
                     }
                     break;
                 case 3:
                     if ($state->users) {
                         // Update user statistics
                         KunenaUserHelper::recount();
                         $msg = JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_USERS_X', '100%');
                     }
                     break;
                 case 4:
                     if ($state->polls) {
                         // Update user statistics
                         KunenaForumTopicPollHelper::recount();
                         $msg = JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_POLLS_X', '100%');
                     }
                     break;
                 default:
                     $header = JText::_('COM_KUNENA_RECOUNTFORUMS_DONE');
                     $msg = JText::_('COM_KUNENA_AJAX_REQUESTED_RECOUNTED');
                     $this->app->setUserState('com_kunena.admin.recount', null);
                     $this->setResponse(array('success' => true, 'status' => '100%', 'header' => $header, 'message' => $msg), $ajax);
                     $this->setRedirect(KunenaRoute::_($this->baseurl, false), $header);
                     return;
             }
             $state->current = min($state->current + $count, $state->total);
             if (!$state->start || $state->start > $state->maxId) {
                 $state->step++;
                 $state->start = 0;
             }
             if ($this->checkTimeout()) {
                 break;
             }
         }
         $state->reload++;
         $this->app->setUserState('com_kunena.admin.recount', $state);
     } catch (Exception $e) {
         if (!$ajax) {
             throw $e;
         }
         $this->setResponse(array('success' => false, 'status' => sprintf("%2.1f%%", 99 * $state->current / ($state->total + 1)), 'header' => JText::_('COM_KUNENA_AJAX_ERROR'), 'message' => JText::_('COM_KUNENA_AJAX_DETAILS_BELOW'), 'error' => $e->getMessage()), $ajax);
     }
     $token = JSession::getFormToken() . '=1';
     $redirect = KunenaRoute::_("{$this->baseurl}&task=dorecount&i={$state->reload}&{$token}", false);
     $this->setResponse(array('success' => true, 'status' => sprintf("%2.1f%%", 99 * $state->current / ($state->total + 1)), 'header' => JText::_('COM_KUNENA_AJAX_RECOUNT_WAIT'), 'message' => $msg, 'href' => $redirect), $ajax);
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:89,代码来源:tools.php

示例4: recount

 function recount()
 {
     $state = $this->app->getUserState('com_kunena.admin.recount', null);
     if ($state === null) {
         // First run: get last message id (if topics were created with <K2.0)
         $query = "SELECT MAX(id) FROM #__kunena_messages";
         $db = JFactory::getDBO();
         $db->setQuery($query);
         $state = new StdClass();
         $state->step = 0;
         $state->maxId = (int) $db->loadResult();
         $state->start = 0;
         $state->reload = 0;
         $state->topics = JRequest::getBool('topics', false);
         $state->usertopics = JRequest::getBool('usertopics', false);
         $state->categories = JRequest::getBool('categories', false);
         $state->users = JRequest::getBool('users', false);
     }
     $this->checkTimeout();
     while (1) {
         $count = mt_rand(4500, 5500);
         switch ($state->step) {
             case 0:
                 if ($state->topics) {
                     // Update topic statistics
                     KunenaForumTopicHelper::recount(false, $state->start, $state->start + $count);
                     $state->start += $count;
                     //$this->app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_TOPICS', min($state->start, $state->maxId), $state->maxId) );
                 }
                 break;
             case 1:
                 if ($state->usertopics) {
                     // Update usertopic statistics
                     KunenaForumTopicUserHelper::recount(false, $state->start, $state->start + $count);
                     $state->start += $count;
                     //$this->app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_USERTOPICS', min($state->start, $state->maxId), $state->maxId) );
                 }
                 break;
             case 2:
                 if ($state->categories) {
                     // Update category statistics
                     KunenaForumCategoryHelper::recount();
                     KunenaForumCategoryHelper::fixAliases();
                     //$this->app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_CATEGORY') );
                 }
                 break;
             case 3:
                 if ($state->users) {
                     // Update user statistics
                     KunenaUserHelper::recount();
                     //$this->app->enqueueMessage ( JText::sprintf('COM_KUNENA_ADMIN_RECOUNT_USER') );
                 }
                 break;
             default:
                 $this->app->setUserState('com_kunena.admin.recount', null);
                 $this->app->enqueueMessage(JText::_('COM_KUNENA_RECOUNTFORUMS_DONE'));
                 $this->setRedirect(KunenaRoute::_($this->baseurl, false));
                 return;
         }
         if (!$state->start || $state->start > $state->maxId) {
             $state->step++;
             $state->start = 0;
         }
         if ($this->checkTimeout()) {
             break;
         }
     }
     $state->reload++;
     $this->app->setUserState('com_kunena.admin.recount', $state);
     $this->setRedirect(KunenaRoute::_("{$this->baseurl}&task=recount&i={$state->reload}", false));
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:71,代码来源:tools.php


注:本文中的KunenaForumCategoryHelper::fixAliases方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。