function execute( $par ) {
		global $wgRequest, $wgOut,$wgUser;
		if ( !$this->userCanExecute($wgUser) ) {
			$this->displayRestrictionError();
			return;
		}
		$dbr = wfGetDB( DB_SLAVE );
		$dbw = wfGetDB( DB_MASTER );
		$page_row=array(
			'page_id',
		        'page_namespace'
		);
		$result=$dbr->select( 'page', $page_row );
		while ($myRow=$dbr->fetchRow($result)){
			$myId=$myRow['page_id'];
			$myNamespace=$myRow['page_namespace'];
			if ($myNamespace!=NS_FILE){
				$myRevision=Revision::loadFromPageId($dbr,$myId);
				$myText=$myRevision->getRawText();
				if ($myText==""){
					while ($myPrevious=$myRevision->getPrevious()){
						if ($myPrevious->getRawText()==''){
							$myRevision=$myPrevious;
						}
						else {
							break;
						}
					}
					$blank_row=array(
						'blank_page_id'		=> $myId,
						'blank_user_id'
							=> $myRevision->getRawUser(),
						'blank_user_name'
							=> $myRevision->getRawUserText(),
						'blank_timestamp'
							=> $myRevision->getTimeStamp(),
						'blank_summary'
							=> $myRevision->getRawComment(),
						'blank_parent_id'
							=> $myRevision->getParentId(),
					);
					$checkPresence=$dbr->selectRow('blanked_page',
						'blank_page_id'
						,array("blank_page_id" => $myId));
					if (!$checkPresence){
						$dbw->insert('blanked_page',$blank_row);
					$mTitle=Title::newFromID($myId);
					Article::onArticleDelete( $mTitle );
					$mTitle->resetArticleID( 0 );
					}
				}
			}
			
		}
		$output = wfMsg( 'purewikideletion-population-done' );
		$wgOut->addWikiText($output);
	}
/**
 * @param $from
 * @param $to Title
 * @param $user
 * @param $pageid
 * @param $redirid
 * @return bool
 */
function mwSearchUpdateMove($from, $to, $user, $pageid, $redirid)
{
    global $wgDBname;
    $db = wfGetDB(DB_MASTER);
    $pageRevision = Revision::loadFromPageId($db, $pageid);
    if (!is_null($pageRevision)) {
        MWSearchUpdater::updatePage($wgDBname, $to, $pageRevision->getText());
    }
    $redirText = '#REDIRECT [[' . $to->getPrefixedText() . "]]\n";
    MWSearchUpdater::updatePage($wgDBname, $from, $redirText);
    return true;
}
Esempio n. 3
0
 /**
  * Load wikitext and get article URL
  */
 public function getArticleDetails($id)
 {
     $dbr = WikiVisualTranscoder::getDB('read');
     $rev = Revision::loadFromPageId($dbr, $id);
     if ($rev) {
         $text = $rev->getText();
         $title = $rev->getTitle();
         $url = WikiVisualTranscoder::makeWikihowURL($title);
         return array($text, $url, $title);
     } else {
         return array('', '', null);
     }
 }
 function execute($par)
 {
     global $wgOut, $wgRequest;
     if (!self::isAuthorized()) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $dbr = wfGetDB(DB_SLAVE);
     $r = Revision::loadFromPageId($dbr, $wgRequest->getVal('pageid'));
     if ($r) {
         $title = $r->getTitle()->getText();
         Misc::outputFile("{$title}.txt", $r->getText(), "application/force-download");
     }
     return;
 }
function sendModNotification(&$rcid, &$article)
{
    $articleTitle = null;
    if ($article) {
        $articleTitle = $article->getTitle();
    }
    try {
        if ($articleTitle && $articleTitle->getArticleID() != 0) {
            $dbw = wfGetDB(DB_MASTER);
            $r = Revision::loadFromPageId($dbw, $articleTitle->getArticleID());
            $u = User::newFromId($r->getUser());
            AuthorEmailNotification::notifyMod($article, $u, $r);
        }
    } catch (Exception $e) {
    }
    return true;
}
Esempio n. 6
0
 protected function setup($par)
 {
     global $wgRequest, $wgUser;
     // Options
     $opts = new FormOptions();
     $this->opts = $opts;
     // bind
     $opts->add('page1', '');
     $opts->add('page2', '');
     $opts->add('rev1', '');
     $opts->add('rev2', '');
     $opts->add('action', '');
     // Set values
     $opts->fetchValuesFromRequest($wgRequest);
     $title1 = Title::newFromText($opts->getValue('page1'));
     $title2 = Title::newFromText($opts->getValue('page2'));
     if ($title1 && $title1->exists() && $opts->getValue('rev1') == '') {
         $pda = new Article($title1);
         $pdi = $pda->getID();
         $pdLastRevision = Revision::loadFromPageId(wfGetDB(DB_SLAVE), $pdi);
         $opts->setValue('rev1', $pdLastRevision->getId());
     } elseif ($opts->getValue('rev1') != '') {
         $pdrev = Revision::newFromId($opts->getValue('rev1'));
         if ($pdrev) {
             $opts->setValue('page1', $pdrev->getTitle()->getPrefixedText());
         }
     }
     if ($title2 && $title2->exists() && $opts->getValue('rev2') == '') {
         $pda = new Article($title2);
         $pdi = $pda->getID();
         $pdLastRevision = Revision::loadFromPageId(wfGetDB(DB_SLAVE), $pdi);
         $opts->setValue('rev2', $pdLastRevision->getId());
     } elseif ($opts->getValue('rev2') != '') {
         $pdrev = Revision::newFromId($opts->getValue('rev2'));
         if ($pdrev) {
             $opts->setValue('page2', $pdrev->getTitle()->getPrefixedText());
         }
     }
     // Store some objects
     $this->skin = $wgUser->getSkin();
 }
Esempio n. 7
0
    function outputCategoryReport()
    {
        global $wgRequest, $wgOut;
        $cat = str_replace("http://www.wikihow.com/Category:", "", trim(Misc::getUrlDecodedData($wgRequest->getVal('data'))));
        $catArr = array($cat);
        $cats = CategoryInterests::getSubCategoryInterests($catArr);
        $cats[] = $cat;
        $cats = '"' . join('","', $cats) . '"';
        $sql = 'SELECT 
					page_id, page_title, page_counter 
				FROM page p 
				INNER JOIN categorylinks c ON c.cl_from = page_id 
				WHERE page_namespace = 0  and page_is_redirect = 0 AND c.cl_to IN (' . $cats . ')';
        $dbr = wfGetDB(DB_SLAVE);
        $res = $dbr->query($sql);
        $articles = array();
        while ($row = $dbr->fetchObject($res)) {
            $altsData = "";
            if ($this->slowQuery) {
                $r = Revision::loadFromPageId($dbr, $row->page_id);
                $wikitext = $r->getText();
                //$imgs = $this->hasImages($wikitext);
                $altsData = $this->hasAlternateMethods($wikitext) ? "Yes" : "No";
                $sizeData = $this->getArticleSize($r);
            }
            //$output .= join("\t", array_values(get_object_vars($row))) . "\t$imgs\t$altsData\t$sizeData\n";
            $row = array_values(get_object_vars($row));
            $row[1] = Misc::makeUrl($row[1]);
            $articles[] = $row;
        }
        if ($wgRequest->getVal('format') == 'csv') {
            $output = $this->getCategoryReportCSV($articles);
            $this->sendFile($cat, $output);
        } else {
            $output = $this->getCategoryReportHtml($articles);
            $this->sendHtml($output);
        }
    }
Esempio n. 8
0
function wfNotifyRequesterOnNab($article_id)
{
    $dbw = wfGetDB(DB_MASTER);
    $res = $dbw->select(array('suggested_notify', 'page'), array('sn_notify', 'page_title', 'page_namespace'), array('sn_page=page_id', 'page_id' => $article_id));
    // Only send an email if the article doesn't suck (bug 557)
    $templateRegExp = "@{{(Copyvio|Copyviobot|accuracy|nfd|stub){1}@im";
    $r = Revision::loadFromPageId($dbw, $article_id);
    if (!is_null($r) && preg_match($templateRegExp, $r->getText()) === 0) {
        $emails = array();
        while ($row = $dbw->fetchObject($res)) {
            $title = Title::makeTitle($row->page_namespace, $row->page_title);
            $arr = split(',', $row->sn_notify);
            foreach ($arr as $e) {
                $emails[trim($e)] = $title;
            }
        }
        if (sizeof($emails) > 0) {
            wfSendRequestNotificationEmail($emails);
        }
    }
    $dbw->delete('suggested_notify', array('sn_page' => $article_id));
    return true;
}
Esempio n. 9
0
 public static function getPageText($marriagedate, $marriageplace, $titleString, $pageids = NULL, $husbandTitle = '', $wifeTitle = '', $childTitle = '')
 {
     // standardize marriage place
     $placeTitles = array();
     if ($marriageplace && mb_strpos($marriageplace, '|') === false) {
         $placeTitles[] = $marriageplace;
     }
     if ($placeTitles) {
         $correctedTitles = PlaceSearcher::correctPlaceTitles($placeTitles);
         $correctedPlace = @$correctedTitles[$marriageplace];
         if ($correctedPlace) {
             $marriageplace = strcasecmp($marriageplace, $correctedPlace) == 0 ? $correctedPlace : $correctedPlace . '|' . $marriageplace;
         }
     }
     $result = "<family>\n";
     $db =& wfGetDB(DB_MASTER);
     // get latest version
     $imageId = 0;
     $husbands = '';
     $wives = '';
     $children = '';
     $images = '';
     if ($pageids) {
         foreach ($pageids as $pageid) {
             $revision = Revision::loadFromPageId($db, $pageid);
             if ($revision) {
                 if ($revision->getTitle()->getNamespace() == NS_PERSON) {
                     $text = $revision->getText();
                     $xml = StructuredData::getXml('person', $text);
                     if (isset($xml)) {
                         $personTitle = StructuredData::escapeXml($revision->getTitle()->getText());
                         $spouseTag = Person::getSpouseTagFromGender((string) $xml->gender);
                         foreach ($xml->spouse_of_family as $family) {
                             if ((string) $family['title'] == $titleString) {
                                 if ($spouseTag == 'husband') {
                                     $husbands .= "<husband title=\"" . $personTitle . "\"/>\n";
                                 } else {
                                     $wives .= "<wife title=\"" . $personTitle . "\"/>\n";
                                 }
                             }
                         }
                         foreach ($xml->child_of_family as $family) {
                             if ((string) $family['title'] == $titleString) {
                                 $children .= '<child title="' . $personTitle . "\"/>\n";
                             }
                         }
                     }
                 } else {
                     if ($revision->getTitle()->getNamespace() == NS_IMAGE) {
                         $text = $revision->getText();
                         $xml = StructuredData::getXml('image_data', $text);
                         if (isset($xml)) {
                             $imageTitle = StructuredData::escapeXml($revision->getTitle()->getText());
                             foreach ($xml->family as $family) {
                                 if ((string) $family['title'] == $titleString) {
                                     $imageId++;
                                     $images .= '<image id="I' . $imageId . '" filename="' . $imageTitle . "\"/>\n";
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($husbandTitle) {
         $husbands .= "<husband title=\"" . StructuredData::escapeXml($husbandTitle) . "\"/>\n";
     }
     if ($wifeTitle) {
         $wives .= "<husband title=\"" . StructuredData::escapeXml($wifeTitle) . "\"/>\n";
     }
     if ($childTitle) {
         $children .= "<husband title=\"" . StructuredData::escapeXml($childTitle) . "\"/>\n";
     }
     $result .= $husbands;
     $result .= $wives;
     $result .= $children;
     if ($marriagedate || $marriageplace) {
         $result .= '<event_fact type="Marriage" date="' . StructuredData::escapeXml($marriagedate) . '" place="' . StructuredData::escapeXml($marriageplace) . "\"/>\n";
     }
     $result .= $images;
     $result .= "</family>\n";
     return $result;
 }
Esempio n. 10
0
 /**
  * Update the searchindex table for a given pageid
  * @param $dbw Database: a database write handle
  * @param $pageId Integer: the page ID to update.
  */
 public function updateSearchIndexForPage($dbw, $pageId)
 {
     // Get current revision
     $rev = Revision::loadFromPageId($dbw, $pageId);
     $title = null;
     if ($rev) {
         $titleObj = $rev->getTitle();
         $title = $titleObj->getPrefixedDBkey();
         $this->output("{$title}...");
         # Update searchindex
         $u = new SearchUpdate($pageId, $titleObj->getText(), $rev->getText());
         $u->doUpdate();
         $this->output("\n");
     }
     return $title;
 }
 public function buildMovePackage($oTitle, $oUser, $page_id = null, $redirect_id = null)
 {
     wfProfileIn(__METHOD__);
     if (!$oTitle instanceof Title) {
         Wikia::log(__METHOD__, "error", "Cannot send log using scribe ({$this->app->wg->CityId}): invalid title object");
         wfProfileOut(__METHOD__);
         return true;
     }
     $oRevision = Revision::newFromTitle($oTitle);
     if (!is_object($oRevision) && !empty($redirect_id)) {
         $db = wfGetDB(DB_MASTER);
         $oRevision = Revision::loadFromPageId($db, $redirect_id);
     }
     if (!$oRevision instanceof Revision) {
         Wikia::log(__METHOD__, "error", "Cannot send log using scribe ({$this->app->wg->CityId}): invalid revision object");
         wfProfileOut(__METHOD__);
         return true;
     }
     if (empty($page_id)) {
         $page_id = $oRevision->getPage();
     }
     if (empty($page_id) || $page_id < 0) {
         $page_id = $oTitle->getArticleId();
     }
     $oPage = WikiPage::newFromID($page_id);
     if (!$oPage instanceof WikiPage) {
         Wikia::log(__METHOD__, "error", "Cannot send log using scribe ({$this->app->wg->CityId}): invalid WikiPage object");
         wfProfileOut(__METHOD__);
         return true;
     }
     wfProfileOut(__METHOD__);
     return $this->buildEditPackage($oPage, $oUser, $oRevision);
 }
Esempio n. 12
0
 /**
  * Loads everything except the text
  * This isn't necessary for all uses, so it's only done if needed.
  */
 protected function loadLastEdit()
 {
     if (-1 != $this->mUser) {
         return;
     }
     # New or non-existent articles have no user information
     $id = $this->getID();
     if (0 == $id) {
         return;
     }
     $this->mLastRevision = Revision::loadFromPageId(wfGetDB(DB_MASTER), $id);
     if (!is_null($this->mLastRevision)) {
         $this->mUser = $this->mLastRevision->getUser();
         $this->mUserText = $this->mLastRevision->getUserText();
         $this->mTimestamp = $this->mLastRevision->getTimestamp();
         $this->mComment = $this->mLastRevision->getComment();
         $this->mMinorEdit = $this->mLastRevision->isMinor();
         $this->mRevIdFetched = $this->mLastRevision->getId();
     }
 }
Esempio n. 13
0
 public function calcPageStats(&$statsToCalc, &$row)
 {
     $dbr = $this->getWikiDB();
     $t = Title::newFromId($row->page_id);
     $goodRevision = GoodRevision::newFromTitle($t, $row->page_id);
     $revId = 0;
     if ($goodRevision) {
         $revId = $goodRevision->latestGood();
     }
     $r = $revId > 0 ? Revision::loadFromId($dbr, $revId) : Revision::loadFromPageId($dbr, $row->page_id);
     $fields = array();
     if ($r && $t && $t->exists()) {
         foreach ($statsToCalc as $stat => $isOn) {
             if ($isOn) {
                 $statCalculator = $this->getStatClass($stat);
                 $fields = array_merge($fields, $statCalculator->calc($dbr, $r, $t, $row));
             }
         }
     }
     return $fields;
 }
Esempio n. 14
0
 /**	
  * articleInUse
  * check to see if {{inuse}} or {{in use}} is in the article
  * returns boolean
  **/
 function articleInUse($aid)
 {
     $dbr = wfGetDB(DB_SLAVE);
     $r = Revision::loadFromPageId($dbr, $aid);
     if (strpos($r->getText(), '{{inuse') === false) {
         $result = false;
     } else {
         $result = true;
     }
     return $result;
 }
Esempio n. 15
0
 /**
  * Load a revision based on a known page ID and current revision ID from the DB
  *
  * This method allows for the use of caching, though accessing anything that normally
  * requires permission checks (aside from the text) will trigger a small DB lookup.
  * The title will also be lazy loaded, though setTitle() can be used to preload it.
  *
  * @param IDatabase $db
  * @param int $pageId Page ID
  * @param int $revId Known current revision of this page
  * @return Revision|bool Returns false if missing
  * @since 1.28
  */
 public static function newKnownCurrent(IDatabase $db, $pageId, $revId)
 {
     $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
     return $cache->getWithSetCallback($cache->makeGlobalKey('revision', $db->getWikiID(), $pageId, $revId), $cache::TTL_WEEK, function ($curValue, &$ttl, array &$setOpts) use($db, $pageId, $revId) {
         $setOpts += Database::getCacheSetOptions($db);
         $rev = Revision::loadFromPageId($db, $pageId, $revId);
         // Reflect revision deletion and user renames
         if ($rev) {
             $rev->mTitle = null;
             // mutable; lazy-load
             $rev->mRefreshMutableFields = true;
         }
         return $rev ?: false;
         // don't cache negatives
     });
 }
Esempio n. 16
0
 public static function getPageText($givenname, $surname, $gender, $birthdate, $birthplace, $deathdate, $deathplace, $titleString, $pageids = NULL, $parentFamily = '', $spouseFamily = '', $chrdate = '', $chrplace = '', $burdate = '', $burplace = '')
 {
     // standardize places
     $placeTitles = array();
     if ($birthplace && mb_strpos($birthplace, '|') === false) {
         $placeTitles[] = $birthplace;
     }
     if ($deathplace && mb_strpos($deathplace, '|') === false) {
         $placeTitles[] = $deathplace;
     }
     if ($placeTitles) {
         $correctedTitles = PlaceSearcher::correctPlaceTitles($placeTitles);
         $correctedPlace = @$correctedTitles[$birthplace];
         if ($correctedPlace) {
             $birthplace = strcasecmp($birthplace, $correctedPlace) == 0 ? $correctedPlace : $correctedPlace . '|' . $birthplace;
         }
         $correctedPlace = @$correctedTitles[$deathplace];
         if ($correctedPlace) {
             $deathplace = strcasecmp($deathplace, $correctedPlace) == 0 ? $correctedPlace : $correctedPlace . '|' . $deathplace;
         }
     }
     $result = "<person>\n";
     if ($givenname || $surname) {
         $result .= '<name given="' . StructuredData::escapeXml(trim($givenname)) . '" surname="' . StructuredData::escapeXml(trim($surname)) . "\"/>\n";
     }
     $db =& wfGetDB(DB_MASTER);
     // make sure we get the most current version
     $spouseFamilies = '';
     $parentFamilies = '';
     $images = '';
     $imageId = 0;
     if ($pageids) {
         foreach ($pageids as $pageid) {
             $revision = Revision::loadFromPageId($db, $pageid);
             if ($revision) {
                 if ($revision->getTitle()->getNamespace() == NS_FAMILY) {
                     $text = $revision->getText();
                     $xml = StructuredData::getXml('family', $text);
                     if (isset($xml)) {
                         $familyTitle = StructuredData::escapeXml($revision->getTitle()->getText());
                         foreach ($xml->husband as $member) {
                             if ((string) $member['title'] == $titleString) {
                                 $spouseFamilies .= '<spouse_of_family title="' . $familyTitle . "\"/>\n";
                                 if (!$gender) {
                                     $gender = 'M';
                                 }
                             }
                         }
                         foreach ($xml->wife as $member) {
                             if ((string) $member['title'] == $titleString) {
                                 $spouseFamilies .= '<spouse_of_family title="' . $familyTitle . "\"/>\n";
                                 if (!$gender) {
                                     $gender = 'F';
                                 }
                             }
                         }
                         foreach ($xml->child as $member) {
                             if ((string) $member['title'] == $titleString) {
                                 $parentFamilies .= '<child_of_family title="' . $familyTitle . "\"/>\n";
                             }
                         }
                     }
                 } else {
                     if ($revision->getTitle()->getNamespace() == NS_IMAGE) {
                         $text = $revision->getText();
                         $xml = StructuredData::getXml('image_data', $text);
                         if (isset($xml)) {
                             $imageTitle = StructuredData::escapeXml($revision->getTitle()->getText());
                             foreach ($xml->person as $person) {
                                 if ((string) $person['title'] == $titleString) {
                                     $imageId++;
                                     $images .= '<image id="I' . $imageId . '" filename="' . $imageTitle . "\"/>\n";
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($parentFamily) {
         $parentFamilies .= '<child_of_family title="' . StructuredData::escapeXml($parentFamily) . "\"/>\n";
     }
     if ($spouseFamily) {
         $spouseFamilies .= '<spouse_of_family title="' . StructuredData::escapeXml($spouseFamily) . "\"/>\n";
     }
     if ($gender) {
         $result .= '<gender>' . StructuredData::escapeXml($gender) . "</gender>\n";
     }
     $result .= $parentFamilies;
     $result .= $spouseFamilies;
     if ($birthdate || $birthplace) {
         $result .= '<event_fact type="Birth" date="' . StructuredData::escapeXml($birthdate) . '" place="' . StructuredData::escapeXml($birthplace) . "\"/>\n";
     }
     if ($deathdate || $deathplace) {
         $result .= '<event_fact type="Death" date="' . StructuredData::escapeXml($deathdate) . '" place="' . StructuredData::escapeXml($deathplace) . "\"/>\n";
     }
     if ($chrdate || $chrplace) {
         $result .= '<event_fact type="Christening" date="' . StructuredData::escapeXml($chrdate) . '" place="' . StructuredData::escapeXml($chrplace) . "\"/>\n";
     }
     if ($burdate || $burplace) {
         $result .= '<event_fact type="Burial" date="' . StructuredData::escapeXml($burdate) . '" place="' . StructuredData::escapeXml($burplace) . "\"/>\n";
     }
     $result .= $images;
     $result .= "</person>\n";
     return $result;
 }
Esempio n. 17
0
function UW_Layouts_checkActionIsLayout( $action, $article ) {
	global $wgOut, $wgDBprefix, $wgLayoutCategories, $wgLayoutUseCategoryPage,
		$wgNoLayoutOption, $wgContLang,
		$wgLayoutCategoryNSWhiteList;

	// not layout = do nothing
	if ( $action != "layout" )
		return true;

	/* if this page already exists, or
	 * is a discussion page, redirect
	 * to the regular edit page */
	if ( $article->fetchContent() !== false
	|| ( $article->mTitle->getNamespace() % 2 ) ) {
		$wgOut->redirect( $article->mTitle->getInternalUrl ( "action=edit" ) );
		return false;
	}

	// pluck out the bits that we need from mTitle
	$title = $article->mTitle->getPrefixedText();
	$url   = $article->mTitle->getInternalUrl();
	$name  = $article->mTitle->getPrefixedURL();
	$namespace = $article->mTitle->getNamespace();

	

	$wgOut->setPageTitle ( wfMsg ( "layouts_title" ) );

	/* fetch all articles/pages in the NS_LAYOUT namespace
	 * by directly querying the database. mediawiki doesn't
	 * provide any OO way of doing this :( */
	$db = wfGetDB( DB_MASTER );
	$layouts = $db->resultObject ( $db->query ( "select * from {$wgDBprefix}page where page_namespace=" . NS_LAYOUT . " order by page_title" ) );

	$wgOut->addHTML ( wfMsg ( "layouts_chooselayout", $title ) . "
		<form action='$url' method='get'>
			<input type='hidden' name='title' value='$name' />
			<input type='hidden' name='action' value='edit' />
	" );

	/* iterate the pages we found in the Layouts
	 * namespace, and list each one as an option
	 * as long as it is not restricted to specific
	 * namespaces */
	$default = true;
	while ( $result = $layouts->next() ) {
		// page info
		$title = Title::newFromURL ( $result->page_title )->getText();
		$revision = Revision::loadFromPageId ( $db, $result->page_id );
		$text = $revision->getText();
		$lines = explode ( "\n", $text );
		$namespaces = array();

		// add this layout to the choices by default
		$add = true;

		/* go through the layout text and see if it has an @namespace
		 * restriction, if so only add the layout as a choice if we find
		 * the namespace of this page in the layout text */
		foreach ( $lines as $line ) {
			if ( preg_match ( "/^@namespace(.+?)$/m", $line, $matches ) ) {
				$namespaces = explode ( " ", trim( $matches[1] ) );
				$add = in_array ( $wgContLang->getNsText ( $namespace ), $namespaces ) ||
					$namespace == NS_MAIN && in_array ( "Main", $namespaces );
			}
		}
		if ( $add ) {
			$checked = $default ? "checked='checked'" : "";
			$default = false;
			$fm_id = "layout-" . $result->page_id;
			$wgOut->addHTML( "
				<div>
					<input type='radio' name='layout' id='$fm_id' value='$title' $checked/>
					<label for='$fm_id'>$title</label>
				</div>
			" );
		}
	}

	/* include an option to create a page
	 * without any layout (before any are created,
	 * this will be the only option available) */
	if ( $wgNoLayoutOption ) {
		$wgOut->addHTML( "
			<div>
				<input type='radio' name='layout' id='layout-0' value='none' />
				<label for='layout-0'>" . wfMsg( 'layouts_nolayout' ) . "</label>
			</div>
		" );
	}
	$wgOut->addHTML( "<br />" );

	/* check to see if we are allowing categories on the layout page
	 * and if so then, either grab all the categories, or get them from
	 * the designated page (do this for pages in the whitelisted namespaces) */
	if ( $wgLayoutCategories && in_array( $namespace, $wgLayoutCategoryNSWhiteList ) ) {
		$categories = array();

		/* get the categories from the page if desired,
		 * otherwise grab them from the db */
		if ( $wgLayoutUseCategoryPage ) {
			$revision = Revision::newFromTitle( Title::newFromDBKey( wfMsgForContent( 'layouts-layoutcategorypage' ) ) );
			$results = $revision ? split( "\n", $revision->getText() ) : array();
			foreach ( $results as $result ) {
				if ( trim ( $result ) != '' )
					$categories[] = Title::newFromText( trim( $result ) )->getDBkey();
			}
		} else {
			// todo: implement this later...
		}

		// add radio buttons for the categories
		$default = true;
		$title = $article->mTitle->getPrefixedText();
		$wgOut->addHTML( "<div id='category-box'>" . wfMsg ( "layouts_choosecategory", $title ) );
		foreach ( $categories as $category ) {
			$checked = $default ? "checked='checked'" : "";
			$default = false;
			$fm_id = "category-$category";
			$caption = Title::newFromDBkey ( $category )->getText();
			$wgOut->addHTML( "
				<div>
					<input type='radio' name='category' id='$fm_id' value='$fm_id' $checked/>
					<label for='$fm_id'>$caption</label>
				</div>
			" );
		}
		$wgOut->addHTML ( "</div><br />" );
	}

	$wgOut->addHTML ( "<input type='submit' value='" . wfMsg( 'layouts_continue' ) . "' />" );
	$wgOut->addHTML ( "</form>" );

	return false;
}
Esempio n. 18
0
 function getImageFromIntro($articleId, $revid = '')
 {
     global $wgMemc;
     $key = wfMemcKey("GallerySlide_getImageFromIntro", $articleId, $revid);
     $result = $wgMemc->get($key);
     if ($result) {
         return $result;
     }
     $dbr = wfGetDB(DB_SLAVE);
     $rev = Revision::loadFromPageId($dbr, $articleId);
     if ($rev) {
         $intro = Wikitext::getIntro($rev->getText());
         if ($intro) {
             preg_match("@\\[\\[Image:[^\\]|\\|]*@", $intro, $results);
             $results = $results[0];
             if ($revid != '') {
                 $wgMemc->set($key, $results);
             }
         }
     }
     return $results;
 }
Esempio n. 19
0
 /**
  * Update the searchindex table for a given pageid
  * @param $dbw DatabaseBase a database write handle
  * @param $pageId Integer: the page ID to update.
  * @return null|string
  */
 public function updateSearchIndexForPage($dbw, $pageId)
 {
     // Get current revision
     $rev = Revision::loadFromPageId($dbw, $pageId);
     $title = null;
     if ($rev) {
         $titleObj = $rev->getTitle();
         $title = $titleObj->getPrefixedDBkey();
         $this->output("{$title}...");
         # Update searchindex
         # TODO: pass the Content object to SearchUpdate, let the search engine decide how to deal with it.
         $u = new SearchUpdate($pageId, $titleObj->getText(), $rev->getContent()->getTextForSearchIndex());
         $u->doUpdate();
         $this->output("\n");
     }
     return $title;
 }
 public function run()
 {
     global $wgServerName, $wgScriptPath, $wgServer, $wgScriptExtension;
     wfProfileIn('DSMWUpdateJob::run()');
     $urlServer = 'http://' . $wgServerName;
     $revids = array();
     $revids1 = array();
     $page_ids = array();
     // Getting all the revision ids of pages having been logootized
     $db = wfGetDB(DB_SLAVE);
     $model_table = $db->tableName('model');
     $sql = "SELECT `rev_id` FROM {$model_table}";
     $res = $db->query($sql);
     while ($row = $db->fetchObject($res)) {
         $revids[] = $row->rev_id;
     }
     $db->freeResult($res);
     // if (count($revids)==0) $revids=array();
     // Getting all the revision ids without the pages in the DSMW namespaces and
     // Administration_pull_site_addition and Administration_pull_site_addition pages
     $rev_table = $db->tableName('revision');
     $page_table = $db->tableName('page');
     $sql = "SELECT {$rev_table}.`rev_id` FROM {$rev_table}, {$page_table} WHERE\n     `rev_page`=`page_id` and `page_namespace`!= 110 and `page_namespace`!= 200\n        and `page_namespace`!= 210 and `page_namespace`!= 220\nand `page_title`!= \"Administration_pull_site_addition\"\nand `page_title` != \"Administration_push_site_addition\"";
     $res1 = $db->query($sql);
     while ($row = $db->fetchObject($res1)) {
         $revids1[] = $row->rev_id;
     }
     $db->freeResult($res1);
     // if (count($revids1)==0) $revids1=array();
     // Array_diff returns an array containing all the entries from $revids1 that are
     // not present in $revids.
     $diff = array_diff($revids1, $revids);
     // get page ids of these revisions (each id must be unique in the array)
     foreach ($diff as $id) {
         $page_id = $db->selectField('revision', 'rev_page', array('rev_id' => $id));
         $page_ids[] = $page_id;
     }
     $page_ids = array_unique($page_ids);
     sort($page_ids);
     // Now we can logootize:
     if (count($page_ids) != 0) {
         foreach ($page_ids as $pageid) {
             $title = Title::newFromID($pageid);
             $ns = $title->getNamespace();
             $lastRev = Revision::loadFromPageId($db, $pageid);
             $pageText = $lastRev->getText();
             // load an empty model
             $model = DSMWRevisionManager::loadModel(0);
             $logoot = new logootEngine($model);
             $listOp = $logoot->generate("", $pageText);
             $modelAfterIntegrate = $logoot->getModel();
             $tmp = serialize($listOp);
             $patchid = sha1($tmp);
             if ($ns == NS_FILE || $ns == NS_IMAGE || $ns == NS_MEDIA) {
                 $apiUrl = $wgServer . $wgScriptPath . "/api" . $wgScriptExtension;
                 $onPage = str_replace(array(' '), array('%20'), $lastRev->getTitle()->getText());
                 $download = $apiUrl . "?action=query&titles=File:" . $onPage . "&prop=imageinfo&format=php&iiprop=mime|url|size";
                 $resp = Http::get($download);
                 $resp = unserialize($resp);
                 $a = $resp['query']['pages'];
                 $a = current($a);
                 $a = $a['imageinfo'];
                 $a = current($a);
                 $mime = $a['mime'];
                 $size = $a['size'];
                 $url = $a['url'];
                 $patch = new DSMWPatch(false, true, null, $urlServer . $wgScriptPath, 0, null, null, null, $mime, $size, $url, null);
                 $patch->storePage('File:' . $lastRev->getTitle()->getText(), $lastRev->getId());
             } else {
                 $patch = new DSMWPatch(false, false, $listOp, $urlServer, 0);
                 $patch->storePage($lastRev->getTitle()->getText(), $lastRev->getId());
             }
             DSMWRevisionManager::storeModel($lastRev->getId(), $sessionId = session_id(), $modelAfterIntegrate, $blobCB = 0);
         }
     }
     wfProfileOut('DSMWUpdateJob::run()');
     return true;
 }
<?php

require_once 'commandLine.inc';
$ids = "293218\n1458185\n343777\n856387\n1677524\n1721537\n192848\n79808\n1505894\n879407\n1023181\n103131\n435606\n87338\n428901\n718557\n1537406\n1565579\n95437\n1565207\n1532074\n105776\n410570\n873961\n45478\n253306\n385809\n266041\n465621\n940983\n1169790\n1037958\n268153\n271172\n113516\n1261254\n262253\n147113\n464241\n52264\n132109\n1180452\n546054\n1558817\n583107\n56321\n1556310\n353783\n49628\n400631\n16096\n1586576\n1556651\n209808\n154100\n1557764\n332036\n1198622\n354457\n1557220\n1557764\n594917\n1533668\n627194\n107400\n93510\n896185\n620548\n1298681\n102084\n69206\n60978\n460429\n108308\n\n44869\n594786\n6616\n195212\n395780\n284320\n1160296\n525972\n41463\n1340799\n949690\n367232\n156031\n5381\n135070\n305140\n71597\n238416\n4248\n268500\n11165\n725970\n1040550\n115572\n205656\n1569816\n964394\n76169\n225997\n79349\n41215\n372369\n66025\n714460\n285776\n903670\n10345\n1632548\n1216822\n1388793\n750198\n247466\n944749\n\n155059\n239041\n544426\n1041815\n157126\n533780\n43410\n74803\n533285\n537764\n133959\n5036\n86659\n1166828\n1636602\n9918\n936899\n56605\n158632\n8003\n70377\n83332\n599907\n654174\n1318072\n576316\n1064067\n1465220\n799811\n17020\n223230\n403203\n532101\n574003\n186215\n405812\n959695\n1362047\n185483\n1627988\n1634080\n1083337\n649172\n5681\n960648\n182793\n353763\n174683\n617815\n684646\n1385190\n244684\n33054\n738710\n126154\n1426860\n746932\n356988\n674398\n300770\n12255\n597487\n38011\n597902\n950549\n1371899\n265725\n1627959\n930828\n1624282\n42125\n81412\n77848\n1597786\n1608508\n1558005\n103449\n9184\n745235\n1557186\n610300\n1556810\n362183\n668789\n56476\n1569236\n132134\n182493\n69136\n1515705\n1527053\n558174\n41155\n1637340\n1556543\n1557646\n1555015\n1518920\n1579522\n269650\n363520\n68793\n1595728\n15289\n323894\n446970\n380830\n1579123\n67330\n1597538\n292655\n905624\n492091\n1596541\n11526\n754485\n424413\n853670\n967734\n449075\nMarissa\n34594\n1272477\n366056\n7972\n1137180\n560124\n85310\n687748\n1969\n931728\n939333\n1495974\n50112\n621834\n1021803\n66221\n414332\n1142375\n1344698\n220735\n998266\n434038\n13268\n212640\n745787\n1010608\n1539600\nredo\n44302\n595181\n101036\n1695886\n1686028\n1652713\n1652315\n4613\n730179\n789661\n47444\n1674485\n1663378\n1662760\n65016\n1650934\n50014\n496316\n105859\n1688217\n1664239\n1595073\n80725\n595181\n53609\n135954\n227470\n14148\n41841\n134340\n460567\n1661305\n1635768\n1596516\n1596618\n38095\n1650377\n1676124\n1663096\n1677550\n1677595\n800719\n1626170\n145261\n1536635\n664433\n68272\n128310\n377025\n1634995\n1075998\n54461\n7197\n67833\n1661370\n1628398\n78736\n1579738\n1650830\n15379\n1946\n1250069\n1685152\n1513961\n231977\n5599\n381917\n660329\n474725\n554138\n45873\n1646551\n581573\n7591\n1154204\n646041\n48908\n1608630\n1219513\n1631813\n185073\n376275\n450500\n343361\n698608\n505203\n1004731\n643751\n1065504\n427632\n740996\n540055\n1043594\n831229\n1071317\n689312\n316789\n790463\n313020\n720891\n1043594\n831229\n1093272\n1256125\n290819\n1152632\n150584\n45495\n675255\n1142280\n1046656\n65103\n523016\n1195616\n1283908\n1215453\n647426\n1057944\n1228704\n828434\n1355626\n229719\n233030\n46426\n43458\n\n223094\n304351\n373589\n1166548\n69830\n19488\n143868\n1194264\n1038139\n624962\n286342\n275773\n524351\n6852\n179729\n868393\n88282\n839921\n249997\n513223\n144189\n251778\n532706\n733933\n1186918\n716346\n780975\n232526\n203025\n315655\n413961\n328615\n40591\n6286\n49159\n111710\n67597\n1621989\n1569463\n1358239\n1684933\n1728352\n1687923\n492430\n435728\n538541\n1279265\n603793\n812575\n407670\n226887\n748841\n1357594\n1654\n1369658\n1174432\n126945\n225089\n368899\n4549\n52787\n126477\n661881\n1091018\n1250626\n408180\n517057\n623033\n719286\n798297\n1039134\n10225\n39250\n187650\n1691353\n1771787\n1779599\n1625936\n1160310\n1260676\n1337044\n686425\n397758\n1160266\n1627351\n1389197\n714217\n469894\n214745\n301596\n1219658\n930735\n169661\n175414\n1147821\n934520\n1116442\n753113\n1127175\n1114004\n1156047\n1127180\n49473\n696128\n49530\n47222\n234827\n52022\n235535\n753749\n1202189\n1036693\n1005358\n1228640\n32642\n699358\n198213\n74684\n317230\n750688\n107500\n593088\n941602\n479457\n25839\n145469\n1390022\n322839\n1375098\n548597\n651251\n695832\n22209\n1123434\n199454\n807251\n647668\n586744\n365209\n761445\n702222\n812214\n167312\n1342210\n925101\n722481\n1655060\n1364827\n813577\n1040577\n405553\n609052\n559540\n1316759\n764285\n211877\n456380\n24308\n1109415\n722746\n608791\n424744\n100752\n599965\n497667\n150353\n25266\n608277\n3399\n1623432\n1598393\n1593498\n708097\n428168\n779594\n1364200\n1624510\n688406\n496354\n1091859\n1632103\n1626134\n572577\n1486373\n895523\n1029027\n712045\n76302\n23451\n1114329\n123540\n603539\n522057\n1376086\n792624\n1013644\n910895\n513504\n44202\n704208\n908829\n1643116\n669507\n154710\n442648\n795652\n1623740\n1623778\n1628223\n386615\n789502\n467347\n332489\n912865\n123997\n376455\n35088\n266068\n703349\n504142\n697909\n1639614\n443906\n578918\n185523\n745050\n2185\n521065\n1975\n345260\n1094244\n315882\n630190\n781457\n27131\n610599\n77625\n7084\n1047304\n328059\n938155\n22707\n166543\n336676\n708968\n780482\n333977\n296181\n260364\n1340551\n165056\n655574\n910391\n1358872\n1330052\n1199353\n97911\n33597\n646202\n533379\n739115\n596735\n1115364\n254579\n20738\n24787\n10019\n114974\n1241328\n141648\n80700\n584936\n372525\n411998\n293646\n758929\n496161\n923818\n656855\n139550\n1289081\n279500\n462083\n672907\nX\n16191\n1579539\n908546\n1406008\n493262\n1233997\n799889\n326775\n56977\n1585148\n42532\n483758\n523826\n1251562\n1502929\n534478\n11834\n501692\n68645\n1269320\n1674117\n1071912\n1591092\n659100\n1042227\n458022\n887524\n1633956\n1229079\n1357393\n109839\n271750\n262055\n763729\n650395\n961433\n402787\n321954\n424887\n60199\n258041\n936768\n1083683\n161287\n822998\n840586\n228756\n407197\n165335\n1270719\n168336\n1626630\n1019642\n408434\n1275578\n279171\n1370491\n1594698\n298138\n656888\n184791\n580599\n652081\n711273\n560760\n532401\n444857\n433532\n413134\n387095\n304656\n298983\n276699\n1387482\n138211\n1122275\n11007\n107582\n1005226\n371599\n294790\n293300\n55379\n4761\n444590\n205184\n20169\n142778\n1296303\n1199351\n1319670\n692422\n646412\n514012\n1626804\n1370018\n845337\n761813\n841237\n819637\n791894\n723151\n676617\n672104\n60986\n593031\n516181\n394439\n374513\n342473\n321470\n263316\n195403\n173967\n1676082\n1664733\n1662807\n1652797\n1625785\n1570536\n1529565\n1512181\n1385060\n1290762\n1178665\n1114950\n1089043\n1065766\n1023231\n100249\n46231\n456431\n1114950\n16427\n921664\n688066\n249988\n247586\n662660\n565550\n561771\n1716888\n1635175\n1611075\n1579063\n1692172\n1648670\n1557727\n1391236\n1122357\n1551820\n1034169\n1546678\n1518609\n215041\n126368\n408028\n273019\n378473\n124952\n39667\n16895\n40832\n102686\n41130\n594137\n1541279\n1422110\n1560322\n1635990\n1602640\n1370862\n640400\n601101\n513412\n653705\n1167764\n1064605\n891639\n830177\n819480\n1004088\n922974\nredo\n4297\n477626\n226653\n4874\n1609957\n18220\n1594449\n1578813\n1714981\n1640033\n1503378\n1337137\n1072592\n1502531\n1433440\n848162\n480703\n183153\n1568329\n1075028\n863788\n1134159\n83568\n125072\n1191717\n1180334\n647971\n745689\n1450480\n1201546\n1640298\n1563506\n1432212\n1238433\n1228070\n1404751\n1302799\n1347226\n673198\n607242\n740492\n679526\n73953\n69206\n\n\n\n\n289770\n543208\n54024\n526130\n337053\n271051\n213889\n173964\n17363\n17098\n168870\n59208\n1312115\n1284000\n1194983\n1389269\n1341445\n1330484\n774292\n683808\n650520\n1146640\n1067214\n872973\n19549\n583227\n223908\n210546\n210201\n353714\n285266\n234826\n200447\n198256\n76748\n210189\n209933\n200453\n1144960\n1132246\n1100036\n448097\n1536195\n1393781\n1194222\n403901\n390853\n909960\n880109\n1652383\n644694\n151953\n176063\n138949\n1648\n128699\n1157544\n1294058\n1094819\n462613\n502317\n222331\n183681\n37464\n757491\n669608\n659570\n57907\n520154\n39945\n1581170\n595897\n569844\n651424\n603999\n36162\n9286\n526420\n445989\n661980\n1159100\n1087344\n1183406\n709301\n705104\n893027\n805953\n1681758\n1719922\n1639486\n190514\n231222\n669638\n276746\n856934\n73314\n322008\n249712\n767852\n620918\n656673\n178939\n75824\n351087\n388810\n56416\n475823\n1310575\n1554459\n1625194\n870138\n882202\n944772\n651583\n463174\n1626274\n1101917\n26048\n419080\n1237570\n791488\n1340707\n31476\n692585\n177287\n525663\n1174274\n935015\n811782\n1341951\n1027148\n1247921\n1050853\n1330727\n647397\n251422\n391722\n1129933\n921768\n10217\n339361\n446478\n1137899\n1237332\n32344\n841947\n288995\n7421\n627328\n919109\n1559222\n758815\n1580841\n257034\n956440\n257034\n590908\n328304\n677188\n285169\n203982\n274814\n155742\n1035189\n649009\n1144743\n121236\n1251706\n674170\n766187\n43927\n657289\n696513\n1194400\n7102\n1170966\n468475\n708200\n256426\n194933\n209772\n468176\n364080\n1280764\n594973\n926206\n1219472\n733807\n656978\n756118\n308217\n181697\n520605\n517934\n627331\n1031904\n643984\n1195440\n699004\n827741\n569052\n\n3062\n706450\n517444\n563288\n312991\n22978\n1051393\n679411\n1092423\n1012451\n399644\n168008\n757944\n765516\n1090360\n1032910\n1022376\n1127285\n662180\n1262542\n621894\n649159\n722864\n265453\n453928\n463189\n895474\n1029900\n701844\n954465\n738134\n1242830\n406405\n342876\n1106300\n600291\n420906\n392129\n517672\n35949\n1033838\n988326\n1242491\n152711\n1105854\n2859\n736240\n912866\n838799\n1082309\n547160\n663884\nx\n1178946\n1238949\n566899\n584068\n506124\n723808\n1176616\n1145714\n852709\n1263244\n1206222\n407088\n1151649\n377067\n202832\n909358\n1115168\n139182\n940313\n600249\n1003798\n554767\n637041\n914714\n410285\n848372\n922218\n699034\nx\nx\n900753\n859681\n585277\n1168364\n1753\n238103\n877814\n140045\n427174\n176432\n74120\n385025\n578217\n719282\n829061\n1179062\n403362\n1062618\n672923\n176879\n1153952\n493251\n830226\n28506\n870003\n840852\n1124587\n896295\n246085\n653997\n568396\n204677\n947845\n758712\n7126\n424710\n957072\n841264\n776487\n719037\n717312\n709757\n690643\n684214\n657549\n647217\n643027\n638991\n579131\n495241\n479545\n297560\n244350\n190820\n178990\n138201\n123473\n1230947\n1180494\n1085469\n1053143\n388790\n641371\n1157455\n53730\n126628\n223983\n738645\n4636\n178869\n915210\n147109\n650021\n636838\n46847\n1227581\n416228\n395463\n595638\n630476\n1043540\n1061034\n426359\n\n\n\n511482\n493231\n11422\n680071\n411958\n57048\n521150\n377103\n1095611\n699504\n1124736\n183012\n714225\n644520\n583411\n683599\n672727\n478774\n130716\n456163\n1069570\n1017592\n1199885\n752684\n1116707\n746269\n920557\n770586\n275465\n444601\n190129\n41899\n51781\n5115\n202808\n698425\n3050\n465591\n116877\n383462\n1215922\n1260255\n741838\n877064\n607263\n304442\n69816\n1246191\n1064178\n735790\n1030775\n773716\n7567\n242786\n406011\n1080420\n123938\n947988\n832497\n810690\n260441\n781613\n327248\n78437\n1218446\n1229320\n1597966\n1056317\n1503903\n1018266\n1521691\n1343828\n745410\n257640\n314226\n1509463\n45845\n103666\n484932\n131682\n377073\n1512611\n1379564\n352099\n352108\n547480\n476148\n28322\n370514\n257691\n782546\n1687460\n64172\n1288340\n1464214\n728807\n352047\n259776\n195007\n184459\n1289383\n1253947\n614551\n384162\n293564\n516346\n1391114\n233701\n1260421\n1674135\n46332\n1602\n1749276\n257637\n426534\n38893\n1028946\n872362\n473428\n558696\n59020\n966367\n1520484\n27650\n726555\n559628\n705568\n1626710\n448114\n272783\n1605490\n1408253\n11514\n714767\n586006\n441597\n455510\n85004\n514745\n488518\n26702\n1106901\n1660401\n353481\n1654134\n76249\n155900\n447981\n612095\n646446\n1008716\n656581\n1638436\n719901\n973155\n637442\n1737737\n1685244\n1367626\n744944\n595889\n246630\n401530\n1089601\n703295\n311978\n996363\n777148\n50026\n1678515\n1478295\n471102\n179770\n8067\n735004\n600053\n517271\n482735\n158282\n566593\n633817\n266955\n837839\n1333898\n516392\n683224\n149212\n1120695\n240017\n1352042\n97460\n151117\n112632\n545674\n338942\n659118\n137846\n276744\n1582473\n27650\n896528\n1250213\n191702\n1195536\n555795\n23155\n340407\n1700464\n1050592\n264583\n610856\n637842\n1670123\n285863\n380752\n507506\n111831\n888344\n241321\n181884\n643070\n1673054\n792010\n672050\n666290\n1252600\n386692\n919453\n1118618\n1413287\n646988\n980864\n768184\n512267\n729315\n464048\n666361\n728440\n922061\n51643\n1315327\n327308\n1365679\n669653\n672733\n262289\n1196518\n314896\n81766\n1443321\n167292\n642280\n337166\n403845\n422063\n861951\n408802\n1253182\n410190\n187453\n233483\n1352395\n245214\n679716\n409620\n1563106\n209566\n480459\n754410\n416621\n648249\n649204\n257537\n305886\n149644\n677156\n622855\n293399\n1182860\n1216707\n1114125\n677269\n674271\n198963\n1187461\n1021824\n965474\n103962\n1578859\n23841\n367450\n1327861\n472264\n1106499\n469604\n860972\n14822\n1558405\n1461838\n34748\n630965\n674271\n310162\n369059\n281320\n337299\n386170\n997453\n1193157\n817275\n1178118\n306230\n675977\n1074897\n308782\n584022\n418228\n74643\n70404\n30095\n291933\n366565\n84587\n\n\n1246087\n1660134\n430856\n921427\n1660137\n438182\n1660136\n358112\n1631370\n917391\n376320\n1523773\n652965\n718474\n84392\n841112\n639445\n491793\n665652\n1504151\n257679\n1283112\n239211\n251521\n841044\n13755\n282923\n654951\n1188614\n846946\n239626\n456898\n166598\n665269\n10766\n1202725\n1667079\n1667076\n321187\n1514116\n1515274\n1615225\n633521\n324498\n227907\n653030\n1501807\n324273\n1178950\n30329\n272623\n212977\n701828\n194770\n1305234\n1390402\n1513510\n448224\n622608\n684129\n1537178\n174250\n1098117\n947899\n188221\n1631401\n1571905\n69346\n1206133\n651181\n173365\n1526438\n35861\n861770\n1330494\n137185\n1628834\n878456\n6774\n684796\n501810\n1150859\n46502\n1610768\n348435\n1236630\n5779\n50831\n388421\n1609238\n332395\n1004403\n596043\n21009\n1519707\n819205\n401021\n1151957\n170323\n322794\n971366\n1346676\n169150\n832004\n871612\n310167\n413608\n747347\n137056\n78535\n376515\n308163\n1338366\n762075\n757064\n423510\n1349859\n316181\n1204746\n1271227\n69227\n39532\n495451\n421426\n478039\n697826\n648368\n29769\n1617875\n1075207\n1623700\n635983\n665023\n919023\n682237\n71220\n659508\n1508083\n1283787\n137725\n1055387\n548713\n337281\n1118980\n696819\n1222091\n826192\n825969\n232235\n344143\n178877\n358588\n575410\n830975\n38462\n103358\n990040\n342905\n1531341\n1678655\n1122091\n1236292\n498833\n498838\n925837\n80535\n167154\n1267892\n1320812\n695300\n342213\n341645\n160597\n162693\n256425\n337151\n98710\n253242\n1227590\n662206\n577161\n297809\n287719\n1404895\n695516\n596689\n160163\n1123536\n40163\n716071\n774245\n679429\n206893\n1264005\n570095\n1230728\n1653311\n544231\n1042822\n584812\n152897\n309900\n501560\n127303\n738748\n303714\n378730\n647232\n618610\n146929\n933263\n37138\n1197272\n148666\n988194\n1443947\n1619987\n1045015\n9778\n341553\n1578000\n346448\n1684821\n467612\n18474\n1618044\n148724\n299088\n908525\n389656\n1234729\n304589\n272395\n1595486\n930657\n178996\n424516\n1084525\n281132\n1237474\n1105469\n572381\n291731\n38998\n308271\n103299\n664472\n1564836\n544671\n1202866\n826645\n1641773\n337620\n336915\n236448\n1217900\n643021\n614947\n517596\n498374\n717532\n72095\n1309359\n1611985\n802053\n603611\n1627\n533781\n796985\n865993\n486407\n770707\n1637373\n284995\n232000\n759515\n416425\n1330191\n1024130\n1294508\n800476\n1217993\n1293894\n663190\n1181777\n277166\n169429\n1009151\n139629\n631505\n1138945\n294245\n1275276\n1147812\n1294428\n570633\n96755\n188523\n1278323\n265752\n1203128\n665257\n396530\n259134\n176724\n400579\n496677\n713901\n522250\n1387393\n1630\n12968\n139661\n139404\n1023275\n862154\n1358088\n654417\n1395080\n1670143\n1218230\n1686186\n22526\n1428246\n528267\n1664275\n125836\n60365\n99661\n25085\n1008549\n51136\n643204\n701885\n371676\n990058\n748409\n71861\n627492\n293311\n1664584\n1629723\n16281\n15485\n1473805\n1658635\n241185\n549327\n508099\n507296\n1259487\n54219\n1142263\n26006\n132438\n801493\n264930\n761228\n695479\n397365\n337862\n283920\n1158011\n925001\n482891\n274352\n1694592\n1158004\n530595\n1676109\n160079\n1782\n1694449\n323703\n42092\n647841\n192095\n60287\n303803\n200986\n1228086\n1100174\n1007078\n1324130\n570096\n1300717\n1199229\n193186\n503174\n1676499\n18749\n1686\n395514\n593895\n682215\n700923\n9712\n294966\n1606648\n189714\n10777\n720811\n506352\n40524\n377831\n306056\n280994\n40748\n333657\n319924\n50152\n1291950\n1222494\n1182858\n1401894\n627927\n547894\n368816\n1361785\n620536\n403205\n1437869\n277286\n1703884\n1717986\n299080\n206691\n260119\n180296\n291115\n1361021\n417423\n364878\n513980\n116875\n392933\n557349\n1304583\n1300448\n1296213\n1234737\n809641\n306952\n262088\n1438408\n576238\n1124406\n1140859\n67166\n1710545\n1004541\n1543588\n258226\n183777\n784515\n699457\n586757\n13726\n922869\n413923\n1204820\n638330\n1477639\n1428290\n89500\n145595\n610532\n339088\n714789\n1765095\n14839\n494734\n512467\n1128353\n191621\n959381\n804006\n1760449\n115139\n1605352\n682932\n1747035\n1360532\n358061\n99673\n10988\n1612457\n754501\n333657\n958327\n271896\n1544367\n836252\n969956\n315311\n522002\n1366109\n424289\n1316393\n129627\n1305369\n659600\n\n259291\n40673\n828751\n716360\n665302\n930989\n1240375\n576839\n167679\n94699\n1044723\n135972\n112921\n653365\n831043\n306473\n478444\n166906\n428656\n1035595\n105088\n489932\n1228673\n1298630\n98043\n186486\n1624233\n1510450\n1392844\n412476\n751963\n515778\n378014\n257418\n11157\n703523\n252299\n1228087\n1172884\n888826\n1063922\n1196708\n266922\n264793\n264670\n4833\n252107\n24391\n10868\n134856\n64180\n1450358\n490488\n842463\n388847\n643135\n431950\n36158\n1212658\n768215\n566337\n224079\n857260\n956388\n905703\n217988\n566337\n70166\n528268\n19019\n26490\n41043\n1265894\n1228071\n146211\n1097726\n1594394\n1640759\n1013051\n729398\n889456\n187127\n770313\n1142798\n389632\n875939\n421495\n463471\n1601097\n120441";
$ids = explode("\n", $ids);
$dbr = wfGetDB(DB_SLAVE);
foreach ($ids as $id) {
    if ($id == "") {
        continue;
    }
    $id = trim($id);
    $r = Revision::loadFromPageId($dbr, $id);
    if ($r) {
        if (preg_match("@^===[^\r^\n]+[\r\n]+[^#]@m", $r->getText(), $matches)) {
            echo $r->getTitle()->getText() . "\n";
        }
    } else {
        echo "ERROR: " . $id . "\n";
    }
}
Esempio n. 22
0
 /**
  * moveComplete -- hook
  *
  * @static
  * @access public
  *
  * @param Title $oOldTitle,
  * @param Title $oNewTitle,
  * @param User $oUser,
  * @param Integer $pageId,
  * @param Integer $redirId,
  *
  * @author Piotr Molski (MoLi)
  * @return true
  */
 public static function moveComplete(&$oOldTitle, &$oNewTitle, &$oUser, $pageId, $redirId = 0)
 {
     global $wgCityId;
     wfProfileIn(__METHOD__);
     if ($oNewTitle instanceof Title) {
         $oRevision = Revision::newFromTitle($oNewTitle);
         if ($oRevision instanceof Revision) {
             $revId = $oRevision->getId();
             if (empty($pageId)) {
                 $pageId = $oRevision->getPage();
             }
             if ($revId > 0 && $pageId > 0) {
                 $oScribeProducer = new ScribeProducer('edit', $pageId, $revId);
                 if (is_object($oScribeProducer)) {
                     $oScribeProducer->send_log();
                 }
             } else {
                 Wikia::log(__METHOD__, "error", "Cannot send log via scribe ({$wgCityId}): empty revision or page id: {$revId}, {$pageId}");
             }
         } else {
             Wikia::log(__METHOD__, "error", "Cannot send log via scribe ({$wgCityId}): invalid revision for new title");
         }
     } else {
         $isTitle = is_object($oNewTitle);
         Wikia::log(__METHOD__, "error", "Cannot send log via scribe ({$wgCityId}): invalid new title: {$isTitle}");
     }
     if ($redirId > 0) {
         # old title as a #Redirect
         if ($oOldTitle instanceof Title) {
             $oRevision = Revision::newFromTitle($oOldTitle);
             if (!is_object($oRevision)) {
                 $db = wfGetDB(DB_MASTER);
                 $oRevision = Revision::loadFromPageId($db, $redirId);
             }
             if ($oRevision instanceof Revision) {
                 $revId = $oRevision->getId();
                 $newPageId = $oRevision->getPage();
                 if (empty($newPageId) || $newPageId < 0) {
                     $newPageId = $oOldTitle->getArticleId();
                 }
                 if ($revId > 0 && $newPageId > 0) {
                     $oScribeProducer = new ScribeProducer('edit', $newPageId, $revId);
                     if (is_object($oScribeProducer)) {
                         $oScribeProducer->send_log();
                     }
                 } else {
                     Wikia::log(__METHOD__, "error", "Cannot send log via scribe ({$wgCityId}): empty revision or new page id: {$revId}, {$newPageId}");
                 }
             } else {
                 Wikia::log(__METHOD__, "error", "Cannot send log via scribe ({$wgCityId}): invalid revision for old title: {$redirId}");
             }
         } else {
             $isTitle = is_object($oOldTitle);
             Wikia::log(__METHOD__, "error", "Cannot send log via scribe ({$wgCityId}): invalid old title: {$isTitle}");
         }
     }
     wfProfileOut(__METHOD__);
     return true;
 }
Esempio n. 23
0
 private function addWhatLinksHere(&$people, &$families)
 {
     $pageids = $this->getWhatLinksHere();
     $db =& wfGetDB(DB_MASTER);
     foreach ($pageids as $pageid) {
         $revision = Revision::loadFromPageId($db, $pageid);
         if ($revision) {
             $text = $revision->getText();
             if ($revision->getTitle()->getNamespace() == NS_PERSON) {
                 $this->addTitle($people, 'person', $revision->getTitle()->getText(), $text);
             } else {
                 if ($revision->getTitle()->getNamespace() == NS_FAMILY) {
                     $this->addTitle($families, 'family', $revision->getTitle()->getText(), $text);
                 }
             }
         }
     }
 }
Esempio n. 24
0
/**
 * Get index contents for specified page_id's
 *
 * @param unknown_type $args page_id=id,id,id,... (up to IAF_MAX_COUNT_CONTENTS)|index=1 to return watchers (defaults to 0)
 * @return IAF_SUCCESS, IAF_INVALID_ARG
 */
function wfGetPageIndexContents($args)
{
    global $wgAjaxCachePolicy;
    // set cache policy
    $wgAjaxCachePolicy->setPolicy(0);
    // validate input arguments
    $status = IAF_SUCCESS;
    $result = array();
    $args = iafGetArgs($args);
    $pageidString = iafGetArg($args, 'page_id', null);
    $index = iafGetArg($args, 'index', false);
    $pageids = explode(',', $pageidString);
    if (!$pageidString || count($pageids) > IAF_MAX_COUNT_CONTENTS) {
        $status = IAF_INVALID_ARG;
    } else {
        $db =& wfGetDB(DB_SLAVE);
        $db->ignoreErrors(true);
        foreach ($pageids as $pageid) {
            $ns = 0;
            $fullTitle = '';
            $timestamp = '';
            $revid = '';
            $text = '';
            $popularity = '';
            $users = array();
            $trees = array();
            $revision = Revision::loadFromPageId($db, $pageid);
            $errno = $db->lastErrno();
            if ($errno != 0) {
                $status = IAF_DB_ERROR;
                break;
            }
            if ($revision) {
                $ns = $revision->getTitle()->getNamespace();
                $fullTitle = $revision->getTitle()->getPrefixedText();
                $timestamp = $revision->getTimestamp();
                $revid = $revision->getId();
                $text =& $revision->getText();
                $errno = $db->lastErrno();
                if ($errno != 0) {
                    $status = IAF_DB_ERROR;
                    break;
                }
                if ($index) {
                    $watcherCount = 0;
                    $dbkey = $revision->getTitle()->getDBkey();
                    $rows = $db->select(array('watchlist', 'user'), array('user_name'), array('wl_user=user_id', 'wl_namespace' => $ns, 'wl_title' => $dbkey));
                    $errno = $db->lastErrno();
                    if ($errno != 0) {
                        $status = IAF_DB_ERROR;
                        break;
                    }
                    while ($row = $db->fetchObject($rows)) {
                        $users[] = '<user>' . StructuredData::escapeXml($row->user_name) . '</user>';
                        $watcherCount++;
                    }
                    $db->freeResult($rows);
                    $rows = $db->select(array('familytree_page', 'familytree'), array('ft_user', 'ft_name'), array('fp_tree_id=ft_tree_id', 'fp_namespace' => $ns, 'fp_title' => $dbkey));
                    $errno = $db->lastErrno();
                    if ($errno != 0) {
                        $status = IAF_DB_ERROR;
                        break;
                    }
                    while ($row = $db->fetchObject($rows)) {
                        $temp = $row->ft_user . '/' . $row->ft_name;
                        $trees[] = '<tree>' . StructuredData::escapeXml($temp) . '</tree>';
                    }
                    $db->freeResult($rows);
                    $wlhCount = 0;
                    $sns = Namespac::getSubject($ns);
                    if ($sns == NS_MAIN || $sns == NS_IMAGE || $sns == NS_CATEGORY || $sns == NS_PROJECT || $sns == NS_USER || $sns == NS_HELP || $sns == NS_SOURCE || $sns == NS_REPOSITORY || $sns == NS_PORTAL || $sns == NS_PLACE || $sns == NS_TRANSCRIPT) {
                        if (($ns == NS_SOURCE || $ns == NS_REPOSITORY) && ($dbkey == 'Family_History_Library' || $dbkey == 'Family_History_Center')) {
                            $wlhCount = 100000;
                        } else {
                            if ($ns == NS_IMAGE) {
                                $wlhCount = $db->selectField('imagelinks', 'count(*)', array('il_to' => $dbkey));
                            } else {
                                $wlhCount = $db->selectField('pagelinks', 'count(*)', array('pl_namespace' => $ns, 'pl_title' => $dbkey));
                            }
                        }
                        if ($ns == NS_PLACE || $ns == NS_USER || $ns == NS_CATEGORY) {
                            // discount links to place/user pages
                            $wlhCount = $wlhCount / 128;
                        }
                    }
                    $popularity = $watcherCount + $wlhCount > 0 ? max(20, min(384, floor(128 * log10($watcherCount * 4 + $wlhCount)))) : 0;
                }
            }
            $result[] = '<page page_id="' . $pageid . '" namespace="' . $ns . '" title="' . StructuredData::escapeXml($fullTitle) . '" rev_id="' . $revid . '" rev_timestamp="' . $timestamp . '" popularity="' . $popularity . '">' . '<contents>' . StructuredData::escapeXml($text) . '</contents>' . join("\n", $users) . join("\n", $trees) . '</page>';
        }
    }
    // return status
    return "<result status=\"{$status}\">" . join("\n", $result) . '</result>';
}
Esempio n. 25
0
 /**
  * Handle API calls to get the steps from an article 
  */
 private function doAPI()
 {
     global $wgRequest, $wgOut, $wgContLang;
     $articleIds = $wgRequest->getVal("articleIds");
     $articleIds = preg_split("@,@", $articleIds);
     $dbr = wfGetDB(DB_SLAVE);
     $wgOut->setArticleBodyOnly(true);
     $articles = array();
     foreach ($articleIds as $articleId) {
         if (is_numeric($articleId)) {
             $r = Revision::loadFromPageId($dbr, $articleId);
             if ($r) {
                 $txt = $r->getText();
                 $intro = Wikitext::getIntro($txt);
                 $text = Wikitext::getStepsSection($txt, true);
                 $lines = preg_split("@\n@", $text[0]);
                 $text = "";
                 // We remove extra lines technically in the 'steps' section, but which don't actually contain steps
                 // Find the last line starting with a '#'
                 $lastLine = 0;
                 $n = 0;
                 foreach ($lines as $line) {
                     if ($line[0] == '#') {
                         $lastLine = $n;
                     }
                     $n++;
                 }
                 // Truncate lines after the last line with a '#'
                 $n = 0;
                 foreach ($lines as $line) {
                     if ($n > $lastLine) {
                         break;
                     }
                     if ($n != 0) {
                         $text .= "\n";
                     }
                     $text .= $line;
                     $n++;
                 }
                 if (strlen($text) > 0) {
                     $articles[$articleId] = array("steps" => $text, "intro" => $intro, "altImageTags" => array($wgContLang->getNSText(NS_IMAGE)));
                 }
             }
         }
     }
     $wgOut->addHTML(json_encode($articles));
 }
Esempio n. 26
0
 /**
  * Handle API calls to get the steps from an article 
  */
 private function doAPI()
 {
     global $wgRequest, $wgOut, $wgContLang;
     $articleIds = $wgRequest->getVal("articleIds");
     $articleIds = preg_split("@,@", $articleIds);
     $dbr = wfGetDB(DB_SLAVE);
     $wgOut->setArticleBodyOnly(true);
     $articles = array();
     foreach ($articleIds as $articleId) {
         if (is_numeric($articleId)) {
             $r = Revision::loadFromPageId($dbr, $articleId);
             if ($r) {
                 $txt = $r->getText();
                 $intro = Wikitext::getIntro($txt);
                 $text = Wikitext::getStepsSection($txt, true);
                 if (is_array($text) && sizeof($text) > 0) {
                     $articles[$articleId] = array("steps" => $text[0], "intro" => $intro, "altImageTags" => array($wgContLang->getNSText(NS_IMAGE)));
                 }
             }
         }
     }
     $wgOut->addHTML(json_encode($articles));
 }
Esempio n. 27
0
 /**
  * Loads everything except the text
  * This isn't necessary for all uses, so it's only done if needed.
  * @private
  */
 function loadLastEdit()
 {
     global $wgOut;
     if (-1 != $this->mUser) {
         return;
     }
     # New or non-existent articles have no user information
     $id = $this->getID();
     if (0 == $id) {
         return;
     }
     $this->mLastRevision = Revision::loadFromPageId($this->getDB(), $id);
     if (!is_null($this->mLastRevision)) {
         $this->mUser = $this->mLastRevision->getUser();
         $this->mUserText = $this->mLastRevision->getUserText();
         $this->mTimestamp = $this->mLastRevision->getTimestamp();
         $this->mComment = $this->mLastRevision->getComment();
         $this->mMinorEdit = $this->mLastRevision->isMinor();
     }
 }
Esempio n. 28
0
/**
 *Integrates the operation(LogootOp) into the article via the logoot algorithm
 *
 * @param <Object> $operation
 * @param <String or Object> $article
 */
function logootIntegrate($operations, $article)
{
    global $wgCanonicalNamespaceNames;
    $indexNS = 0;
    wfDebugLog('p2p', '@@@@@@@@@@@@@@@@@@@@@@@ - function logootIntegrate : ' . $article);
    $dbr = wfGetDB(DB_SLAVE);
    $dbr->immediateBegin();
    if (is_string($article)) {
        //if there is a space in the title, repalce by '_'
        $article = str_replace(" ", "_", $article);
        if (strpos($article, ":") === false) {
            $pageid = $dbr->selectField('page', 'page_id', array('page_title' => $article));
        } else {
            //if there is a namespace
            preg_match("/^(.+?)_*:_*(.*)\$/S", $article, $tmp);
            $articleWithoutNS = $tmp[2];
            $NS = $tmp[1];
            if (in_array($NS, $wgCanonicalNamespaceNames)) {
                foreach ($wgCanonicalNamespaceNames as $key => $value) {
                    if ($NS == $value) {
                        $indexNS = $key;
                    }
                }
            }
            $pageid = $dbr->selectField('page', 'page_id', array('page_title' => $articleWithoutNS, 'page_namespace' => $indexNS));
        }
        // get the page namespace
        $pageNameSpace = $dbr->selectField('page', 'page_namespace', array('page_id' => $pageid));
        /*the ns must not be a pullfeed, pushfeed, changeset or patch namespace.
           If the page name is the same in different ns we can get the wrong
           * page id
          */
        if ($pageNameSpace == PULLFEED || $pageNameSpace == PUSHFEED || $pageNameSpace == PATCH || $pageNameSpace == CHANGESET) {
            $pageid = 0;
        }
        $lastRev = Revision::loadFromPageId($dbr, $pageid);
        if (is_null($lastRev)) {
            $rev_id = 0;
        } else {
            $rev_id = $lastRev->getId();
        }
        wfDebugLog('p2p', '      -> pageId : ' . $pageid);
        wfDebugLog('p2p', '      -> rev_id : ' . $rev_id);
        $title = Title::newFromText($article);
        $article = new Article($title);
    } else {
        $rev_id = $article->getRevIdFetched();
    }
    $listOp = array();
    //$blobInfo = BlobInfo::loadBlobInfo($rev_id);
    $model = manager::loadModel($rev_id);
    $logoot = manager::getNewEngine($model, DSMWSiteId::getInstance()->getSiteId());
    // new logootEngine($model);
    foreach ($operations as $operation) {
        wfDebugLog('p2p', ' - operation : ' . $operation);
        wfDebugLog('testlog', ' - operation : ' . $operation);
        if (!$operation instanceof LogootOperation) {
            $operation = operationToLogootOp($operation);
        }
        if ($operation != false && is_object($operation)) {
            $listOp[] = $operation;
            wfDebugLog('testlog', ' -> Operation: ' . $operation->getLogootPosition()->toString());
            //$blobInfo->integrateBlob($operation);
        }
    }
    //end foreach operations
    $p = new LogootPatch($rev_id, $listOp);
    $logoot->integrate($p);
    $modelAfterIntegrate = $logoot->getModel();
    //$revId = utils::getNewArticleRevId();
    $status = $article->doEdit($modelAfterIntegrate->getText(), $summary = "");
    $revId = $status->value['revision']->getId();
    manager::storeModel($revId, $sessionId = session_id(), $modelAfterIntegrate, $blobCB = 0);
    return array($revId, $p);
}
Esempio n. 29
0
 private function fromRequest($request, $name, $ns)
 {
     $targetTitle = '';
     if ($this->mTarget) {
         $t = Title::newFromText($this->mTarget);
         if ($t && $t->getNamespace() == $ns) {
             $targetTitle = $t->getText();
         }
     }
     $result = array();
     // get titles from request, except target
     for ($i = 0; $request->getVal("{$name}_id{$i}"); $i++) {
         $titleString = $request->getVal("{$name}{$i}");
         if ($titleString) {
             if (!$this->titleStringHasId($titleString)) {
                 $titleString = $this->standardizeNameCase($titleString);
             }
             $t = Title::newFromText($titleString, $ns);
             // don't save target title; we'll update that when the target page is saved
             if ($t && $t->getNamespace() == $ns && $t->getText() != $targetTitle && !in_array($t->getText(), $result)) {
                 $result[] = $t->getText();
             }
         }
     }
     // add any titles from WLH (even target if it already links here)
     // uses mDestFile instead of mUploadSaveName because the latter hasn't been set yet
     // only do this if the request is a "get" with a passed-in wpDestFile
     if (!$request->wasPosted() && $this->mDestFile) {
         $t = Title::newFromText($this->mDestFile, NS_IMAGE);
         $filename = $t ? $t->getText() : '';
         $pageids = $this->getWhatLinksHere();
         $db =& wfGetDB(DB_MASTER);
         // make sure this is the most current set of pages that link here
         foreach ($pageids as $pageid) {
             $revision = Revision::loadFromPageId($db, $pageid);
             if ($revision && $revision->getTitle()->getNamespace() == $ns) {
                 $text = $revision->getText();
                 $xml = $this->getXml($name, $text);
                 if (isset($xml)) {
                     foreach ($xml->image as $img) {
                         if ((string) $img['filename'] == $filename && !in_array($revision->getTitle()->getText(), $result)) {
                             $result[] = $revision->getTitle()->getText();
                         }
                     }
                 }
             }
         }
     }
     return $result;
 }
Esempio n. 30
0
<?php

require_once 'commandLine.inc';
$dbw = wfGetDB(DB_MASTER);
$wgUser = User::newFromName('MiscBot');
// get first x pages.
$pages = WikiPhoto::getAllPages($dbw);
$count = 0;
foreach ($pages as $page) {
    $rev = Revision::loadFromPageId($dbw, $page['id']);
    if ($rev) {
        $wikitext = $rev->getText();
        $intro = Wikitext::getIntro($rev->getText());
        if (strpos($intro, "{{nointroimg}}") !== false) {
            $intro = str_replace("{{nointroimg}}", "", $intro);
            $wikitext = Wikitext::replaceIntro($wikitext, $intro, true);
            $title = Title::newFromID($page['id']);
            print "Removing from: " . $title . "\n";
            $article = new Article($title);
            $article->doEdit($wikitext, "Removing nointroimg template");
            $count++;
        }
    }
}
print "Deleted from {$count} articles\n";