本文整理汇总了PHP中WikiFactory::table方法的典型用法代码示例。如果您正苦于以下问题:PHP WikiFactory::table方法的具体用法?PHP WikiFactory::table怎么用?PHP WikiFactory::table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WikiFactory
的用法示例。
在下文中一共展示了WikiFactory::table方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: countNotExternal
function countNotExternal()
{
$dbr = wfGetDB(DB_SLAVE, "dpl");
/**
* get active databases from city_list
*/
$databases = array();
$res = $dbr->select(WikiFactory::table("city_list"), array("city_dbname", "city_id"), array("city_public" => 1), __FUNCTION__);
while ($row = $dbr->fetchObject($res)) {
$databases[$row->city_id] = $row->city_dbname;
}
$dbr->freeResult($res);
foreach ($databases as $city_id => $database) {
$sql = "\n\t\t\tSELECT count(*) as count\n\t\t\tFROM revision r1 FORCE INDEX (PRIMARY), text t2\n\t\t\tWHERE old_id = rev_text_id\n\t\t\tAND old_flags NOT LIKE '%external%'\n\t\t";
$dbr->selectDB($database);
$dbr->begin();
$res = $dbr->query($sql, __FUNCTION__);
$row = $dbr->fetchObject($res);
if (!empty($row->count)) {
printf("Not External rows in %5d %30s = %8d\n", $city_id, $database, $row->count);
}
$dbr->freeResult($res);
$dbr->commit();
}
}
示例2: ini_set
* @package MediaWiki
* @addtopackage maintenance
*
* clear wikifactory variables cache
*
* Usage:
* (particular wiki)
* SERVER_ID=<city_id_from_city_list> php maintenance/wikia/clear_wikifactory_cache.php
*
* or
* (whole cache, all wikis)
* SERVER_ID=177 php maintenance/wikia/clear_wikifactory_cache.php --all
*/
ini_set("include_path", dirname(__FILE__) . "/..");
require_once "commandLine.inc";
$all = isset($options["all"]) ? $options["all"] : false;
if (!$all) {
WikiFactory::clearCache($wgCityId);
printf("%s removing %5d:%s from cache\n", wfTimestamp(TS_DB, time()), $wgCityId, $wgDBname);
} else {
/**
* iterate through city_list
*/
$dbr = WikiFactory::db(DB_SLAVE);
$res = $dbr->select(WikiFactory::table("city_list"), array("city_id", "city_dbname"), array("city_public" => 1), __FILE__, array("ORDER BY" => "city_id"));
while ($row = $dbr->fetchObject($res)) {
WikiFactory::clearCache($row->city_id);
printf("%s removing %5d:%s from cache\n", wfTimestamp(TS_DB, time()), $row->city_id, $row->city_dbname);
}
$dbr->close();
}
示例3: isset
$quiet = isset($options['quiet']);
$conds = array(
'ug_group' => 'heper',
'ug_user' => array('96953') //see RT#67513, RT#131567
);
$dbr = WikiFactory::db(DB_MASTER);
/**
* get active databases from city_list
*/
$databases = array();
$res = $dbr->select(
WikiFactory::table('city_list'),
array('city_dbname', 'city_id'),
array('city_public' => 1, 'city_useshared' => 1),
__FUNCTION__
);
while ($row = $dbr->fetchObject($res)) {
$databases[$row->city_id] = $row->city_dbname;
}
$dbr->freeResult($res);
foreach ($databases as $city_id => $database) {
//skip central (global user rights)
if ( in_array( $city_id, array( 177 ) ) ) {
continue;
}
示例4: dirname
require_once dirname(__FILE__) . '/../commandLine.inc';
$time_start = microtime(true);
$dbr = wfGetDB(DB_SLAVE);
$dbw = wfGetDB(DB_MASTER, array(), $wgExternalSharedDB);
// get messages with city = NULL
echo "#1: Get list of shoutbox messages not yet converted from host name to cityId\n";
$messages = $dbw->select('shout_box_messages', array('id', 'wikia'), array('city' => NULL), 'shoutbox_host_to_city_id');
// update city value
echo "#2: Update each message (set city value based on hostname)\n";
$messagesCount = 0;
while ($msg = $dbr->fetchObject($messages)) {
$url = "http://{$msg->wikia}/";
switch ($url) {
case 'http://wikia.com/':
$city = 177;
break;
default:
$city = $dbr->selectField(WikiFactory::table('city_list'), array('city_id'), array('city_url' => $url), 'shoutbox_host_to_city_id');
}
if (is_numeric($city)) {
$dbw->update('shout_box_messages', array('city' => $city), array('id' => $msg->id), 'shoutbox_host_to_city_id');
$messagesCount++;
echo "\t{$url} -> {$city}\n";
} else {
echo "\t{$url} -> ERROR!\n";
}
}
// make sure we commit transaction
$dbw->commit();
$time = microtime(true) - $time_start;
echo "#3: Updated " . $messagesCount . " messages. Execution time: {$time} seconds\n";
示例5: getQueryInfo
/**
* getQueryInfo
*
* get default field for sorting
*
* @return array: query info
*/
function getQueryInfo()
{
$query = array("tables" => array(WikiFactory::table("city_list_log"), WikiFactory::table("city_list")), "fields" => array("*"), "conds" => array(WikiFactory::table("city_list", "city_id") . " = " . WikiFactory::table("city_list_log", "cl_city_id")));
if ($this->mWikiId) {
$query["conds"][] = WikiFactory::table("city_list", "city_id") . " = " . $this->mWikiId;
}
$variable = $this->getRequest()->getInt('variable');
if ($variable > 0) {
$query['conds'][] = WikiFactory::table('city_list_log', 'cl_type') . '=' . WikiFactory::LOG_VARIABLE;
$query['conds'][] = WikiFactory::table('city_list_log', 'cl_var_id') . '=' . $variable;
}
return $query;
}
示例6: ini_set
<?php
/**
* @package MediaWiki
* @addtopackage maintenance
* @author eloy@wikia
*
* dump wikifactory variables as php values
*
*/
ini_set("include_path", dirname(__FILE__) . "/..");
require_once "commandLine.inc";
$dbr = WikiFactory::db(DB_SLAVE);
echo "<?php\n\n";
$oRes = $dbr->select(array(WikiFactory::table("city_variables"), WikiFactory::table("city_variables_pool")), array("*"), array("cv_city_id" => $wgCityId, "cv_variable_id = cv_id"), __FILE__);
while ($oRow = $dbr->fetchObject($oRes)) {
echo '$' . "{$oRow->cv_name} = ";
echo var_export(unserialize($oRow->cv_value));
echo ";\n";
}
示例7: die
* @package MediaWiki
* @subpackage Maintanance
*
*/
require_once '../commandLine.inc';
if (isset($options['help'])) {
die("Usage: php removeUserRightsOnLocalDB.php [--quiet]\n\n\t\t --help you are reading it right now\n\t\t --quiet do not print anything to output\n\n");
}
$quiet = isset($options['quiet']);
$conds = array('ug_group' => 'heper', 'ug_user' => array('96953'));
$dbr = WikiFactory::db(DB_MASTER);
/**
* get active databases from city_list
*/
$databases = array();
$res = $dbr->select(WikiFactory::table('city_list'), array('city_dbname', 'city_id'), array('city_public' => 1, 'city_useshared' => 1), __FUNCTION__);
while ($row = $dbr->fetchObject($res)) {
$databases[$row->city_id] = $row->city_dbname;
}
$dbr->freeResult($res);
foreach ($databases as $city_id => $database) {
//skip central (global user rights)
if (in_array($city_id, array(177))) {
continue;
}
if (!$quiet) {
echo "Connecting to wiki (ID:{$city_id}, dbname:{$database})\n";
}
$dbw = wfGetDB(DB_MASTER, array(), $database);
$dbw->delete('user_groups', $conds, __FUNCTION__);
$dbw->close();
示例8: getQueryInfo
/**
* getQueryInfo
*
* get default field for sorting
*
* @return array: query info
*/
function getQueryInfo()
{
$query = array("tables" => array(WikiFactory::table("city_list_log"), WikiFactory::table("city_list")), "fields" => array("*"), "conds" => array(WikiFactory::table("city_list", "city_id") . " = " . WikiFactory::table("city_list_log", "cl_city_id")));
if ($this->mWikiId) {
$query["conds"][] = WikiFactory::table("city_list", "city_id") . " = " . $this->mWikiId;
}
return $query;
}