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


PHP WikiFactory::isPublic方法代码示例

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


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

示例1: lookupIPActivity

 /**
  * Gets wikis an IP address might have edits on
  *
  * @author Daniel Grunwell (Grunny)
  * @param String $ipAddress The IP address to lookup
  */
 public static function lookupIPActivity($ipAddress)
 {
     global $wgDevelEnvironment, $wgSpecialsDB;
     wfProfileIn(__METHOD__);
     if (empty($ipAddress) || !IP::isIPAddress($ipAddress)) {
         wfProfileOut(__METHOD__);
         return false;
     }
     $result = [];
     $ipLong = ip2long($ipAddress);
     if (empty($wgDevelEnvironment)) {
         $dbr = wfGetDB(DB_SLAVE, [], $wgSpecialsDB);
         $res = $dbr->select(['multilookup'], ['ml_city_id'], ['ml_ip' => $ipLong], __METHOD__);
         foreach ($res as $row) {
             if (!in_array($row->ml_city_id, self::$excludedWikis)) {
                 if (WikiFactory::isPublic($row->ml_city_id)) {
                     $result[] = (int) $row->ml_city_id;
                 }
             }
         }
         $dbr->freeResult($res);
     } else {
         // on devbox - set up the list manually
         $result = [165];
     }
     wfProfileOut(__METHOD__);
     return $result;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:34,代码来源:RenameUserHelper.class.php

示例2: delete

 public function delete($pageList, $suppress = false)
 {
     global $IP;
     $user = \User::newFromId($this->createdBy);
     $userName = $user->getName();
     $articlesDeleted = 0;
     foreach ($pageList as $imageData) {
         list($wikiId, $imageId) = $imageData;
         if (!\WikiFactory::isPublic($wikiId)) {
             $this->notice('wiki has been disabled', ['wiki_id' => $wikiId]);
             continue;
         }
         $dbname = \WikiFactory::getWikiByID($wikiId);
         if (!$dbname) {
             $this->warning('did not find database', ['wiki_id' => $wikiId]);
             continue;
         }
         $cityUrl = \WikiFactory::getVarValueByName('wgServer', $wikiId);
         if (empty($cityUrl)) {
             $this->warning('could not determine city url', ['wiki_id' => $wikiId]);
             continue;
         }
         $cityLang = \WikiFactory::getVarValueByName('wgLanguageCode', $wikiId);
         $reason = wfMsgExt('imagereview-reason', ['language' => $cityLang]);
         $command = "SERVER_ID={$wikiId} php {$IP}/maintenance/wikia/deleteOn.php" . ' -u ' . escapeshellarg($userName) . ' --id ' . $imageId;
         if ($reason) {
             $command .= ' -r ' . escapeshellarg($reason);
         }
         if ($suppress) {
             $command .= ' -s';
         }
         $title = wfShellExec($command, $exitStatus);
         if ($exitStatus !== 0) {
             $this->error('article deletion error', ['city_url' => $cityUrl, 'exit_status' => $exitStatus, 'error' => $title]);
             continue;
         }
         $cityPath = \WikiFactory::getVarValueByName('wgScript', $wikiId);
         $escapedTitle = wfEscapeWikiText($title);
         $this->info('removed image', ['link' => "{$cityUrl}{$cityPath}?title={$escapedTitle}", 'title' => $escapedTitle]);
         ++$articlesDeleted;
     }
     $success = $articlesDeleted == count($pageList);
     if (!$success) {
         $this->sendNotification();
     }
     return $success;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:47,代码来源:ImageReviewTask.class.php

示例3: getRecentAdminEdits

 function getRecentAdminEdits($fromWikiId = null, $toWikiId = null)
 {
     global $wgStatsDB, $wgStatsDBEnabled;
     $recentAdminEdit = array();
     if (!empty($wgStatsDBEnabled) && !empty($fromWikiId) && !empty($toWikiId)) {
         $dbrStats = wfGetDB(DB_SLAVE, array(), $wgStatsDB);
         //get wikis with edits < 1000 and admins not active in last 45 days
         //260000 = ID of wiki created on 2011-05-01 so it will work for wikis created after this project has been deployed
         $res = $dbrStats->query('select e1.wiki_id, sum(e1.edits) as sum_edits from specials.events_local_users e1 ' . 'where e1.wiki_id > ' . $fromWikiId . ' and e1.wiki_id <= ' . $toWikiId . ' ' . 'group by e1.wiki_id ' . 'having sum_edits < 1000 and (' . 'select count(0) from specials.events_local_users e2 ' . 'where e1.wiki_id = e2.wiki_id and ' . 'all_groups like "%sysop%" and ' . 'editdate > now() - interval 45 day ' . ') = 0', __METHOD__);
         while ($row = $dbrStats->fetchObject($res)) {
             $wikiDbname = WikiFactory::IDtoDB($row->wiki_id);
             if ($wikiDbname === false) {
                 //check if wiki exists in city_list
                 continue;
             }
             if (WikiFactory::isPublic($row->wiki_id) === false) {
                 //check if wiki is closed
                 continue;
             }
             if (self::isFlagSet($row->wiki_id, WikiFactory::FLAG_ADOPTABLE)) {
                 // check if adoptable flag is set
                 continue;
             }
             $res2 = $dbrStats->query("select user_id, max(editdate) as lastedit from specials.events_local_users where wiki_id = {$row->wiki_id} and all_groups like '%sysop%' group by 1 order by null;", __METHOD__);
             $recentAdminEdit[$row->wiki_id] = array('recentEdit' => time(), 'admins' => array());
             while ($row2 = $dbrStats->fetchObject($res2)) {
                 if (($lastedit = wfTimestamp(TS_UNIX, $row2->lastedit)) < $recentAdminEdit[$row->wiki_id]['recentEdit']) {
                     $recentAdminEdit[$row->wiki_id]['recentEdit'] = $lastedit;
                 } else {
                     if ($row2->lastedit == '0000-00-00 00:00:00') {
                         // use city_created if no lastedit
                         $wiki = WikiFactory::getWikiByID($row->wiki_id);
                         if (!empty($wiki)) {
                             $recentAdminEdit[$row->wiki_id]['recentEdit'] = wfTimestamp(TS_UNIX, $wiki->city_created);
                         }
                     }
                 }
                 $recentAdminEdit[$row->wiki_id]['admins'][] = $row2->user_id;
             }
         }
     }
     return $recentAdminEdit;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:43,代码来源:AutomaticWikiAdoptionGatherData.php

示例4: lookupRegisteredUserActivity

 /**
  * @author Federico "Lox" Lucignano
  * @param $userID int the registered user ID
  * @return Array A list of wikis' IDs related to user activity, false if the user is not an existing one or an anon
  * 
  * Finds on which wikis a REGISTERED user (see LookupContribs for anons) has been active using the events table stored in the stats DB
  * instead of the blobs table in dataware, tests showed is faster and more accurate
  */
 public static function lookupRegisteredUserActivity($userID)
 {
     wfProfileIn(__METHOD__);
     global $wgDevelEnvironment, $wgStatsDB, $wgStatsDBEnabled;
     //check for non admitted values
     if (empty($userID) || !is_int($userID)) {
         wfProfileOut(__METHOD__);
         return false;
     }
     wfDebugLog(__CLASS__ . '::' . __METHOD__, "Looking up registered user activity for user with ID {$userID}");
     $result = array();
     if (empty($wgDevelEnvironment)) {
         // on production
         if (!empty($wgStatsDBEnabled)) {
             $dbr =& wfGetDB(DB_SLAVE, array(), $wgStatsDB);
             $res = $dbr->select('events', 'wiki_id', array('user_id' => $userID), __METHOD__, array('DISTINCT'));
             $result = array();
             while ($row = $dbr->fetchObject($res)) {
                 if (!in_array($row->wiki_id, self::$excludedWikis)) {
                     if (WikiFactory::isPublic($row->wiki_id)) {
                         $result[] = (int) $row->wiki_id;
                         wfDebugLog(__CLASS__ . '::' . __METHOD__, "Registered user with ID {$userID} was active on wiki with ID {$row->wiki_id}");
                     } else {
                         wfDebugLog(__CLASS__ . '::' . __METHOD__, "Skipped wiki with ID {$row->wiki_id} (inactive wiki)");
                     }
                 } else {
                     wfDebugLog(__CLASS__ . '::' . __METHOD__, "Skipped wiki with ID {$row->wiki_id} (excluded wiki)");
                 }
             }
             $dbr->freeResult($res);
         }
     } else {
         // on devbox - set up the list manually
         $result = array(165);
     }
     wfProfileOut(__METHOD__);
     return $result;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:46,代码来源:RenameUserHelper.class.php

示例5: exists

 /**
  * check if page exists
  *
  * @return int 0/1
  */
 public function exists()
 {
     $this->loadAll();
     if (!is_null($this->mExists)) {
         return $this->mExists;
     }
     if (WikiFactory::isPublic($this->mCityId)) {
         $dbName = WikiFactory::IDtoDB($this->mCityId);
         $dbr = wfGetDB(DB_SLAVE, array(), $dbName);
         $oRow = $dbr->selectRow(array('page'), array('page_id'), array('page_title' => $this->mText, 'page_namespace' => $this->mNamespace), __METHOD__);
         $this->mExists = intval($oRow ? $oRow->page_id > 0 : 0);
     } else {
         $this->mExists = 0;
     }
     return $this->mExists;
 }
开发者ID:yusufchang,项目名称:app,代码行数:21,代码来源:GlobalTitle.php

示例6: disableWikis

 protected function disableWikis($wikis, &$deleted = array(), &$notDeleted = array())
 {
     $flags = $this->getFlags();
     foreach ($wikis as $id => $wiki) {
         if ($this->debug) {
             echo "{$id} STATUS " . intval(WikiFactory::isPublic($id)) . "\n";
         }
         echo "Closing wiki \"{$wiki['dbname']}\" (#{$id}) ... ";
         if ($this->deletedLimit > 0 && $this->deletedCount >= $this->deletedLimit) {
             echo "cancelled (limit exceeded)\n";
             $notDeleted[$id] = $wiki;
             continue;
         }
         if ($this->readOnly) {
             echo "cancelled (read-only mode)\n";
             $deleted[$id] = $wiki;
             $this->deletedCount++;
             continue;
         }
         if ($this->doDisableWiki($id, $flags, self::DELETION_REASON)) {
             echo "ok\n";
             $this->deleteWikiStats($id);
             $deleted[$id] = $wiki;
             $this->deletedCount++;
         } else {
             echo "failed\n";
             $notDeleted[$id] = $wiki;
         }
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:30,代码来源:maintenance.php

示例7: array

<?php

/*
 * Simple script to enable Founder Progress Bar on wikis with < 250 edits
 *
 * USAGE: withcity --maintenance-script=EnableProgressBar.php --conf /usr/wikia/conf/current/wiki.factory/LocalSettings.php
 *
 * @date 2011-09-01
 * @author Owen Dais <owen at wikia-inc>
 */
#error_reporting( E_ERROR );
include '../commandLine.inc';
// list of allowed languages taken from Release plan
$allowedLanguages = array('en');
//$oFlag = WikiFactory::getVarByName( 'wgEnableFounderProgressBarExt', $wgCityId );
if (!WikiFactory::isPublic($wgCityId)) {
    echo "{$wgCityId}: SKIPPING! Wiki is disabled. \n";
    exit;
}
if (!in_array($wgLanguageCode, $allowedLanguages)) {
    echo "{$wgCityId}: SKIPPING! Wiki's language ({$wgLanguageCode}) is not on the allowed languaes list.\n";
    exit;
}
$db = wfGetDB(DB_SLAVE);
$oRow = $db->selectRow(array('revision'), array('count(*) as count'), array());
if (isset($oRow) && isset($oRow->count) && $oRow->count < 250 && $oRow->count > 5) {
    echo "{$wgCityId} enabled\n";
    WikiFactory::setVarByName('wgEnableFounderProgressBarExt', $wgCityId, 1);
    WikiFactory::clearCache($wgCityId);
} else {
    echo "{$wgCityId} skipped, too many edits\n";
开发者ID:Tjorriemorrie,项目名称:app,代码行数:31,代码来源:EnableProgressBar.php


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