本文整理汇总了PHP中wfProfileIn函数的典型用法代码示例。如果您正苦于以下问题:PHP wfProfileIn函数的具体用法?PHP wfProfileIn怎么用?PHP wfProfileIn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfProfileIn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
/**
* Finds search suggestions phrases for chosen query
*
* @requestParam string $query search term for suggestions
*
* @responseParam array $items The list of phrases matching the query
*
* @example &query=los
*/
public function getList()
{
wfProfileIn(__METHOD__);
if (!empty($this->wg->EnableLinkSuggestExt)) {
$query = trim($this->request->getVal(self::PARAMETER_QUERY, null));
if (empty($query)) {
throw new MissingParameterApiException(self::PARAMETER_QUERY);
}
$request = new WebRequest();
$request->setVal('format', 'array');
$linkSuggestions = LinkSuggest::getLinkSuggest($request);
if (!empty($linkSuggestions)) {
foreach ($linkSuggestions as $suggestion) {
$searchSuggestions[]['title'] = $suggestion;
}
$this->response->setVal('items', $searchSuggestions);
} else {
throw new NotFoundApiException();
}
$this->response->setCacheValidity(WikiaResponse::CACHE_STANDARD);
} else {
throw new NotFoundApiException('Link Suggest extension not available');
}
wfProfileOut(__METHOD__);
}
示例2: parseCode
public function parseCode($code)
{
global $parserMemc;
static $parserCache;
// Unserializing can be expensive as well
wfProfileIn(__METHOD__);
$code = trim($code);
$memcKey = 'isparser:ast:' . md5($code);
if (isset($parserCache[$memcKey])) {
wfProfileOut(__METHOD__);
return $parserCache[$memcKey];
}
$cached = $parserMemc->get($memcKey);
if (@$cached instanceof ISParserOutput && !$cached->isOutOfDate()) {
$cached->appendTokenCount($this);
$parserCache[$memcKey] = $cached->getParserTree();
wfProfileOut(__METHOD__);
return $cached->getParserTree();
}
$scanner = new ISScanner($code);
$out = $this->mCodeParser->parse($scanner, $this->getMaxTokensLeft());
$out->appendTokenCount($this);
$parserMemc->set($memcKey, $out);
$parserCache[$memcKey] = $out->getParserTree();
wfProfileOut(__METHOD__);
return $out->getParserTree();
}
示例3: getListTitles
/**
* Get list of Title objects representing existing boards
*
* @author Władysław Bodzek <wladek@wikia-inc.com>
*
* @return array List of board IDs
*/
public function getListTitles($db = DB_SLAVE, $namespace = NS_USER_WALL)
{
wfProfileIn(__METHOD__);
$titles = TitleBatch::newFromConds('page_wikia_props', array('page.page_namespace' => $namespace, 'page_wikia_props.page_id = page.page_id'), __METHOD__, array('ORDER BY' => 'page_title'), $db);
wfProfileOut(__METHOD__);
return $titles;
}
示例4: NotifyOnSubPageChange
/**
* Adds users to watchlist if:
* - User is watching parent page
* - User has 'watchlistsubpages' turned on
*
* @param $watchers array of user ID
* @param $title Title object
* @param $editor User object
* @param $notificationTimeoutSql string timeout to the watchlist
*
* @author Jakub Kurcek <jakub@wikia-inc.com>
*/
public static function NotifyOnSubPageChange($watchers, $title, $editor, $notificationTimeoutSql)
{
wfProfileIn(__METHOD__);
// Gets parent data
$arrTitle = explode('/', $title->getDBkey());
if (empty($arrTitle)) {
wfProfileOut(__METHOD__);
return true;
}
// make Title
$t = reset($arrTitle);
$newTitle = Title::newFromDBkey($t);
if (!$newTitle instanceof Title) {
return true;
}
$dbw = wfGetDB(DB_MASTER);
/** @var $dbw Database */
$res = $dbw->select(array('watchlist'), array('wl_user'), array('wl_title' => $newTitle->getDBkey(), 'wl_namespace' => $newTitle->getNamespace(), 'wl_user != ' . intval($editor->getID()), $notificationTimeoutSql), __METHOD__);
// Gets user settings
$parentpageWatchers = array();
while ($row = $dbw->fetchObject($res)) {
$userId = intval($row->wl_user);
$tmpUser = User::newFromId($userId);
if ($tmpUser->getBoolOption(self::PREFERENCES_ENTRY)) {
$parentpageWatchers[] = $userId;
}
unset($tmpUser);
}
// Updates parent watchlist timestamp for $parentOnlyWatchers.
$parentOnlyWatchers = array_diff($parentpageWatchers, $watchers);
$wl = WatchedItem::fromUserTitle($editor, $newTitle);
$wl->updateWatch($parentOnlyWatchers);
wfProfileOut(__METHOD__);
return true;
}
示例5: filterImages
protected function filterImages($imagesList = array())
{
wfProfileIn(__METHOD__);
# get image names from imagelinks table
$imagesName = array_keys($imagesList);
if (!empty($imagesName)) {
foreach ($imagesName as $img_name) {
$result = $this->db->select(array('imagelinks'), array('il_from'), array('il_to' => $img_name), __METHOD__, array('LIMIT' => $this->maxCount + 1));
#something goes wrong
if (empty($result)) {
continue;
}
# skip images which are too popular
if ($result->numRows() > $this->maxCount) {
continue;
}
# check image table
$oRowImg = $this->db->selectRow(array('image'), array('img_name', 'img_height', 'img_width', 'img_minor_mime'), array('img_name' => $img_name), __METHOD__);
if (empty($oRowImg)) {
continue;
}
if ($oRowImg->img_height > $this->minSize && $oRowImg->img_width > $this->minSize) {
if (!in_array($oRowImg->img_minor_mime, array("svg+xml", "svg"))) {
$this->addToFiltredList($oRowImg->img_name, $result->numRows(), $oRowImg->img_width, $oRowImg->img_height, $oRowImg->img_minor_mime);
}
}
}
}
wfProfileOut(__METHOD__);
}
示例6: view
/**
* Render Quiz namespace page
*/
public function view()
{
global $wgOut, $wgUser, $wgTitle, $wgRequest;
wfProfileIn(__METHOD__);
// let MW handle basic stuff
parent::view();
// don't override history pages
$action = $wgRequest->getVal('action');
if (in_array($action, array('history', 'historysubmit'))) {
wfProfileOut(__METHOD__);
return;
}
// quiz doesn't exist
if (!$wgTitle->exists() || empty($this->mQuiz)) {
wfProfileOut(__METHOD__);
return;
}
// set page title
$title = $this->mQuiz->getTitle();
$wgOut->setPageTitle($title);
// add CSS/JS
$wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/WikiaQuiz/css/WikiaQuizBuilder.scss'));
// render quiz page
$wgOut->clearHTML();
$wgOut->addHTML($this->mQuiz->render());
wfProfileOut(__METHOD__);
}
示例7: processHit
/**
* Records a hit and enforces rate limits unless that is explicitly disabled in the call (see 'enforceRateLimits' param).
*
* @param apiKey - string - the API key of the app that made the request we are now logging
* @param method - string - the method-name that was called in this request (should include class-name if appropriate - eg: 'MyClass::myMethod').
* @param timestamp - int - number of seconds since the unix epoch at the time that this hit was made.
* @param params - array - array of key-value pairs of the parameters that were passed into the method
* @param enforceRateLimits - boolean - optional (default:true) - if true, then this function will check rate-limits after logging, and ban the apiKey if
* it has surpassed any of its rate-limits.
*/
public function processHit($apiKey, $method, $timestamp, $params, $enforceRateLimits = true)
{
wfProfileIn(__METHOD__);
// TODO: IMPLEMENT
// TODO: IMPLEMENT
wfProfileOut(__METHOD__);
}
示例8: getBadge
public static function getBadge($badgeTypeId)
{
wfProfileIn(__METHOD__);
global $wgExternalSharedDB;
global $wgEnableAchievementsStoreLocalData;
$badges = array();
if (empty($wgEnableAchievementsStoreLocalData)) {
$dbr = wfGetDB(DB_SLAVE, array(), $wgExternalSharedDB);
} else {
$dbr = wfGetDB(DB_SLAVE);
}
$res = $dbr->select('ach_custom_badges', array('id', 'enabled', 'sponsored', 'badge_tracking_url', 'hover_tracking_url', 'click_tracking_url'), array('id' => $badgeTypeId), __METHOD__);
if ($row = $dbr->fetchObject($res)) {
$badge = array();
$image = wfFindFile(AchConfig::getInstance()->getBadgePictureName($row->id));
if ($image) {
$hoverImage = wfFindFile(AchConfig::getInstance()->getHoverPictureName($row->id));
$badge['type_id'] = $row->id;
$badge['enabled'] = $row->enabled;
$badge['thumb_url'] = $image->createThumb(90);
$badge['awarded_users'] = AchPlatinumService::getAwardedUserNames($row->id);
$badge['is_sponsored'] = $row->sponsored;
$badge['badge_tracking_url'] = $row->badge_tracking_url;
$badge['hover_tracking_url'] = $row->hover_tracking_url;
$badge['click_tracking_url'] = $row->click_tracking_url;
$badge['hover_content_url'] = is_object($hoverImage) ? wfReplaceImageServer($hoverImage->getFullUrl()) : null;
wfProfileOut(__METHOD__);
return $badge;
}
}
wfProfileOut(__METHOD__);
return false;
}
示例9: onArticleSaveComplete
public static function onArticleSaveComplete($article, $user, $revision, $status)
{
wfProfileIn(__METHOD__);
$insertedImages = Wikia::getVar('imageInserts');
$imageDeletes = Wikia::getVar('imageDeletes');
$changedImages = $imageDeletes;
foreach ($insertedImages as $img) {
$changedImages[$img['il_to']] = true;
}
$sendTrackEvent = false;
foreach ($changedImages as $imageDBName => $dummy) {
$title = Title::newFromDBkey($imageDBName);
if (!empty($title)) {
$mq = new self($title);
$mq->unsetCache();
$sendTrackEvent = true;
}
}
// send track event if embed change
if ($sendTrackEvent) {
Track::event('embed_change');
}
wfProfileOut(__METHOD__);
return true;
}
示例10: ActivityFeedTag_render
function ActivityFeedTag_render($content, $attributes, $parser, $frame)
{
global $wgExtensionsPath, $wgEnableAchievementsInActivityFeed, $wgEnableAchievementsExt;
if (!class_exists('ActivityFeedHelper')) {
return '';
}
wfProfileIn(__METHOD__);
$parameters = ActivityFeedHelper::parseParameters($attributes);
$tagid = str_replace('.', '_', uniqid('activitytag_', true));
//jQuery might have a problem with . in ID
$jsParams = "size={$parameters['maxElements']}";
if (!empty($parameters['includeNamespaces'])) {
$jsParams .= "&ns={$parameters['includeNamespaces']}";
}
if (!empty($parameters['flags'])) {
$jsParams .= '&flags=' . implode('|', $parameters['flags']);
}
$parameters['tagid'] = $tagid;
$feedHTML = ActivityFeedHelper::getList($parameters);
$style = empty($parameters['style']) ? '' : ' style="' . $parameters['style'] . '"';
$timestamp = wfTimestampNow();
$snippetsDependencies = array('/extensions/wikia/MyHome/ActivityFeedTag.js', '/extensions/wikia/MyHome/ActivityFeedTag.css');
if (!empty($wgEnableAchievementsInActivityFeed) && !empty($wgEnableAchievementsExt)) {
array_push($snippetsDependencies, '/extensions/wikia/AchievementsII/css/achievements_sidebar.css');
}
$snippets = F::build('JSSnippets')->addToStack($snippetsDependencies, null, 'ActivityFeedTag.initActivityTag', array('tagid' => $tagid, 'jsParams' => $jsParams, 'timestamp' => $timestamp));
wfProfileOut(__METHOD__);
return "<div{$style}>{$feedHTML}</div>{$snippets}";
}
示例11: onOutputPageBeforeHTML
/**
* Load JS needed to display the VideosModule at the bottom of the article content
* @param OutputPage $out
* @param string $text
* @return bool
*/
public static function onOutputPageBeforeHTML(OutputPage $out, &$text)
{
wfProfileIn(__METHOD__);
// Check if we're on a page where we want to show the Videos Module.
// If we're not, stop right here.
if (!self::canShowVideosModule()) {
wfProfileOut(__METHOD__);
return true;
}
// On file pages, this hook can be called multiple times, so we're going to check if the
// assets are loaded already before we load them again.
$app = F::app();
// Don't do anything if we've already loaded the assets
if ($app->wg->VideosModuleAssetsLoaded) {
wfProfileOut(__METHOD__);
return true;
}
// Don't do anything if this is the main page of a site with the VPT enabled
if ($app->wg->Title->isMainPage() && $app->wg->EnableVideoPageToolExt) {
wfProfileOut(__METHOD__);
return true;
}
JSMessages::enqueuePackage('VideosModule', JSMessages::EXTERNAL);
if ($app->checkSkin('venus')) {
Wikia::addAssetsToOutput('videos_module_venus_js');
Wikia::addAssetsToOutput('videos_module_venus_scss');
} else {
Wikia::addAssetsToOutput('videos_module_js');
}
$app->wg->VideosModuleAssetsLoaded = true;
wfProfileOut(__METHOD__);
return true;
}
示例12: replaceSection
/**
* @see Content::replaceSection()
*/
public function replaceSection($section, Content $with, $sectionTitle = '')
{
wfProfileIn(__METHOD__);
$myModelId = $this->getModel();
$sectionModelId = $with->getModel();
if ($sectionModelId != $myModelId) {
wfProfileOut(__METHOD__);
throw new MWException("Incompatible content model for section: " . "document uses {$myModelId} but " . "section uses {$sectionModelId}.");
}
$oldtext = $this->getNativeData();
$text = $with->getNativeData();
if ($section === '') {
wfProfileOut(__METHOD__);
return $with;
# XXX: copy first?
}
if ($section == 'new') {
# Inserting a new section
$subject = $sectionTitle ? wfMessage('newsectionheaderdefaultlevel')->rawParams($sectionTitle)->inContentLanguage()->text() . "\n\n" : '';
if (wfRunHooks('PlaceNewSection', array($this, $oldtext, $subject, &$text))) {
$text = strlen(trim($oldtext)) > 0 ? "{$oldtext}\n\n{$subject}{$text}" : "{$subject}{$text}";
}
} else {
# Replacing an existing section; roll out the big guns
global $wgParser;
$text = $wgParser->replaceSection($oldtext, $section, $text);
}
$newContent = new WikitextContent($text);
wfProfileOut(__METHOD__);
return $newContent;
}
示例13: executeButton
/**
* Execute function for generating view of Button template
* Sets params' values of template
* @param $params array of params described below
* @param $params['link_url'] string Full link to some destination (mandatory)
* @param $params['link_text'] string Description showed on a button
*/
public function executeButton($params)
{
wfProfileIn(__METHOD__);
$this->link_url = $params['link_url'];
$this->link_text = array_key_exists('link_text', $params) ? $params['link_text'] : $this->link_url;
wfProfileOut(__METHOD__);
}
示例14: index
public function index()
{
wfProfileIn(__METHOD__);
$socialSharingService = SocialSharingService::getInstance();
$this->setVal('networks', $socialSharingService->getNetworks(array('facebook', 'twitter', 'plusone', 'email')));
wfProfileOut(__METHOD__);
}
示例15: collect
protected function collect()
{
global $wgHitcounterUpdateFreq;
$dbw = wfGetDB(DB_MASTER);
$rown = $dbw->selectField('hitcounter', 'COUNT(*)', array(), __METHOD__);
if ($rown < $wgHitcounterUpdateFreq) {
return;
}
wfProfileIn(__METHOD__ . '-collect');
$old_user_abort = ignore_user_abort(true);
$dbw->lockTables(array(), array('hitcounter'), __METHOD__, false);
$dbType = $dbw->getType();
$tabletype = $dbType == 'mysql' ? "ENGINE=HEAP " : '';
$hitcounterTable = $dbw->tableName('hitcounter');
$acchitsTable = $dbw->tableName('acchits');
$pageTable = $dbw->tableName('page');
$dbw->query("CREATE TEMPORARY TABLE {$acchitsTable} {$tabletype} AS " . "SELECT hc_id,COUNT(*) AS hc_n FROM {$hitcounterTable} " . 'GROUP BY hc_id', __METHOD__);
$dbw->delete('hitcounter', '*', __METHOD__);
$dbw->unlockTables(__METHOD__);
if ($dbType == 'mysql') {
$dbw->query("UPDATE {$pageTable},{$acchitsTable} SET page_counter=page_counter + hc_n " . 'WHERE page_id = hc_id', __METHOD__);
} else {
$dbw->query("UPDATE {$pageTable} SET page_counter=page_counter + hc_n " . "FROM {$acchitsTable} WHERE page_id = hc_id", __METHOD__);
}
$dbw->query("DROP TABLE {$acchitsTable}", __METHOD__);
ignore_user_abort($old_user_abort);
wfProfileOut(__METHOD__ . '-collect');
}