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


PHP WikiFactory::clearInterwikiCache方法代码示例

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


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

示例1: ini_set

 *
 * Get familiar with "How_to_run_maintenance_script" article on internal to figure out how to run it.
 */
ini_set("include_path", dirname(__FILE__) . "/../");
require_once "commandLine.inc";
function enableVEUI($id)
{
    WikiFactory::setVarByName('wgEnableVisualEditorUI', $id, true);
    WikiFactory::clearCache($id);
}
function isVEenabled($id)
{
    $out = WikiFactory::getVarByName('wgEnableVisualEditorExt', $id);
    return $out ? unserialize($out->cv_value) : false;
}
$varid = WikiFactory::getVarIdByName('wgEnableVisualEditorExt', true);
$list = WikiFactory::getListOfWikisWithVar($varid, 'bool', '=', true);
foreach ($list as $id => $val) {
    echo "Wiki id: {$id}\n";
    $isVEenabled = isVEenabled($id);
    if ($isVEenabled) {
        // IMPORTANT! Uncomment line below if you really want it to work.
        //enableVEUI( $id );
        echo "Enabled VEUI\n";
    } else {
        echo "Not enabled VEUI because VE not enabled\n";
    }
    echo "########################################\n";
}
WikiFactory::clearInterwikiCache();
开发者ID:Tjorriemorrie,项目名称:app,代码行数:30,代码来源:enableVEUIforVEenabled.php

示例2: axWFactoryClearCache

/**
 * 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);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:29,代码来源:SpecialWikiFactory_ajax.php

示例3: index

 /**
  * 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();
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:80,代码来源:SpecialSpamWikisSpecialPageController.class.php


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