本文整理汇总了PHP中WikiFactory::clearCache方法的典型用法代码示例。如果您正苦于以下问题:PHP WikiFactory::clearCache方法的具体用法?PHP WikiFactory::clearCache怎么用?PHP WikiFactory::clearCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WikiFactory
的用法示例。
在下文中一共展示了WikiFactory::clearCache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: markWikiAsClosed
/**
* Mark given wiki as queued for removal
*
* @param $wikiId integer city ID
* @return bool
*/
private function markWikiAsClosed($wikiId)
{
WikiFactory::setFlags($wikiId, WikiFactory::FLAG_FREE_WIKI_URL | WikiFactory::FLAG_DELETE_DB_IMAGES);
$res = WikiFactory::setPublicStatus(WikiFactory::CLOSE_ACTION, $wikiId, self::REASON);
WikiFactory::clearCache($wikiId);
return $res !== false;
}
示例2: enableSpecialVideosExt
/**
* enable Special Video Ext
* @param integer $wikiId
*/
function enableSpecialVideosExt( $wikiId ) {
echo "Enable Special Videos Ext:\n";
$feature = 'wgEnableSpecialVideosExt';
$wgValue = WikiFactory::getVarByName( $feature, $wikiId );
if ( empty($wgValue) ) {
echo "\tError invalid params. \n";
} else {
WikiFactory::setVarByName( $feature, $wikiId, true, "enable Special Videos Ext for wikis that enable Related Videos" );
WikiFactory::clearCache( $wikiId );
echo "\tUpdate $feature from ".var_export( unserialize($wgValue->cv_value), true )." to true. \n";
}
}
示例3: execute
/**
* execute
*
* entry point for TaskExecutor
*
* @access public
* @author eloy@wikia
*
* @param mixed $params default null - task data from wikia_tasks table
*
* @return boolean - status of operation
*/
public function execute($params = null)
{
global $IP, $wgWikiaLocalSettingsPath, $wgWikiaAdminSettingsPath, $wgExtensionMessagesFiles;
$this->mTaskID = $params->task_id;
$this->mParams = unserialize($params->task_arguments);
$city_id = $this->mParams["city_id"];
$command = $this->mParams["command"];
$type = $this->mParams["type"];
$server = $this->mParams["server"];
$this->addLog("wgServer for this site is: {$server}");
if ($city_id && $command) {
$this->mWikiId = $city_id;
/**
* execute maintenance script
*/
$cmd = sprintf("SERVER_ID={$city_id} php {$IP}/{$command} --server={$server} --conf {$wgWikiaLocalSettingsPath} --aconf {$wgWikiaAdminSettingsPath}");
$this->addLog("Running {$cmd}");
$retval = wfShellExec($cmd, $status);
$this->addLog($retval);
if ($type == "ACWLocal" || $type == "CWLocal") {
$cmd = sprintf("SERVER_ID={$city_id} php {$IP}/maintenance/update.php --server={$server} --quick --nopurge --conf {$wgWikiaLocalSettingsPath} --aconf {$wgWikiaAdminSettingsPath}");
$this->addLog("Running {$cmd}");
$retval = wfShellExec($cmd, $status);
$this->addLog($retval);
$cmd = sprintf("SERVER_ID={$city_id} php {$IP}/maintenance/initStats.php --server={$server} --conf {$wgWikiaLocalSettingsPath} --aconf {$wgWikiaAdminSettingsPath}");
$this->addLog("Running {$cmd}");
$retval = wfShellExec($cmd, $status);
$this->addLog($retval);
$cmd = sprintf("SERVER_ID={$city_id} php {$IP}/maintenance/refreshLinks.php --server={$server} --new-only --conf {$wgWikiaLocalSettingsPath} --aconf {$wgWikiaAdminSettingsPath}");
$this->addLog("Running {$cmd}");
$retval = wfShellExec($cmd, $status);
$this->addLog($retval);
$this->addLog("Remove edit lock");
$oVariable = WikiFactory::getVarByName('wgReadOnly', $city_id);
if (isset($oVariable->cv_variable_id)) {
WikiFactory::removeVarById($oVariable->cv_variable_id, $city_id);
WikiFactory::clearCache($city_id);
}
}
$dbname = WikiFactory::IDtoDB($city_id);
$cmd = sprintf("perl /usr/wikia/backend/bin/scribe/events_local_users.pl --usedb={$dbname} ");
$this->addLog("Running {$cmd}");
$retval = wfShellExec($cmd, $status);
$this->addLog($retval);
/**
* once again clear cache at the very end
*/
$wgMemc = wfGetMainCache();
$wgMemc->delete(WikiFactory::getVarsKey($city_id));
}
return true;
}
示例4: oasisnav2
public static function oasisnav2($cv_name, $city_id, $value)
{
wfProfileIn(__METHOD__);
Wikia::log(__METHOD__, $city_id, $cv_name . ' = ' . intval($value));
if ($cv_name == 'wgOasisNavV2') {
Wikia::log(__METHOD__, '', 'Started purging wgOasisNav2');
/* @var $navService WikiNavigationService */
$navService = F::build('WikiNavigationService');
$memCacheKey = $navService->getMemcKey(WikiNavigationService::WIKI_LOCAL_MESSAGE);
F::app()->wg->memc->set($memCacheKey, null);
$title = F::build('Title', array(WikiNavigationService::WIKI_LOCAL_MESSAGE, NS_MEDIAWIKI), 'newFromText');
if ($title instanceof Title) {
$article = Article::newFromID($title->getArticleID());
if ($article instanceof Article) {
$article->doPurge();
}
}
WikiFactory::clearCache($city_id);
Wikia::log(__METHOD__, '', 'Finished purging wgOasisNav2');
}
wfProfileOut(__METHOD__);
return true;
}
示例5: onSubmit
public function onSubmit(array $data)
{
global $wgCityId;
$res = true;
if (!$data['Confirm']) {
return Status::newFatal('locknoconfirm');
}
wfSuppressWarnings();
if (!WikiFactory::setVarByName('wgReadOnly', $wgCityId, '')) {
wfDebug(__METHOD__ . ": cannot set wgReadOnly for Wikia: {$wgCityId} \n");
$res = false;
}
if (!WikiFactory::clearCache($wgCityId)) {
wfDebug(__METHOD__ . ": cannot clear cache for Wikia: {$wgCityId} \n");
$res = false;
}
wfRestoreWarnings();
if ($res) {
return Status::newGood();
} else {
return Status::newFatal('unlockdb-wikifactory-error');
}
}
示例6: maintenance
public function maintenance($server)
{
global $wgCityId, $IP;
$cmd = sprintf("SERVER_ID={$wgCityId} php {$IP}/maintenance/update.php --server={$server} --quick --nopurge");
$output = wfShellExec($cmd, $exitStatus);
$this->info('run update.php', ['exitStatus' => $exitStatus, 'output' => $output]);
$cmd = sprintf("SERVER_ID={$wgCityId} php {$IP}/maintenance/initStats.php --server={$server}");
$output = wfShellExec($cmd, $exitStatus);
$this->info('run initStats.php', ['exitStatus' => $exitStatus, 'output' => $output]);
$cmd = sprintf("SERVER_ID={$wgCityId} php {$IP}/maintenance/refreshLinks.php --server={$server} --new-only");
$output = wfShellExec($cmd, $exitStatus);
$this->info('run refreshLinks.php', ['exitStatus' => $exitStatus, 'output' => $output]);
$this->info("Remove edit lock");
$variable = \WikiFactory::getVarByName('wgReadOnly', $wgCityId);
if (isset($variable->cv_variable_id)) {
\WikiFactory::removeVarById($variable->cv_variable_id, $wgCityId);
\WikiFactory::clearCache($wgCityId);
}
$dbname = \WikiFactory::IDtoDB($wgCityId);
$founder = $this->founder->getId();
$cmd = sprintf("perl /usr/wikia/backend/bin/scribe/events_local_users.pl --usedb={$dbname} --user={$founder} ");
$output = wfShellExec($cmd, $exitStatus);
$this->info('run events_local_users.pl', ['exitStatus' => $exitStatus, 'output' => $output]);
$wgMemc = wfGetMainCache();
$wgMemc->delete(\WikiFactory::getVarsKey($wgCityId));
return true;
}
示例7: doUpdateDomains
/**
* doUpdateDomains
*
* Store changes connected with domains
*
* @access private
* @author eloy@wikia
*
* @return mixed info when change, null when not changed
*/
private function doUpdateDomains(&$request)
{
$action = $request->getText("wpAction", null);
$reason = $request->getText("wpReason", wfMsg('wikifactory-public-status-change-default-reason'));
$message = "";
switch ($action) {
case "status":
$status = $request->getVal("wpWikiStatus", 0);
WikiFactory::setPublicStatus($status, $this->mWiki->city_id, $reason);
$this->mWiki->city_public = $status;
WikiFactory::clearCache($this->mWiki->city_id);
$message = "Status of this wiki was changed to " . $this->mStatuses[$status];
break;
}
return Wikia::successmsg($message);
}
示例8: fixBGImage
function fixBGImage($id, $themeSettingsArray)
{
$themeSettingsArray['background-image'] = '';
WikiFactory::setVarByName('wgOasisThemeSettings', $id, $themeSettingsArray);
WikiFactory::clearCache($id);
}
示例9: enableVEUI
function enableVEUI($id)
{
WikiFactory::setVarByName('wgEnableVisualEditorUI', $id, true);
WikiFactory::clearCache($id);
}
示例10: doDisableWiki
protected function doDisableWiki($wikiId, $flags, $reason = '')
{
// TOOD: copied from WikiFactory::disableWiki since it's not released yet
WikiFactory::setFlags($wikiId, $flags);
$res = WikiFactory::setPublicStatus(WikiFactory::CLOSE_ACTION, $wikiId, $reason);
if ($this->debug) {
var_dump("setPublicStatus", $wikiId, $res);
}
WikiFactory::clearCache($wikiId);
return $res !== false;
}
示例11: array
/*
* 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";
}
echo "{$wgCityId}: PROCESSING COMPLETED\n";
示例12: processWikis
protected function processWikis()
{
$flags = $this->getFlags();
$status = $flags & WikiFactory::FLAG_HIDE_DB_IMAGES ? WikiFactory::HIDE_ACTION : WikiFactory::CLOSE_ACTION;
$reason = $this->reason;
foreach ($this->wikiIds as $wikiId) {
// skip wikis with id lesser than "start"
if ($this->start && $this->start > $wikiId) {
continue;
}
// echo "status: memory = ".memory_get_usage(true)."\n";
// check memory usage
if (!$this->checkMemoryLimit(1)) {
echo "error: memory limit exceeded (1G), please restart the script\n";
return;
}
$city = WikiFactory::getWikiByID($wikiId);
if (!$city) {
echo "{$wikiId}: error: city could not be found\n";
continue;
}
$city_name = $city->city_dbname;
if (!$city->city_public) {
echo "{$wikiId}: error: ({$city_name}) city is already non-public\n";
continue;
}
$evaluator = new DeadWikiEvaluator($wikiId);
if (!$evaluator->getStatus()) {
echo "{$wikiId}: error: ({$city_name}) city does not meet requirements to be closed: " . $evaluator->getMessage() . "\n";
continue;
}
echo "{$wikiId}: ({$city_name}) marking as closed... ";
if (!$this->dryRun) {
WikiFactory::setFlags($wikiId, $flags);
$res = WikiFactory::setPublicStatus($status, $wikiId, $reason);
WikiFactory::clearCache($wikiId);
echo "OK\n";
} else {
echo "OK (dry run)\n";
}
}
}
示例13: useWikialock
private function useWikialock()
{
global $wgLang, $wgCityId;
$reason = $this->reason . "\nby " . $this->getUser()->getName() . ' at ' . $wgLang->timeanddate(wfTimestampNow());
if (!WikiFactory::setVarByName('wgReadOnly', $wgCityId, $reason) || !WikiFactory::clearCache($wgCityId)) {
return false;
} else {
return true;
}
}
示例14: language
continue;
}
if (!in_array($lang, $allowedLanguages)) {
echo "{$wiki}: SKIPPING! Wiki's language ({$lang}) is not on the allowed languaes list.\n";
continue;
}
if (!isset($options['yes'])) {
$response = null;
// repeat until we get a valid response
while (is_null($response)) {
echo "{$wiki}: Are you sure you want to switch to Oasis? [yes/no] ";
$input = fgets(STDIN);
$response = parseInput($input);
}
if (!$response) {
// user answered no
echo "{$wiki}: SKIPPING (because you said so)\n";
continue;
} else {
echo "{$wiki}: PROCEEDING\n";
}
}
WikiFactory::setVarByName('wgDefaultSkin', $id, 'oasis');
WikiFactory::clearCache($id);
// purge varnishes
if (!isset($options['nopurge'])) {
$cmd = "pdsh -g all_varnish varnishadm -T :6082 'purge req.http.host == \"" . $domain . "\"'";
passthru($cmd);
}
echo "{$wiki}: PROCESSING COMPLETED\n";
}
示例15: execute
public function execute()
{
$this->test = $this->hasOption('test');
$this->verbose = $this->hasOption('verbose');
$this->file = $this->getOption('file', '');
$this->dbname = $this->getOption('dbname', '');
$this->set = $this->hasOption('set');
$this->get = $this->hasOption('get');
if ($this->hasOption('enable')) {
$this->enabled = true;
}
if ($this->hasOption('disable')) {
$this->enabled = false;
}
if ($this->test) {
echo "\n=== TEST MODE ===\n";
}
// Shouldn't happen ... paranoid programming
if (!$this->set && !$this->get) {
$this->get = true;
}
if ($this->file) {
echo "Reading from " . $this->file . " ...\n";
$dbnames = file($this->file);
} else {
if ($this->dbname) {
$dbnames = [$this->dbname];
} else {
echo "ERROR: List file empty or not readable. Please provide a line-by-line list of wikis.\n";
echo "USAGE: php EnableVideosModule.php /path/to/file\n";
exit;
}
}
foreach ($dbnames as $db) {
$db = trim($db);
echo "Running on {$db} ...\n";
// get wiki ID
$id = WikiFactory::DBtoID($db);
if (empty($id)) {
echo "\t{$db}: ERROR (not found in WikiFactory)\n";
continue;
} else {
$this->debug("\tWiki ID ({$db}): {$id}");
}
if ($id == 177) {
echo "\tDefaulted to community, not likely a valid wiki, skipping...\n";
continue;
}
if ($this->set) {
if (!$this->test) {
$this->debug("\tSetting ... wgEnableVideosModuleExt");
WikiFactory::setVarByName('wgEnableVideosModuleExt', $id, $this->enabled);
WikiFactory::clearCache($id);
$this->debug("\tdone");
}
} else {
if ($this->get) {
$enabled = WikiFactory::getVarByName('wgEnableVideosModuleExt', $id);
$enabled = $enabled->cv_value;
$enabled = $enabled ? unserialize($enabled) : false;
if ($enabled) {
echo "\tEnabled\n";
} else {
echo "\tDisabled\n";
}
}
}
}
}