• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP SiteStatsUpdate类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: execute

 public function execute()
 {
     if (!class_exists('CentralAuthUser')) {
         $this->error("CentralAuth isn't enabled on this wiki\n", 1);
     }
     $username = $this->getArg(0);
     $user = User::newFromName($username);
     if ($user === false) {
         $this->error("'{$username}' is an invalid username\n", 1);
     }
     // Normalize username
     $username = $user->getName();
     if ($user->getId()) {
         $this->error("User '{$username}' already exists\n", 1);
     } else {
         global $wgAuth;
         $central = CentralAuthUser::getInstance($user);
         if (!$central->exists()) {
             $this->error("No such global user: '{$username}'\n", 1);
         }
         $user->loadDefaults($username);
         $user->addToDatabase();
         $wgAuth->initUser($user, true);
         $wgAuth->updateUser($user);
         # Notify hooks (e.g. Newuserlog)
         Hooks::run('AuthPluginAutoCreate', array($user));
         # Update user count
         $ssUpdate = new SiteStatsUpdate(0, 0, 0, 0, 1);
         $ssUpdate->doUpdate();
         $this->output("User '{$username}' created\n");
     }
 }
开发者ID:NDKilla,项目名称:mediawiki-extensions-CentralAuth,代码行数:32,代码来源:createLocalAccount.php


