/** * 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; }
/** * 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"; } }
/** * 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; }
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; }
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'); } }
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; }
/** * 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); }
function fixBGImage($id, $themeSettingsArray) { $themeSettingsArray['background-image'] = ''; WikiFactory::setVarByName('wgOasisThemeSettings', $id, $themeSettingsArray); WikiFactory::clearCache($id); }
function enableVEUI($id) { WikiFactory::setVarByName('wgEnableVisualEditorUI', $id, true); WikiFactory::clearCache($id); }
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; }
/* * 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";
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"; } } }
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; } }
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"; }
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"; } } } } }
/** * @desc enable/disable feature * @requestParam string enabled [true/false] * @requestParam string feature (extension variable) * @responseParam string result [OK/error] * @responseParam string error (error message) */ public function toggleFeature() { $enabled = $this->getVal('enabled', null); $feature = $this->getVal('feature', null); // check user permission if (!$this->wg->User->isAllowed('wikifeatures')) { $this->setVal('result', 'error'); $this->setVal('error', $this->wf->Msg('wikifeatures-error-permission')); return; } // check if feature given is actually something we allow setting if (!in_array($feature, $this->wg->WikiFeatures['normal']) && !in_array($feature, $this->wg->WikiFeatures['labs'])) { $this->setVal('result', 'error'); $this->setVal('error', $this->wf->Msg('wikifeatures-error-invalid-parameter')); return; } // validate feature: valid value ($enabled and $feature), check if Feature exists ($wg_value) $wg_value = WikiFactory::getVarByName($feature, $this->wg->CityId); if ($enabled != 'true' && $enabled != 'false' || empty($feature) || empty($wg_value)) { $this->setVal('result', 'error'); $this->setVal('error', $this->wf->Msg('wikifeatures-error-invalid-parameter')); return; } $enabled = $enabled == 'true'; $logMsg = "set extension option: {$feature} = " . var_export($enabled, TRUE); $log = WF::build('LogPage', array('wikifeatures')); $log->addEntry('wikifeatures', SpecialPage::getTitleFor('WikiFeatures'), $logMsg, array()); WikiFactory::setVarByName($feature, $this->wg->CityId, $enabled, "WikiFeatures"); if ($feature == 'wgShowTopListsInCreatePage') { WikiFactory::setVarByName('wgEnableTopListsExt', $this->wg->CityId, $enabled, "WikiFeatures"); } // clear cache for active wikis WikiFactory::clearCache($this->wg->CityId); $this->wg->Memc->delete(WikiFeaturesHelper::getInstance()->getMemcKeyNumActiveWikis($feature)); $this->setVal('result', 'ok'); }
function removeVisualEditorExt($id) { WikiFactory::removeVarByName('wgEnableVisualEditorExt', $id); WikiFactory::clearCache($id); }
/** * clear wiki cache */ function axWFactoryClearCache() { global $wgRequest, $wgUser, $wgOut, $wgWikiFactoryMessages; $city_id = $wgRequest->getVal("cityid"); $iError = 0; $sError = ""; if (!$wgUser->isAllowed('wikifactory')) { #--- no permission, do nothing $iError++; $sError = "no permission for removing"; } if (empty($city_id)) { #--- no permission, do nothing $iError++; $sError = "city id missing"; } if (empty($iError)) { WikiFactory::clearCache($city_id); WikiFactory::clearInterwikiCache(); #--- send response $aResponse = array("div-body" => wfMsg("wikifactory_removeconfirm"), "div-name" => "wf-clear-cache"); } else { $aResponse = array("div-body" => $sError, "div-name" => "wf-clear-cache"); } return json_encode($aResponse); }
/** * The main method handling the Special:SpamWikis behaviour. */ public function index() { // access control if (!$this->wg->User->isAllowed('specialspamwikis')) { $this->displayRestrictionError(); return false; } // init some basic data $this->wg->Out->setPageTitle(wfMsg('specialspamwikis-pagetitle')); $this->mTitle = Title::makeTitle(NS_SPECIAL, $this->getName()); $this->mAction = htmlspecialchars($this->mTitle->getLocalURL()); // placeholder for the actual data $this->mData = new StdClass(); // required for HTML links $link = new Linker(); // the code below implements the behaviour of the stats subpage // TODO: find a better method to check for subpages if ("{$this->mTitle->getPrefixedText()}/stats" == $this->wg->request->getVal('title')) { // fetch the data $data = new SpecialSpamWikisData(); $this->mData->stats = $data->getStats(); // render the output $this->response->getView()->setTemplate('SpecialSpamWikisSpecialPageController', 'stats'); return null; } // the code below implements the behaviour after form submission if (F::app()->wg->request->wasPosted()) { // which wikis to close? $this->mData->close = array(); $this->mData->summary = array(); $data = $this->request->getVal('close'); if (!empty($data)) { // DB handle $tmpDb = F::app()->wf->getDb(DB_MASTER, array(), 'stats'); foreach ($data as $k => $v) { // get some info about the wiki $city = WikiFactory::getWikiByID($k); // set the public status to "spam" $status = WikiFactory::setPublicStatus(-2, $k, 'SpecialSpamWikis'); // clear the cached settings for the wiki WikiFactory::clearCache($k); // prepare the output data $this->mData->close[] = array('city' => $link->makeExternalLink($city->city_url, $city->city_title), 'status' => -2 == $status); // update the summary if (-2 == $status) { if (!isset($this->mData->summary[$city->city_founding_user])) { $this->mData->summary[$city->city_founding_user] = 1; } else { $this->mData->summary[$city->city_founding_user]++; } } // remove from the noreptemp.spamwikis $tmpDb->delete('noreptemp.spamwikis', array('city_id' => $k), __METHOD__); } // clear the interwiki links for ALL languages in memcached. WikiFactory::clearInterwikiCache(); unset($tmpDb); } // calculate and pre-format data for StaffLog entry $summary = array('sum' => array_sum($this->mData->summary), 'count' => count($this->mData->summary), 'avg' => 0); if (0 != $summary['count']) { $summary['avg'] = sprintf('%1.2f', $summary['sum'] / $summary['count']); } // pass the calculated summary to the output (yes, overwrite the previous value) $this->mData->summary = $summary; // make a StaffLog entry StaffLogger::log('spamwiki', 'mark', $this->wg->User->getID(), $this->wg->User->getName(), 0, '', wfMsgExt('specialspamwikis-stafflog-summary', array('parsemag'), $summary['sum'], $summary['count'], $summary['avg'])); // render the output $this->response->getView()->setTemplate('SpecialSpamWikisSpecialPageController', 'close'); return null; } // the code below handles the default behaviour: displays the form $this->response->addAsset('resources/wikia/libraries/jquery/datatables/jquery.dataTables.min.js'); $this->response->addAsset('extensions/wikia/SpecialSpamWikis/css/table.scss'); $data = new SpecialSpamWikisData(); $this->mData->criteria = $data->getCriteria(); }
* @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(); }
/** * 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]; case "protect": $protect = $request->getCheck("wpProtected", false); if ($protect) { $message = "Wiki protected"; WikiFactory::setFlags($this->mWiki->city_id, WikiFactory::FLAG_PROTECTED, false, $reason); } else { $message = "Wiki un-protected"; WikiFactory::resetFlags($this->mWiki->city_id, WikiFactory::FLAG_PROTECTED, false, $reason); } break; } return Wikia::successmsg($message); }
/** * Set the variable * @param integer $wikiId * @param mixed $varValue * @return boolean */ protected function setVariable($wikiId, $varValue) { $status = false; if (!$this->dryRun) { $status = WikiFactory::setVarByName($this->varName, $wikiId, $varValue); if ($status) { WikiFactory::clearCache($wikiId); } } return $status; }
/** * close Wiki(s) * @access private */ private function doClose($newWiki = "") { global $wgRequest, $wgOut; wfProfileIn(__METHOD__); $WFTitle = Title::makeTitle(NS_SPECIAL, 'WikiFactory'); #--- $output = ""; if (!empty($this->mWikis)) { $output = Xml::openElement('ul', null); foreach ($this->mWikis as $wiki) { Wikia::log(__METHOD__, "Closing: {$wiki->city_title} (url: {$wiki->city_url}) (id: {$wiki->city_id}) (dbname: {$wiki->city_dbname}) "); #-- move to archive $message = wfMsgExt('closewiki-wiki-closed', array('parse'), $wiki->city_title, $wiki->city_url); if (!empty($newWiki)) { Wikia::log(__METHOD__, " ... and redirecting to: {$this->mRedirect} (id: {$newWiki})"); $this->moveOldDomains($wiki->city_id, $newWiki); #-- add "old" prefix to main domain and set is as primary $prefixedDomain = $this->prefixMainDomain($wiki->city_id); Wikia::log(__METHOD__, " ... primary domain set to: {$prefixedDomain}"); #-- set new city ID in city_domains (except for just created "old" domain) $isMoved = WikiFactory::redirectDomains($wiki->city_id, $newWiki, !empty($prefixedDomain) ? array($prefixedDomain) : array()); #--- $message = wfMsgExt('closewiki-wiki-closed_redirect', array('parse'), $wiki->city_title, $wiki->city_url, sprintf("%s%s", "http://", $this->mRedirect)); } #-- set public to 0 $status = isset($this->mFlags[WikiFactory::FLAG_HIDE_DB_IMAGES]) ? WikiFactory::HIDE_ACTION : WikiFactory::CLOSE_ACTION; #-- set flags as a number if (!empty($this->mFlags)) { $city_flags = 0; foreach ($this->mFlags as $flag) { $city_flags |= $flag; } WikiFactory::setFlags($wiki->city_id, $city_flags); } // Let's request the XML dump if needed if (isset($this->mFlags[WikiFactory::FLAG_CREATE_DB_DUMP])) { DumpsOnDemand::queueDump($wiki->city_id, isset($this->mFlags[WikiFactory::FLAG_HIDE_DB_IMAGES]), true); } if (empty($this->mReason)) { $this->mReason = "-"; } $res = WikiFactory::setPublicStatus($status, $wiki->city_id, $this->mReason); if ($res === $status) { $output .= Xml::tags('li', array('style' => 'padding:4px;'), $message); WikiFactory::clearCache($wiki->city_id); if (!empty($newWiki)) { WikiFactory::clearCache($newWiki); } } } $output .= Xml::closeElement('ul'); } $output .= Xml::element('input', array('name' => 'wiki-return', 'type' => 'button', 'value' => wfMsg('closewiki-return', wfMsg('wikifactory')), 'onclick' => "window.location='{$WFTitle->getFullURL()}'")); $wgOut->addHtml($output); $aHookParams = ['city_id' => $wiki->city_id]; wfRunHooks('WikiFactoryWikiClosed', array($aHookParams)); wfProfileOut(__METHOD__); }