Exemple #1
0
 /**
  * Purges the cache of a page
  */
 public function execute()
 {
     global $wgUser;
     $params = $this->extractRequestParams();
     if (!$wgUser->isAllowed('purge')) {
         $this->dieUsageMsg(array('cantpurge'));
     }
     if (!isset($params['titles'])) {
         $this->dieUsageMsg(array('missingparam', 'titles'));
     }
     $result = array();
     foreach ($params['titles'] as $t) {
         $r = array();
         $title = Title::newFromText($t);
         if (!$title instanceof Title) {
             $r['title'] = $t;
             $r['invalid'] = '';
             $result[] = $r;
             continue;
         }
         ApiQueryBase::addTitleInfo($r, $title);
         if (!$title->exists()) {
             $r['missing'] = '';
             $result[] = $r;
             continue;
         }
         $article = Mediawiki::articleFromTitle($title);
         $article->doPurge();
         // Directly purge and skip the UI part of purge().
         $r['purged'] = '';
         $result[] = $r;
     }
     $this->getResult()->setIndexedTagName($result, 'page');
     $this->getResult()->addValue(null, $this->getModuleName(), $result);
 }
Exemple #2
0
include 'tagging.php';
include 'class.Mediawiki.php';
$infoArr = array();
${$quArr} = array();
//$query = remwords($query);
$machine_id = set_machine_id();
$query = $_GET['q'];
$query = remwords(urldecode($query));
echo "<br>Query: {$query} <br>";
$quArr = explode(' ', trim($query));
echo "<br>After Explode";
var_dump($quArr);
$gid = $_GET['gid'];
$sm = $_GET['sm'];
$direct = isset($_GET['direct']) && ($_GET['direct'] == 'true' || $_GET['direct'] == 1) ? true : false;
$mwiki = new Mediawiki($gid, $sm);
echo $query . '<br>';
print_r($mwiki->get_data($query));
if (isset($_GET['debug'])) {
    echo "</pre>";
    ob_end_flush();
} else {
    ob_end_clean();
}
$infoArr1 = objectsIntoArray($mwiki->infobox);
var_dump($infoArr1);
echo "<h1>image</h1>";
echo $mwiki->infobox['image'];
foreach ($infoArr1 as $id1 => $val) {
    $id = preg_replace("~ies\$~", "y", $id1);
    $id = preg_replace("~e?s\$~", "", $id);