示例2: execute

 public function execute()
 {
     $username = $this->getArg(0);
     $password = $this->getArg(1);
     $this->output(wfWikiID() . ": Creating and promoting User:{$username}...");
     $user = User::newFromName($username);
     if (!is_object($user)) {
         $this->error("invalid username.", true);
     } elseif (0 != $user->idForName()) {
         $this->error("account exists.", true);
     }
     # Try to set the password
     try {
         $user->setPassword($password);
     } catch (PasswordError $pwe) {
         $this->error($pwe->getText(), true);
     }
     # Insert the account into the database
     $user->addToDatabase();
     $user->saveSettings();
     # Promote user
     if ($this->hasOption('sysop')) {
         $user->addGroup('sysop');
     }
     if ($this->hasOption('bureaucrat')) {
         $user->addGroup('bureaucrat');
     }
     # Increment site_stats.ss_users
     $ssu = new SiteStatsUpdate(0, 0, 0, 0, 1);
     $ssu->doUpdate();
     $this->output("done.\n");
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:32,代码来源:createAndPromote.php


示例3: go_auth

function go_auth()
{
    global $wgUser, $wgLanguageCode, $wgRequest, $wgOut;
    // For a few special pages, don't do anything.
    $title = $wgRequest->getVal('title');
    $lg = Language::factory($wgLanguageCode);
    if ($title == $lg->specialPage("Userlogout") || $title == $lg->specialPage("Userlogin")) {
        return true;
    }
    $data = go_getsession();
    if ($wgUser->IsAnon() || $data && $wgUser->getName() != $data['username']) {
        if (isset($data['user_id'])) {
            $wgUser = User::newFromName($data['username']);
            // Create a new account if the user does not exists
            if ($wgUser->getID() == 0) {
                // Create the user
                $wgUser->addToDatabase();
                $wgUser->setRealName($data['username']);
                //$wgUser->setEmail($data['GO_SESSION']['email']);
                $wgUser->setPassword(md5($data['username'] . 'zout'));
                // do something random
                $wgUser->setToken();
                $wgUser->saveSettings();
                // Update user count
                $ssUpdate = new SiteStatsUpdate(0, 0, 0, 0, 1);
                $ssUpdate->doUpdate();
            }
            $wgUser->setOption("rememberpassword", 1);
            $wgUser->setCookies();
            $wgOut->returnToMain();
        }
    }
    return true;
}
开发者ID:ajaboa,项目名称:crmpuan,代码行数:34,代码来源:GOAuth.php


示例4: getMessengerUser

 /**
  * Sets up the messenger account for our use if it hasn't been already.
  * Based on code from AbuseFilter
  * https://mediawiki.org/wiki/Extension:AbuseFilter
  *
  * @return User
  */
 public static function getMessengerUser()
 {
     global $wgMassMessageAccountUsername;
     // Function kinda copied from the AbuseFilter
     $user = User::newFromName($wgMassMessageAccountUsername);
     $user->load();
     if ($user->getId() && $user->mPassword == '') {
         // We've already stolen the account
         return $user;
     }
     if (!$user->getId()) {
         $user->addToDatabase();
         $user->saveSettings();
         // Increment site_stats.ss_users
         $ssu = new SiteStatsUpdate(0, 0, 0, 0, 1);
         $ssu->doUpdate();
     } else {
         // Someone already created the account, lets take it over.
         $user->setPassword(null);
         $user->setEmail(null);
         $user->saveSettings();
     }
     // Make the user a bot so it doesn't look weird
     $user->addGroup('bot');
     return $user;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:33,代码来源:MassMessage.body.php


示例5: execute

 public function execute()
 {
     $name = $this->getArg();
     $delete = $this->getOption('delete', false);
     $ns = $this->getOption('ns', NS_MAIN);
     $dbw = wfGetDB(DB_MASTER);
     $dbw->begin();
     $tbl_pag = $dbw->tableName('page');
     $tbl_rec = $dbw->tableName('recentchanges');
     $tbl_rev = $dbw->tableName('revision');
     # Get page ID
     $this->output("Searching for \"{$name}\"...");
     $title = Title::newFromText($name, $ns);
     if ($title) {
         $id = $title->getArticleID();
         $real = $title->getPrefixedText();
         $isGoodArticle = $title->isContentPage();
         $this->output("found \"{$real}\" with ID {$id}.\n");
         # Get corresponding revisions
         $this->output("Searching for revisions...");
         $res = $dbw->query("SELECT rev_id FROM {$tbl_rev} WHERE rev_page = {$id}");
         $revs = array();
         foreach ($res as $row) {
             $revs[] = $row->rev_id;
         }
         $count = count($revs);
         $this->output("found {$count}.\n");
         # Delete the page record and associated recent changes entries
         if ($delete) {
             $this->output("Deleting page record...");
             $dbw->query("DELETE FROM {$tbl_pag} WHERE page_id = {$id}");
             $this->output("done.\n");
             $this->output("Cleaning up recent changes...");
             $dbw->query("DELETE FROM {$tbl_rec} WHERE rc_cur_id = {$id}");
             $this->output("done.\n");
         }
         $dbw->commit();
         # Delete revisions as appropriate
         if ($delete && $count) {
             $this->output("Deleting revisions...");
             $this->deleteRevisions($revs);
             $this->output("done.\n");
             $this->purgeRedundantText(true);
         }
         # Update stats as appropriate
         if ($delete) {
             $this->output("Updating site stats...");
             $ga = $isGoodArticle ? -1 : 0;
             // if it was good, decrement that too
             $stats = new SiteStatsUpdate(0, -$count, $ga, -1);
             $stats->doUpdate();
             $this->output("done.\n");
         }
     } else {
         $this->output("not found in database.\n");
         $dbw->commit();
     }
 }
开发者ID:yusufchang,项目名称:app,代码行数:58,代码来源:nukePage.php


示例6: wfSpecialStatistics

/**
* constructor
*/
function wfSpecialStatistics()
{
    global $wgUser, $wgOut, $wgLang, $wgRequest;
    $fname = 'wfSpecialStatistics';
    $action = $wgRequest->getVal('action');
    $dbr =& wfGetDB(DB_SLAVE);
    extract($dbr->tableNames('page', 'site_stats', 'user', 'user_groups'));
    $row = $dbr->selectRow('site_stats', '*', false, $fname);
    $views = $row->ss_total_views;
    $edits = $row->ss_total_edits;
    $good = $row->ss_good_articles;
    # This code is somewhat schema-agnostic, because I'm changing it in a minor release -- TS
    if (isset($row->ss_total_pages) && $row->ss_total_pages == -1) {
        # Update schema
        $u = new SiteStatsUpdate(0, 0, 0);
        $u->doUpdate();
        $row = $dbr->selectRow('site_stats', '*', false, $fname);
    }
    if (isset($row->ss_total_pages)) {
        $total = $row->ss_total_pages;
    } else {
        $sql = "SELECT COUNT(page_namespace) AS total FROM {$page}";
        $res = $dbr->query($sql, $fname);
        $pageRow = $dbr->fetchObject($res);
        $total = $pageRow->total;
    }
    if (isset($row->ss_users)) {
        $users = $row->ss_users;
    } else {
        $sql = "SELECT MAX(user_id) AS total FROM {$user}";
        $res = $dbr->query($sql, $fname);
        $userRow = $dbr->fetchObject($res);
        $users = $userRow->total;
    }
    $sql = "SELECT COUNT(*) AS total FROM {$user_groups} WHERE ug_group='sysop'";
    $res = $dbr->query($sql, $fname);
    $row = $dbr->fetchObject($res);
    $admins = $row->total;
    if ($action == 'raw') {
        $wgOut->disable();
        header('Pragma: nocache');
        echo "total={$total};good={$good};views={$views};edits={$edits};users={$users};admins={$admins}\n";
        return;
    } else {
        $text = '==' . wfMsg('sitestats') . "==\n";
        $text .= wfMsg('sitestatstext', $wgLang->formatNum($total), $wgLang->formatNum($good), $wgLang->formatNum($views), $wgLang->formatNum($edits), $wgLang->formatNum(sprintf('%.2f', $total ? $edits / $total : 0)), $wgLang->formatNum(sprintf('%.2f', $edits ? $views / $edits : 0)));
        $text .= "\n==" . wfMsg('userstats') . "==\n";
        $text .= wfMsg('userstatstext', $wgLang->formatNum($users), $wgLang->formatNum($admins), '[[' . wfMsg('administrators') . ']]', $wgLang->formatNum(sprintf('%.2f', $admins / $users * 100)));
        $wgOut->addWikiText($text);
    }
}
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:54,代码来源:SpecialStatistics.php


示例7: onOpauthUserAuthorized

 public static function onOpauthUserAuthorized($provider, $uid, $info, $raw)
 {
     global $wgUser, $wgOut;
     // Called when user was successfully authenticated from Opauth
     // This function should compare UID with internal storage and decide to create new account for this user
     // or load existing user from database
     if (OpauthLogin::isUidLinked($uid, $provider)) {
         // Login existing user into system
         $user = OpauthLogin::getUidUser($uid, $provider);
         wfRunHooks('OpauthLoginUserAuthorized', array($user, $provider, $uid, $info));
     } else {
         // Create new user from external data, $info refers to https://github.com/opauth/opauth/wiki/Auth-response
         /**
          * We set UID based string as user name in mediawiki to avoid
          * user nicknames override and collisions problems. We store external user name into
          * "real name" field of user object. This should be supported in skin.
          */
         $user = User::newFromName(md5($provider . $uid) . '_' . $uid, false);
         $user->setRealName($info['name']);
         if (array_key_exists('email', $info)) {
             if (!OpauthLogin::isEmailCollate($info['email'])) {
                 $user->setEmail($info['email']);
             }
         }
         $user->setPassword(md5($info['name'] . time()));
         $user->setToken();
         $user->confirmEmail();
         // Mark email address as confirmed by default
         $user->addToDatabase();
         // Commit changes to database
         OpauthLogin::addUidLink($uid, $provider, $user->getId());
         // Update site stats
         $ssUpdate = new SiteStatsUpdate(0, 0, 0, 0, 1);
         $ssUpdate->doUpdate();
         // Run AddNewAccount hook for proper handling
         wfRunHooks('AddNewAccount', array($user, false));
         wfRunHooks('OpauthLoginUserCreated', array($user, $provider, $info, $uid));
     }
     // Replace current user with new one
     $wgUser = $user;
     $wgUser->setCookies(null, null, true);
     if (array_key_exists('opauth_returnto', $_SESSION) && isset($_SESSION['opauth_returnto'])) {
         $returnToTitle = Title::newFromText($_SESSION['opauth_returnto']);
         unset($_SESSION['opauth_returnto']);
         $wgOut->redirect($returnToTitle->getFullURL());
         return true;
     }
     $wgOut->redirect(Title::newMainPage()->getFullURL());
     return true;
 }
开发者ID:vedmaka,项目名称:Mediawiki-OpauthLogin,代码行数:50,代码来源:OpauthLogin.hooks.php


示例8: load

 static function load($recache = false)
 {
     if (self::$loaded && !$recache) {
         return;
     }
     $dbr =& wfGetDB(DB_SLAVE);
     self::$row = $dbr->selectRow('site_stats', '*', false, __METHOD__);
     # This code is somewhat schema-agnostic, because I'm changing it in a minor release -- TS
     if (!isset(self::$row->ss_total_pages) && self::$row->ss_total_pages == -1) {
         # Update schema
         $u = new SiteStatsUpdate(0, 0, 0);
         $u->doUpdate();
         self::$row = $dbr->selectRow('site_stats', '*', false, __METHOD__);
     }
 }
开发者ID:negabaro,项目名称:alfresco,代码行数:15,代码来源:SiteStats.php


示例9: execute

 public function execute()
 {
     $this->output("Refresh Site Statistics\n\n");
     $counter = new SiteStatsInit($this->hasOption('use-master'));
     $this->output("Counting total edits...");
     $edits = $counter->edits();
     $this->output("{$edits}\nCounting number of articles...");
     $good = $counter->articles();
     $this->output("{$good}\nCounting total pages...");
     $pages = $counter->pages();
     $this->output("{$pages}\nCounting number of users...");
     $users = $counter->users();
     $this->output("{$users}\nCounting number of images...");
     $image = $counter->files();
     $this->output("{$image}\n");
     if (!$this->hasOption('noviews')) {
         $this->output("Counting total page views...");
         $views = $counter->views();
         $this->output("{$views}\n");
     }
     if ($this->hasOption('active')) {
         $this->output("Counting active users...");
         $active = SiteStatsUpdate::cacheUpdate();
         $this->output("{$active}\n");
     }
     $this->output("\nUpdating site statistics...");
     if ($this->hasOption('update')) {
         $counter->update();
     } else {
         $counter->refresh();
     }
     $this->output("done.\n");
 }
开发者ID:rocLv,项目名称:conference,代码行数:33,代码来源:initStats.php


示例10: execute

 public function execute()
 {
     $this->output("Refresh Site Statistics\n\n");
     $counter = new SiteStatsInit($this->hasOption('use-master'));
     $this->output("Counting total edits...");
     $edits = $counter->edits();
     $this->output("{$edits}\nCounting number of articles...");
     $good = $counter->articles();
     $this->output("{$good}\nCounting total pages...");
     $pages = $counter->pages();
     $this->output("{$pages}\nCounting number of users...");
     $users = $counter->users();
     $this->output("{$users}\nCounting number of images...");
     $image = $counter->files();
     $this->output("{$image}\n");
     if ($this->hasOption('update')) {
         $this->output("\nUpdating site statistics...");
         $counter->refresh();
         $this->output("done.\n");
     } else {
         $this->output("\nTo update the site statistics table, run the script " . "with the --update option.\n");
     }
     if ($this->hasOption('active')) {
         $this->output("\nCounting and updating active users...");
         $active = SiteStatsUpdate::cacheUpdate($this->getDB(DB_MASTER));
         $this->output("{$active}\n");
     }
     $this->output("\nDone.\n");
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:29,代码来源:initSiteStats.php


示例11: execute

 public function execute($par)
 {
     global $wgMemc, $wgDisableCounters, $wgMiserMode;
     $this->setHeaders();
     $this->getOutput()->addModuleStyles('mediawiki.special');
     $this->views = SiteStats::views();
     $this->edits = SiteStats::edits();
     $this->good = SiteStats::articles();
     $this->images = SiteStats::images();
     $this->total = SiteStats::pages();
     $this->users = SiteStats::users();
     $this->activeUsers = SiteStats::activeUsers();
     $this->hook = '';
     # Staticic - views
     $viewsStats = '';
     if (!$wgDisableCounters) {
         $viewsStats = $this->getViewsStats();
     }
     # Set active user count
     if (!$wgMiserMode) {
         $key = wfMemcKey('sitestats', 'activeusers-updated');
         // Re-calculate the count if the last tally is old...
         if (!$wgMemc->get($key)) {
             $dbw = wfGetDB(DB_MASTER);
             SiteStatsUpdate::cacheUpdate($dbw);
             $wgMemc->set($key, '1', 24 * 3600);
             // don't update for 1 day
         }
     }
     $text = Xml::openElement('table', array('class' => 'wikitable mw-statistics-table'));
     # Statistic - pages
     $text .= $this->getPageStats();
     # Statistic - edits
     $text .= $this->getEditStats();
     # Statistic - users
     $text .= $this->getUserStats();
     # Statistic - usergroups
     $text .= $this->getGroupStats();
     $text .= $viewsStats;
     # Statistic - popular pages
     if (!$wgDisableCounters && !$wgMiserMode) {
         $text .= $this->getMostViewedPages();
     }
     # Statistic - other
     $extraStats = array();
     if (wfRunHooks('SpecialStatsAddExtra', array(&$extraStats))) {
         $text .= $this->getOtherStats($extraStats);
     }
     $text .= Xml::closeElement('table');
     #<Wikia>
     wfRunHooks("CustomSpecialStatistics", array(&$this, &$text));
     #</Wikia>
     # Customizable footer
     $footer = wfMessage('statistics-footer');
     if (!$footer->isBlank()) {
         $text .= "\n" . $footer->parse();
     }
     $this->getOutput()->addHTML($text);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:59,代码来源:SpecialStatistics.php


示例12: execute

 public function execute($par)
 {
     global $wgOut, $wgMemc;
     global $wgDisableCounters, $wgMiserMode;
     $this->setHeaders();
     $this->views = SiteStats::views();
     $this->edits = SiteStats::edits();
     $this->good = SiteStats::articles();
     $this->images = SiteStats::images();
     $this->total = SiteStats::pages();
     $this->users = SiteStats::users();
     $this->activeUsers = SiteStats::activeUsers();
     $this->admins = SiteStats::numberingroup('sysop');
     $this->hook = '';
     # Staticic - views
     $viewsStats = '';
     if (!$wgDisableCounters) {
         $viewsStats = $this->getViewsStats();
     }
     # Set active user count
     if (!$wgMiserMode) {
         $key = wfMemcKey('sitestats', 'activeusers-updated');
         // Re-calculate the count if the last tally is old...
         if (!$wgMemc->get($key)) {
             $dbw = wfGetDB(DB_MASTER);
             SiteStatsUpdate::cacheUpdate($dbw);
             $wgMemc->set($key, '1', 24 * 3600);
             // don't update for 1 day
         }
     }
     $text = Xml::openElement('table', array('class' => 'wikitable mw-statistics-table'));
     # Statistic - pages
     $text .= $this->getPageStats();
     # Statistic - edits
     $text .= $this->getEditStats();
     # Statistic - users
     $text .= $this->getUserStats();
     # Statistic - usergroups
     $text .= $this->getGroupStats();
     $text .= $viewsStats;
     # Statistic - popular pages
     if (!$wgDisableCounters && !$wgMiserMode) {
         $text .= $this->getMostViewedPages();
     }
     # Statistic - other
     $extraStats = array();
     if (wfRunHooks('SpecialStatsAddExtra', array(&$extraStats))) {
         $text .= $this->getOtherStats($extraStats);
     }
     $text .= Xml::closeElement('table');
     # Customizable footer
     $footer = wfMsgExt('statistics-footer', array('parseinline'));
     if (!wfEmptyMsg('statistics-footer', $footer) && $footer != '') {
         $text .= "\n" . $footer;
     }
     $wgOut->addHTML($text);
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:57,代码来源:SpecialStatistics.php


示例13: execute

 public function execute($par)
 {
     global $wgOut, $wgRequest, $wgMessageCache;
     global $wgDisableCounters, $wgMiserMode;
     $wgMessageCache->loadAllMessages();
     $this->setHeaders();
     $this->views = SiteStats::views();
     $this->edits = SiteStats::edits();
     $this->good = SiteStats::articles();
     $this->images = SiteStats::images();
     $this->total = SiteStats::pages();
     $this->users = SiteStats::users();
     $this->activeUsers = SiteStats::activeUsers();
     $this->admins = SiteStats::numberingroup('sysop');
     $this->numJobs = SiteStats::jobs();
     # Staticic - views
     $viewsStats = '';
     if (!$wgDisableCounters) {
         $viewsStats = $this->getViewsStats();
     }
     # Set active user count
     if (!$wgMiserMode) {
         $dbw = wfGetDB(DB_MASTER);
         SiteStatsUpdate::cacheUpdate($dbw);
     }
     # Do raw output
     if ($wgRequest->getVal('action') == 'raw') {
         $this->doRawOutput();
     }
     $text = Xml::openElement('table', array('class' => 'mw-statistics-table'));
     # Statistic - pages
     $text .= $this->getPageStats();
     # Statistic - edits
     $text .= $this->getEditStats();
     # Statistic - users
     $text .= $this->getUserStats();
     # Statistic - usergroups
     $text .= $this->getGroupStats();
     $text .= $viewsStats;
     # Statistic - popular pages
     if (!$wgDisableCounters && !$wgMiserMode) {
         $text .= $this->getMostViewedPages();
     }
     $text .= Xml::closeElement('table');
     # Customizable footer
     $footer = wfMsgExt('statistics-footer', array('parseinline'));
     if (!wfEmptyMsg('statistics-footer', $footer) && $footer != '') {
         $text .= "\n" . $footer;
     }
     $wgOut->addHTML($text);
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:51,代码来源:SpecialStatistics.php


示例14: attemptAddUser

 /**
  * @param $user User
  * @param $mungedUsername String
  * @return bool
  */
 public static function attemptAddUser($user, $mungedUsername)
 {
     /**
      * @var $wgAuth LdapAuthenticationPlugin
      */
     global $wgAuth;
     if (!$wgAuth->autoCreate()) {
         $wgAuth->printDebug("Cannot automatically create accounts.", NONSENSITIVE);
         return false;
     }
     $wgAuth->printDebug("User does not exist in local database; creating.", NONSENSITIVE);
     // Checks passed, create the user
     $user->loadDefaults($mungedUsername);
     $user->addToDatabase();
     $wgAuth->initUser($user, true);
     $user->setCookies();
     wfSetupSession();
     # Update user count
     $ssUpdate = new SiteStatsUpdate(0, 0, 0, 0, 1);
     $ssUpdate->doUpdate();
     # Notify hooks (e.g. Newuserlog)
     wfRunHooks('AuthPluginAutoCreate', array($user));
     return true;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:29,代码来源:LdapAutoAuthentication.php


示例15: execute

 public function execute($par)
 {
     global $wgMemc;
     $miserMode = $this->getConfig()->get('MiserMode');
     $this->setHeaders();
     $this->getOutput()->addModuleStyles('mediawiki.special');
     $this->edits = SiteStats::edits();
     $this->good = SiteStats::articles();
     $this->images = SiteStats::images();
     $this->total = SiteStats::pages();
     $this->users = SiteStats::users();
     $this->activeUsers = SiteStats::activeUsers();
     $this->hook = '';
     # Set active user count
     if (!$miserMode) {
         $key = wfMemcKey('sitestats', 'activeusers-updated');
         // Re-calculate the count if the last tally is old...
         if (!$wgMemc->get($key)) {
             $dbw = wfGetDB(DB_MASTER);
             SiteStatsUpdate::cacheUpdate($dbw);
             $wgMemc->set($key, '1', 24 * 3600);
             // don't update for 1 day
         }
     }
     $text = Xml::openElement('table', array('class' => 'wikitable mw-statistics-table'));
     # Statistic - pages
     $text .= $this->getPageStats();
     # Statistic - edits
     $text .= $this->getEditStats();
     # Statistic - users
     $text .= $this->getUserStats();
     # Statistic - usergroups
     $text .= $this->getGroupStats();
     # Statistic - other
     $extraStats = array();
     if (Hooks::run('SpecialStatsAddExtra', array(&$extraStats, $this->getContext()))) {
         $text .= $this->getOtherStats($extraStats);
     }
     $text .= Xml::closeElement('table');
     # Customizable footer
     $footer = $this->msg('statistics-footer');
     if (!$footer->isBlank()) {
         $text .= "\n" . $footer->parse();
     }
     $this->getOutput()->addHTML($text);
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:46,代码来源:SpecialStatistics.php


示例16: acceptRequest


//.........这里部分代码省略.........
     $acd_id = null;
     // used for rollback cleanup
     # Save account request data to credentials system
     if ($wgConfirmAccountSaveInfo) {
         $key = $accReq->getFileStorageKey();
         # Copy any attached files to new storage group
         if ($wgAllowAccountRequestFiles && $key) {
             $repoOld = new FSRepo($wgConfirmAccountFSRepos['accountreqs']);
             $repoNew = new FSRepo($wgConfirmAccountFSRepos['accountcreds']);
             $pathRel = UserAccountRequest::relPathFromKey($key);
             $oldPath = $repoOld->getZonePath('public') . '/' . $pathRel;
             $triplet = array($oldPath, 'public', $pathRel);
             $status = $repoNew->storeBatch(array($triplet));
             // copy!
             if (!$status->isOK()) {
                 $dbw->rollback();
                 # DELETE new rows in case there was a COMMIT somewhere
                 $this->acceptRequest_rollback($dbw, $user->getId(), $acd_id);
                 return array('accountconf_copyfailed', $context->getOutput()->parse($status->getWikiText()));
             }
         }
         $acd_id = $dbw->nextSequenceValue('account_credentials_acd_id_seq');
         # Move request data into a separate table
         $dbw->insert('account_credentials', array('acd_user_id' => $user->getID(), 'acd_real_name' => $accReq->getRealName(), 'acd_email' => $accReq->getEmail(), 'acd_email_authenticated' => $dbw->timestampOrNull($authenticated), 'acd_bio' => $accReq->getBio(), 'acd_notes' => $accReq->getNotes(), 'acd_urls' => $accReq->getUrls(), 'acd_ip' => $accReq->getIP(), 'acd_filename' => $accReq->getFileName(), 'acd_storage_key' => $accReq->getFileStorageKey(), 'acd_areas' => $accReq->getAreas('flat'), 'acd_registration' => $dbw->timestamp($accReq->getRegistration()), 'acd_accepted' => $dbw->timestamp(), 'acd_user' => $this->admin->getID(), 'acd_comment' => $this->reason, 'acd_id' => $acd_id), __METHOD__);
         if (is_null($acd_id)) {
             $acd_id = $dbw->insertId();
             // set $acd_id to ID inserted
         }
     }
     # Add to global user login system (if there is one)
     if (!$wgAuth->addUser($user, $p, $accReq->getEmail(), $accReq->getRealName())) {
         $dbw->rollback();
         # DELETE new rows in case there was a COMMIT somewhere
         $this->acceptRequest_rollback($dbw, $user->getId(), $acd_id);
         return array('accountconf_externaldberror', wfMsgHtml('externaldberror'));
     }
     # OK, now remove the request from the queue
     $accReq->remove();
     # Commit this if we make past the CentralAuth system
     # and the groups are added. Next step is sending out an
     # email, which we cannot take back...
     $dbw->commit();
     # Prepare a temporary password email...
     if ($this->reason != '') {
         $msg = "confirmaccount-email-body2-pos{$this->type}";
         # If the user is in a group and there is a welcome for that group, use it
         if ($group && !wfEmptyMsg($msg)) {
             $ebody = wfMsgExt($msg, array('parsemag', 'content'), $user->getName(), $p, $this->reason);
             # Use standard if none found...
         } else {
             $ebody = wfMsgExt('confirmaccount-email-body2', array('parsemag', 'content'), $user->getName(), $p, $this->reason);
         }
     } else {
         $msg = "confirmaccount-email-body-pos{$this->type}";
         # If the user is in a group and there is a welcome for that group, use it
         if ($group && !wfEmptyMsg($msg)) {
             $ebody = wfMsgExt($msg, array('parsemag', 'content'), $user->getName(), $p, $this->reason);
             # Use standard if none found...
         } else {
             $ebody = wfMsgExt('confirmaccount-email-body', array('parsemag', 'content'), $user->getName(), $p, $this->reason);
         }
     }
     # Actually send out the email (@TODO: rollback on failure including $wgAuth)
     $result = $user->sendMail(wfMsgForContent('confirmaccount-email-subj'), $ebody);
     /*
     if ( !$result->isOk() ) {
     	# DELETE new rows in case there was a COMMIT somewhere
     	$this->acceptRequest_rollback( $dbw, $user->getId(), $acd_id );
     	return array( 'accountconf_mailerror',
     		wfMsg( 'mailerror', $context->getOutput()->parse( $result->getWikiText() ) ) );
     }
     */
     # Update user count
     $ssUpdate = new SiteStatsUpdate(0, 0, 0, 0, 1);
     $ssUpdate->doUpdate();
     # Safe to hook/log now...
     wfRunHooks('AddNewAccount', array($user, false));
     $user->addNewUserLogEntry();
     # Clear cache for notice of how many account requests there are
     ConfirmAccount::clearAccountRequestCountCache();
     # Delete any attached file and don't stop the whole process if this fails
     if ($wgAllowAccountRequestFiles) {
         $key = $accReq->getFileStorageKey();
         if ($key) {
             $repoOld = new FSRepo($wgConfirmAccountFSRepos['accountreqs']);
             $pathRel = UserAccountRequest::relPathFromKey($key);
             $oldPath = $repoOld->getZonePath('public') . '/' . $pathRel;
             if (file_exists($oldPath)) {
                 unlink($oldPath);
                 // delete!
             }
         }
     }
     # Start up the user's userpages if set to do so.
     # Will not append, so previous content will be blanked.
     $this->createUserPage($user);
     # Greet the new user if set to do so.
     $this->createUserTalkPage($user);
     return array(true, null);
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:101,代码来源:AccountConfirmSubmission.php


示例17: getFilterUser

 /**
  * @return User
  */
 public static function getFilterUser()
 {
     $user = User::newFromName(wfMessage('abusefilter-blocker')->inContentLanguage()->text());
     $user->load();
     if ($user->getId() && $user->mPassword == '') {
         // Already set up.
         return $user;
     }
     // Not set up. Create it.
     if (!$user->getId()) {
         print 'Trying to create account -- user id is ' . $user->getId();
         $user->addToDatabase();
         $user->saveSettings();
         // Increment site_stats.ss_users
         $ssu = new SiteStatsUpdate(0, 0, 0, 0, 1);
         $ssu->doUpdate();
     } else {
         // Take over the account
         $user->setPassword(null);
         $user->setEmail(null);
         $user->saveSettings();
     }
     // Promote user so it doesn't look too crazy.
     $user->addGroup('sysop');
     return $user;
 }
开发者ID:aahashderuffy,项目名称:extensions,代码行数:29,代码来源:AbuseFilter.class.php


示例18: execute


//.........这里部分代码省略.........
             // old row, populate from key
             $sha1 = LocalRepo::getHashFromKey($row->fa_storage_key);
         }
         # Fix leading zero
         if (strlen($sha1) == 32 && $sha1[0] == '0') {
             $sha1 = substr($sha1, 1);
         }
         if (is_null($row->fa_major_mime) || $row->fa_major_mime == 'unknown' || is_null($row->fa_minor_mime) || $row->fa_minor_mime == 'unknown' || is_null($row->fa_media_type) || $row->fa_media_type == 'UNKNOWN' || is_null($row->fa_metadata)) {
             // Refresh our metadata
             // Required for a new current revision; nice for older ones too. :)
             $props = RepoGroup::singleton()->getFileProps($deletedUrl);
         } else {
             $props = array('minor_mime' => $row->fa_minor_mime, 'major_mime' => $row->fa_major_mime, 'media_type' => $row->fa_media_type, 'metadata' => $row->fa_metadata);
         }
         if ($first && !$exists) {
             // This revision will be published as the new current version
             $destRel = $this->file->getRel();
             $insertCurrent = array('img_name' => $row->fa_name, 'img_size' => $row->fa_size, 'img_width' => $row->fa_width, 'img_height' => $row->fa_height, 'img_metadata' => $props['metadata'], 'img_bits' => $row->fa_bits, 'img_media_type' => $props['media_type'], 'img_major_mime' => $props['major_mime'], 'img_minor_mime' => $props['minor_mime'], 'img_description' => $row->fa_description, 'img_user' => $row->fa_user, 'img_user_text' => $row->fa_user_text, 'img_timestamp' => $row->fa_timestamp, 'img_sha1' => $sha1);
             // The live (current) version cannot be hidden!
             if (!$this->unsuppress && $row->fa_deleted) {
                 $status->fatal('undeleterevdel');
                 $this->file->unlock();
                 return $status;
             }
         } else {
             $archiveName = $row->fa_archive_name;
             if ($archiveName == '') {
                 // This was originally a current version; we
                 // have to devise a new archive name for it.
                 // Format is <timestamp of archiving>!<name>
                 $timestamp = wfTimestamp(TS_UNIX, $row->fa_deleted_timestamp);
                 do {
                     $archiveName = wfTimestamp(TS_MW, $timestamp) . '!' . $row->fa_name;
                     $timestamp++;
                 } while (isset($archiveNames[$archiveName]));
             }
             $archiveNames[$archiveName] = true;
             $destRel = $this->file->getArchiveRel($archiveName);
             $insertBatch[] = array('oi_name' => $row->fa_name, 'oi_archive_name' => $archiveName, 'oi_size' => $row->fa_size, 'oi_width' => $row->fa_width, 'oi_height' => $row->fa_height, 'oi_bits' => $row->fa_bits, 'oi_description' => $row->fa_description, 'oi_user' => $row->fa_user, 'oi_user_text' => $row->fa_user_text, 'oi_timestamp' => $row->fa_timestamp, 'oi_metadata' => $props['metadata'], 'oi_media_type' => $props['media_type'], 'oi_major_mime' => $props['major_mime'], 'oi_minor_mime' => $props['minor_mime'], 'oi_deleted' => $this->unsuppress ? 0 : $row->fa_deleted, 'oi_sha1' => $sha1);
         }
         $deleteIds[] = $row->fa_id;
         if (!$this->unsuppress && $row->fa_deleted & File::DELETED_FILE) {
             // private files can stay where they are
             $status->successCount++;
         } else {
             $storeBatch[] = array($deletedUrl, 'public', $destRel);
             $this->cleanupBatch[] = $row->fa_storage_key;
         }
         $first = false;
     }
     unset($result);
     // Add a warning to the status object for missing IDs
     $missingIds = array_diff($this->ids, $idsPresent);
     foreach ($missingIds as $id) {
         $status->error('undelete-missing-filearchive', $id);
     }
     // Remove missing files from batch, so we don't get errors when undeleting them
     $storeBatch = $this->removeNonexistentFiles($storeBatch);
     // Run the store batch
     // Use the OVERWRITE_SAME flag to smooth over a common error
     $storeStatus = $this->file->repo->storeBatch($storeBatch, FileRepo::OVERWRITE_SAME);
     $status->merge($storeStatus);
     if (!$status->isGood()) {
         // Even if some files could be copied, fail entirely as that is the
         // easiest thing to do without data loss
         $this->cleanupFailedBatch($storeStatus, $storeBatch);
         $status->ok = false;
         $this->file->unlock();
         return $status;
     }
     // Run the DB updates
     // Because we have locked the image row, key conflicts should be rare.
     // If they do occur, we can roll back the transaction at this time with
     // no data loss, but leaving unregistered files scattered throughout the
     // public zone.
     // This is not ideal, which is why it's important to lock the image row.
     if ($insertCurrent) {
         $dbw->insert('image', $insertCurrent, __METHOD__);
     }
     if ($insertBatch) {
         $dbw->insert('oldimage', $insertBatch, __METHOD__);
     }
     if ($deleteIds) {
         $dbw->delete('filearchive', array('fa_id' => $deleteIds), __METHOD__);
     }
     // If store batch is empty (all files are missing), deletion is to be considered successful
     if ($status->successCount > 0 || !$storeBatch) {
         if (!$exists) {
             wfDebug(__METHOD__ . " restored {$status->successCount} items, creating a new current\n");
             DeferredUpdates::addUpdate(SiteStatsUpdate::factory(array('images' => 1)));
             $this->file->purgeEverything();
         } else {
             wfDebug(__METHOD__ . " restored {$status->successCount} as archived versions\n");
             $this->file->purgeDescription();
             $this->file->purgeHistory();
         }
     }
     $this->file->unlock();
     return $status;
 }
开发者ID:spring,项目名称:spring-website,代码行数:101,代码来源:LocalFile.php


示例19: addNewAccountInternal

 /**
  * @private
  */
 function addNewAccountInternal()
 {
     global $wgUser, $wgOut;
     global $wgEnableSorbs, $wgProxyWhitelist;
     global $wgMemc, $wgAccountCreationThrottle;
     global $wgAuth, $wgMinimalPasswordLength;
     // If the user passes an invalid domain, something is fishy
     if (!$wgAuth->validDomain($this->mDomain)) {
         $this->mainLoginForm(wfMsg('wrongpassword'));
         return false;
  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP SiteTree类代码示例发布时间:2022-05-23
下一篇:
PHP SiteStats类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap