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


PHP Piwik::setUserIsSuperUser方法代码示例

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


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

示例1: update

 static function update($schema = 'Myisam')
 {
     // force regeneration of cache files following #648
     Piwik::setUserIsSuperUser();
     $allSiteIds = API::getInstance()->getAllSitesId();
     Cache::regenerateCacheWebsiteAttributes($allSiteIds);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:7,代码来源:0.2.34.php

示例2: getCacheWebsiteAttributes

 /**
  * Returns array containing data about the website: goals, URLs, etc.
  *
  * @param int $idSite
  * @return array
  */
 static function getCacheWebsiteAttributes($idSite)
 {
     if ($idSite == 'all') {
         return array();
     }
     $idSite = (int) $idSite;
     if ($idSite <= 0) {
         return array();
     }
     $cache = self::getInstance();
     if (($cacheContent = $cache->get($idSite)) !== false) {
         return $cacheContent;
     }
     Tracker::initCorePiwikInTrackerMode();
     // save current user privilege and temporarily assume super user privilege
     $isSuperUser = Piwik::isUserIsSuperUser();
     Piwik::setUserIsSuperUser();
     $content = array();
     /**
      * Triggered to get the attributes of a site entity that might be used by the
      * Tracker.
      * 
      * Plugins add new site attributes for use in other tracking events must
      * use this event to put those attributes in the Tracker Cache.
      * 
      * **Example**
      * 
      *     public function getSiteAttributes($content, $idSite)
      *     {
      *         $sql = "SELECT info FROM " . Common::prefixTable('myplugin_extra_site_info') . " WHERE idsite = ?";
      *         $content['myplugin_site_data'] = Db::fetchOne($sql, array($idSite));
      *     }
      * 
      * @param array &$content Array mapping of site attribute names with values.
      * @param int $idSite The site ID to get attributes for.
      */
     Piwik::postEvent('Tracker.Cache.getSiteAttributes', array(&$content, $idSite));
     // restore original user privilege
     Piwik::setUserIsSuperUser($isSuperUser);
     // if nothing is returned from the plugins, we don't save the content
     // this is not expected: all websites are expected to have at least one URL
     if (!empty($content)) {
         $cache->set($idSite, $content);
     }
     return $content;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:52,代码来源:Cache.php

示例3: update

 static function update()
 {
     $obsoleteFiles = array(PIWIK_INCLUDE_PATH . '/core/Db/Mysqli.php');
     foreach ($obsoleteFiles as $obsoleteFile) {
         if (file_exists($obsoleteFile)) {
             @unlink($obsoleteFile);
         }
     }
     $obsoleteDirectories = array(PIWIK_INCLUDE_PATH . '/core/Db/Pdo');
     foreach ($obsoleteDirectories as $dir) {
         if (file_exists($dir)) {
             Filesystem::unlinkRecursive($dir, true);
         }
     }
     // force regeneration of cache files
     Piwik::setUserIsSuperUser();
     $allSiteIds = API::getInstance()->getAllSitesId();
     Cache::regenerateCacheWebsiteAttributes($allSiteIds);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:19,代码来源:0.6.2.php

示例4: getUserInformation

 /**
  * Get user information
  *
  * @param string $loginMail user login or email address
  * @return array ("login" => '...', "email" => '...', "password" => '...') or null, if user not found
  */
 protected function getUserInformation($loginMail)
 {
     Piwik::setUserIsSuperUser();
     $user = null;
     if ($loginMail == Piwik::getSuperUserEmail() || $loginMail == Config::getInstance()->superuser['login']) {
         $user = array('login' => Config::getInstance()->superuser['login'], 'email' => Piwik::getSuperUserEmail(), 'password' => Config::getInstance()->superuser['password']);
     } else {
         if (API::getInstance()->userExists($loginMail)) {
             $user = API::getInstance()->getUser($loginMail);
         } else {
             if (API::getInstance()->userEmailExists($loginMail)) {
                 $user = API::getInstance()->getUserByEmail($loginMail);
             }
         }
     }
     return $user;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:23,代码来源:Controller.php

示例5: runScheduledTasks

 /**
  * Tracker requests will automatically trigger the Scheduled tasks.
  * This is useful for users who don't setup the cron,
  * but still want daily/weekly/monthly PDF reports emailed automatically.
  *
  * This is similar to calling the API CoreAdminHome.runScheduledTasks (see misc/cron/archive.php)
  */
 protected static function runScheduledTasks()
 {
     $now = time();
     // Currently, there are no hourly tasks. When there are some,
     // this could be too aggressive minimum interval (some hours would be skipped in case of low traffic)
     $minimumInterval = Config::getInstance()->Tracker['scheduled_tasks_min_interval'];
     // If the user disabled browser archiving, he has already setup a cron
     // To avoid parallel requests triggering the Scheduled Tasks,
     // Get last time tasks started executing
     $cache = Cache::getCacheGeneral();
     if ($minimumInterval <= 0 || empty($cache['isBrowserTriggerArchivingEnabled'])) {
         Common::printDebug("-> Scheduled tasks not running in Tracker: Browser archiving is disabled.");
         return;
     }
     $nextRunTime = $cache['lastTrackerCronRun'] + $minimumInterval;
     if (isset($GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS']) && $GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS'] || $cache['lastTrackerCronRun'] === false || $nextRunTime < $now) {
         $cache['lastTrackerCronRun'] = $now;
         Cache::setCacheGeneral($cache);
         self::initCorePiwikInTrackerMode();
         Option::set('lastTrackerCronRun', $cache['lastTrackerCronRun']);
         Common::printDebug('-> Scheduled Tasks: Starting...');
         // save current user privilege and temporarily assume super user privilege
         $isSuperUser = Piwik::isUserIsSuperUser();
         // Scheduled tasks assume Super User is running
         Piwik::setUserIsSuperUser();
         // While each plugins should ensure that necessary languages are loaded,
         // we ensure English translations at least are loaded
         Translate::loadEnglishTranslation();
         $resultTasks = TaskScheduler::runTasks();
         // restore original user privilege
         Piwik::setUserIsSuperUser($isSuperUser);
         Common::printDebug($resultTasks);
         Common::printDebug('Finished Scheduled Tasks.');
     } else {
         Common::printDebug("-> Scheduled tasks not triggered.");
     }
     Common::printDebug("Next run will be from: " . date('Y-m-d H:i:s', $nextRunTime) . ' UTC');
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:45,代码来源:Tracker.php

示例6: initObjectsToCallAPI

 /**
  * Instantiate access and log objects
  */
 protected function initObjectsToCallAPI()
 {
     // connect to the database using the DB infos currently in the session
     $this->createDbFromSessionInformation();
     Piwik::setUserIsSuperUser();
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:9,代码来源:Controller.php

示例7: init

 public function init()
 {
     // Note: the order of methods call matters here.
     $this->displayHelp();
     $this->initPiwikHost();
     $this->initLog();
     $this->initCore();
     $this->initTokenAuth();
     $this->initCheckCli();
     $this->initStateFromParameters();
     Piwik::setUserIsSuperUser(true);
     $this->logInitInfo();
     $this->checkPiwikUrlIsValid();
     $this->logArchiveTimeoutInfo();
     $this->segments = $this->initSegmentsToArchive();
     $this->allWebsites = APISitesManager::getInstance()->getAllSitesId();
     $websitesIds = $this->initWebsiteIds();
     $this->filterWebsiteIds($websitesIds);
     $this->websites = $websitesIds;
     if ($this->shouldStartProfiler) {
         \Piwik\Profiler::setupProfilerXHProf($mainRun = true);
         $this->log("XHProf profiling is enabled.");
     }
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:24,代码来源:CronArchive.php

示例8: PiwikTracker

<?php

// Script that creates 100 websites, then outputs a IMG that records a pageview in each website
// Used initially to test how to handle cookies for this use case (see http://dev.piwik.org/trac/ticket/409)
use Piwik\Common;
use Piwik\FrontController;
use Piwik\Piwik;
use Piwik\Plugins\SitesManager\API;
exit;
define('PIWIK_INCLUDE_PATH', '../..');
define('PIWIK_ENABLE_DISPATCH', false);
define('PIWIK_ENABLE_ERROR_HANDLER', false);
define('PIWIK_ENABLE_SESSION_START', false);
require_once PIWIK_INCLUDE_PATH . "/index.php";
require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";
require_once PIWIK_INCLUDE_PATH . "/libs/PiwikTracker/PiwikTracker.php";
FrontController::getInstance()->init();
Piwik::setUserIsSuperUser();
$count = 100;
for ($i = 0; $i <= $count; $i++) {
    $id = API::getInstance()->addSite(Common::getRandomString(), 'http://piwik.org');
    $t = new PiwikTracker($id, 'http://localhost/trunk/piwik.php');
    echo $id . " <img width=100 height=10 border=1 src='" . $t->getUrlTrackPageView('title') . "'><br/>";
}
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:24,代码来源:test_cookies_GenerateHundredsWebsitesAndVisits.php


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