本文整理汇总了PHP中WikiFactory::removeVarById方法的典型用法代码示例。如果您正苦于以下问题:PHP WikiFactory::removeVarById方法的具体用法?PHP WikiFactory::removeVarById怎么用?PHP WikiFactory::removeVarById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WikiFactory
的用法示例。
在下文中一共展示了WikiFactory::removeVarById方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: removeVariableFromWiki
/**
* Remove variable from the wiki
* @param array $varData
* @param integer $wikiId
* @return Status
*/
function removeVariableFromWiki($varData, $wikiId)
{
$log = WikiaLogger::instance();
$resp = WikiFactory::removeVarById($varData['cv_id'], $wikiId);
$logData = $varData + ['wikiId' => $wikiId];
if ($resp) {
$log->info("Remove variable from city_variables table.", $logData);
$status = Status::newGood();
} else {
$log->error("Cannot remove variable from city_variables table.", $logData);
$status = Status::newFatal("Cannot remove variable from the wiki.");
}
return $status;
}
示例3: updateWDACFlags
/**
* Update variables in WikiFactory
* @param array $cities List of wikis to update flags
* containg wikis IDs and values: True - is WDAC, False - is not WDAC
* Struncture of param
* $city = array( $cityId => $isDirectedAtCh )
*/
public function updateWDACFlags($cities)
{
wfProfileIn(__METHOD__);
foreach ($cities as $cityId => $isDirectedAtCh) {
if ($isDirectedAtCh == WDACReviewSpecialController::FLAG_APPROVE) {
WikiFactory::setVarById($this->byStaffVarId, $cityId, true, self::UPDATE_REASON);
WikiFactory::removeVarById($this->byFounderVarId, $cityId, self::UPDATE_REASON);
} elseif ($isDirectedAtCh == WDACReviewSpecialController::FLAG_DISAPPROVE) {
WikiFactory::setVarById($this->byStaffVarId, $cityId, false, self::UPDATE_REASON);
WikiFactory::removeVarById($this->byFounderVarId, $cityId, self::UPDATE_REASON);
}
}
wfProfileOut(__METHOD__);
}
示例4: execute
public function execute()
{
$wikiFactory = new WikiFactory();
$varId = $wikiFactory->getVarIdByName(self::VAR_TO_SET);
if ($varId === false) {
throw new ErrorException('No such variable: ' . self::VAR_TO_SET);
}
$newTopWikiIds = $this->getTopWamWikiIds(self::TOP_NUMBER_OF_WIKIS);
$oldTopWikiIds = array_keys($wikiFactory->getListOfWikisWithVar($varId, 'bool', '=', true));
foreach ($newTopWikiIds as $wikiId) {
if (array_search($wikiId, $oldTopWikiIds) === false) {
$wikiFactory->setVarById($varId, $wikiId, true, __METHOD__);
echo '+' . $wikiId . PHP_EOL;
}
}
foreach ($oldTopWikiIds as $wikiId) {
if (array_search($wikiId, $newTopWikiIds) === false) {
$wikiFactory->removeVarById($varId, $wikiId, __METHOD__);
echo '-' . $wikiId . PHP_EOL;
}
}
}
示例5: removeVariableFromWiki
/**
* Remove variable from the wiki
* @param integer $wikiId
* @param array $varData
* @return boolean
*/
protected function removeVariableFromWiki($wikiId, $varData)
{
$status = true;
if (!$this->dryRun) {
$log = WikiaLogger::instance();
$resp = WikiFactory::removeVarById($varData['cv_id'], $wikiId);
$logData = $varData + ['wikiId' => $wikiId];
if ($resp) {
$log->info("Remove variable from city_variables table.", $logData);
} else {
$log->error("Cannot remove variable from city_variables table.", $logData);
$status = false;
}
}
return $status;
}
示例6: removeVarByName
/**
* removeVarByName
*
* handy wrapper for removeVarById
*
* @access public
* @author tor@wikia-inc.com
* @static
*
* @param string $variable: variable name in city_variables_pool
* @param integer $wiki: wiki id in city list
* @param string $reason: optional reason text
*
* @return boolean: transaction status
*/
public static function removeVarByName($variable, $wiki, $reason = null)
{
$oVariable = self::getVarByName($variable, $wiki);
return WikiFactory::removeVarById($oVariable->cv_variable_id, $wiki, $reason);
}
示例7: axWFactoryRemoveVariable
/**
* axWFactoryRemoveVariable
*
* Ajax call, remove
*
* @access public
* @author eloy@wikia
*
* @return string: json string with array of variables
*/
function axWFactoryRemoveVariable()
{
global $wgUser, $wgRequest;
$error = 0;
$return = "";
if (!$wgUser->isAllowed('wikifactory')) {
$error++;
$return = Wikia::errormsg("You are not allowed to change variable value");
} else {
$cv_id = $wgRequest->getVal('varId');
$city_id = $wgRequest->getVal('cityid');
$tag_name = $wgRequest->getVal('tagName');
$tag_wiki_count = 0;
$form_id = $wgRequest->getVal("formId", null);
$reason = $wgRequest->getVal("reason", null);
if (!WikiFactory::removeVarById($cv_id, $city_id, $reason)) {
$error++;
$return = Wikia::errormsg("Variable not removed because of problems with database. Try again.");
} else {
$return = Wikia::successmsg(" Value of variable was removed ");
if (!empty($tag_name)) {
// apply changes to all wikis with given tag
$tagsQuery = new WikiFactoryTagsQuery($tag_name);
foreach ($tagsQuery->doQuery() as $tagged_wiki_id) {
if (WikiFactory::removeVarByID($cv_id, $tagged_wiki_id)) {
$tag_wiki_count++;
}
}
$return .= Wikia::successmsg(" ({$tag_wiki_count} wikis affected)");
}
}
}
if (empty($form_id)) {
$div_name = "wf-variable-parse";
} else {
$div_name = "wf-variable-parse-{$form_id}";
}
return json_encode(array("div-body" => $return, "is-error" => $error, "tag-name" => $tag_name, "tag-wikis" => $tag_wiki_count, "div-name" => $div_name));
}
示例8: 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;
}