• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Revision类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Revision的典型用法代码示例。如果您正苦于以下问题:PHP Revision类的具体用法?PHP Revision怎么用?PHP Revision使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: executeNew

 public function executeNew(sfWebRequest $request)
 {
     $this->procedure = Doctrine::getTable('Procedure')->find($request->getParameter('procedure_id'));
     $this->last_state = $this->procedure->getLastRevision()->getRevisionStateId();
     if ($this->last_state != 4) {
         $revision = new Revision();
         $revision->setProcedureId($request->getParameter('procedure_id'));
         $this->form = new FrontRevisionForm($revision);
     }
 }
开发者ID:retrofox,项目名称:Huemul,代码行数:10,代码来源:actions.class.php


示例2: processRevision

 /**
  * Callback function for each revision, preprocessToObj()
  * @param Revision $rev
  */
 public function processRevision($rev)
 {
     $content = $rev->getContent(Revision::RAW);
     if ($content->getModel() !== CONTENT_MODEL_WIKITEXT) {
         return;
     }
     try {
         $this->mPreprocessor->preprocessToObj(strval($content->getNativeData()), 0);
     } catch (Exception $e) {
         $this->error("Caught exception " . $e->getMessage() . " in " . $rev->getTitle()->getPrefixedText());
     }
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:16,代码来源:preprocessDump.php


示例3: execute

 public function execute()
 {
     $db = wfGetDB(DB_MASTER);
     if (!$db->tableExists('revision')) {
         $this->error("revision table does not exist", true);
     }
     $this->output("Populating rev_len column\n");
     $start = $db->selectField('revision', 'MIN(rev_id)', false, __FUNCTION__);
     $end = $db->selectField('revision', 'MAX(rev_id)', false, __FUNCTION__);
     if (is_null($start) || is_null($end)) {
         $this->output("...revision table seems to be empty.\n");
         $db->insert('updatelog', array('ul_key' => 'populate rev_len'), __METHOD__, 'IGNORE');
         return;
     }
     # Do remaining chunks
     $blockStart = intval($start);
     $blockEnd = intval($start) + $this->mBatchSize - 1;
     $count = 0;
     $missing = 0;
     while ($blockStart <= $end) {
         $this->output("...doing rev_id from {$blockStart} to {$blockEnd}\n");
         $res = $db->select('revision', Revision::selectFields(), array("rev_id >= {$blockStart}", "rev_id <= {$blockEnd}", "rev_len IS NULL"), __METHOD__);
         # Go through and update rev_len from these rows.
         foreach ($res as $row) {
             $rev = new Revision($row);
             $text = $rev->getRawText();
             if (!is_string($text)) {
                 # This should not happen, but sometimes does (bug 20757)
                 $this->output("Text of revision {$row->rev_id} unavailable!\n");
                 $missing++;
             } else {
                 # Update the row...
                 $db->update('revision', array('rev_len' => strlen($text)), array('rev_id' => $row->rev_id), __METHOD__);
                 $count++;
             }
         }
         $blockStart += $this->mBatchSize;
         $blockEnd += $this->mBatchSize;
         wfWaitForSlaves(5);
     }
     $logged = $db->insert('updatelog', array('ul_key' => 'populate rev_len'), __METHOD__, 'IGNORE');
     if ($logged) {
         $this->output("rev_len population complete ... {$count} rows changed ({$missing} missing)\n");
         return true;
     } else {
         $this->output("Could not insert rev_len population row.\n");
         return false;
     }
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:49,代码来源:populateRevisionLength.php


示例4: runForTitleInternal

 /**
  * @param $title Title
  * @param $revision Revision
  * @param $fname string
  * @return void
  */
 public static function runForTitleInternal(Title $title, Revision $revision, $fname)
 {
     wfProfileIn($fname);
     $content = $revision->getContent(Revision::RAW);
     if (!$content) {
         // if there is no content, pretend the content is empty
         $content = $revision->getContentHandler()->makeEmptyContent();
     }
     // Revision ID must be passed to the parser output to get revision variables correct
     $parserOutput = $content->getParserOutput($title, $revision->getId(), null, false);
     $updates = $content->getSecondaryDataUpdates($title, null, false, $parserOutput);
     DataUpdate::runUpdates($updates);
     InfoAction::invalidateCache($title);
     wfProfileOut($fname);
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:21,代码来源:RefreshLinksJob.php


示例5: doDBUpdates

 public function doDBUpdates()
 {
     $db = $this->getDB(DB_MASTER);
     if (!$db->tableExists('revision')) {
         $this->error("revision table does not exist", true);
     } else {
         if (!$db->fieldExists('revision', 'rev_sha1', __METHOD__)) {
             $this->output("rev_sha1 column does not exist\n\n", true);
             return false;
         }
     }
     $this->output("Populating rev_len column\n");
     $start = $db->selectField('revision', 'MIN(rev_id)', false, __METHOD__);
     $end = $db->selectField('revision', 'MAX(rev_id)', false, __METHOD__);
     if (!$start || !$end) {
         $this->output("...revision table seems to be empty.\n");
         return true;
     }
     # Do remaining chunks
     $blockStart = intval($start);
     $blockEnd = intval($start) + $this->mBatchSize - 1;
     $count = 0;
     $missing = 0;
     $fields = Revision::selectFields();
     while ($blockStart <= $end) {
         $this->output("...doing rev_id from {$blockStart} to {$blockEnd}\n");
         $res = $db->select('revision', $fields, array("rev_id >= {$blockStart}", "rev_id <= {$blockEnd}", "rev_len IS NULL"), __METHOD__);
         # Go through and update rev_len from these rows.
         foreach ($res as $row) {
             $rev = new Revision($row);
             $content = $rev->getContent();
             if (!$content) {
                 # This should not happen, but sometimes does (bug 20757)
                 $this->output("Content of revision {$row->rev_id} unavailable!\n");
                 $missing++;
             } else {
                 # Update the row...
                 $db->update('revision', array('rev_len' => $content->getSize()), array('rev_id' => $row->rev_id), __METHOD__);
                 $count++;
             }
         }
         $blockStart += $this->mBatchSize;
         $blockEnd += $this->mBatchSize;
         wfWaitForSlaves();
     }
     $this->output("rev_len population complete ... {$count} rows changed ({$missing} missing)\n");
     return true;
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:48,代码来源:populateRevisionLength.php


示例6: execute

 public function execute()
 {
     $params = $this->extractRequestParams();
     $rev1 = $this->revisionOrTitleOrId($params['fromrev'], $params['fromtitle'], $params['fromid']);
     $rev2 = $this->revisionOrTitleOrId($params['torev'], $params['totitle'], $params['toid']);
     $revision = Revision::newFromId($rev1);
     if (!$revision) {
         $this->dieUsage('The diff cannot be retrieved, ' . 'one revision does not exist or you do not have permission to view it.', 'baddiff');
     }
     $contentHandler = $revision->getContentHandler();
     $de = $contentHandler->createDifferenceEngine($this->getContext(), $rev1, $rev2, null, true, false);
     $vals = array();
     if (isset($params['fromtitle'])) {
         $vals['fromtitle'] = $params['fromtitle'];
     }
     if (isset($params['fromid'])) {
         $vals['fromid'] = $params['fromid'];
     }
     $vals['fromrevid'] = $rev1;
     if (isset($params['totitle'])) {
         $vals['totitle'] = $params['totitle'];
     }
     if (isset($params['toid'])) {
         $vals['toid'] = $params['toid'];
     }
     $vals['torevid'] = $rev2;
     $difftext = $de->getDiffBody();
     if ($difftext === false) {
         $this->dieUsage('The diff cannot be retrieved. Maybe one or both revisions do ' . 'not exist or you do not have permission to view them.', 'baddiff');
     }
     ApiResult::setContentValue($vals, 'body', $difftext);
     $this->getResult()->addValue(null, $this->getModuleName(), $vals);
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:33,代码来源:ApiComparePages.php


示例7: loadTable

 /**
  * Loads the mapping table.
  */
 private function loadTable()
 {
     // no need to load multiple times.
     if ($this->loaded) {
         return;
     }
     $this->loaded = true;
     $title = Title::newFromText(self::$tablePageName);
     if (!$title->exists()) {
         return;
     }
     $tablePageRev = Revision::newFromTitle($title);
     if (is_object($tablePageRev)) {
         $tablePage = $tablePageRev->getText();
         global $wgUser;
         $parser = new Parser();
         $parser->setFunctionHook('tag_to_template', array($this, 'mg_tag_to_template'));
         // this will populate the 'map' variable
         // assuming of course that the page was edited with
         // {{#tag_to_template| ... }} instructions.
         $this->initPhase = true;
         $parser->parse($tablePage, $title, new ParserOptions($wgUser));
         $this->initPhase = false;
     }
 }
开发者ID:clrh,项目名称:mediawiki,代码行数:28,代码来源:TagToTemplate.body.php


示例8: doQuery

 /**
  * @param IDatabase $db
  * @return mixed
  */
 public function doQuery($db)
 {
     $ids = array_map('intval', $this->ids);
     $queryInfo = ['tables' => ['revision', 'user'], 'fields' => array_merge(Revision::selectFields(), Revision::selectUserFields()), 'conds' => ['rev_page' => $this->title->getArticleID(), 'rev_id' => $ids], 'options' => ['ORDER BY' => 'rev_id DESC'], 'join_conds' => ['page' => Revision::pageJoinCond(), 'user' => Revision::userJoinCond()]];
     ChangeTags::modifyDisplayQuery($queryInfo['tables'], $queryInfo['fields'], $queryInfo['conds'], $queryInfo['join_conds'], $queryInfo['options'], '');
     $live = $db->select($queryInfo['tables'], $queryInfo['fields'], $queryInfo['conds'], __METHOD__, $queryInfo['options'], $queryInfo['join_conds']);
     if ($live->numRows() >= count($ids)) {
         // All requested revisions are live, keeps things simple!
         return $live;
     }
     $archiveQueryInfo = ['tables' => ['archive'], 'fields' => Revision::selectArchiveFields(), 'conds' => ['ar_rev_id' => $ids], 'options' => ['ORDER BY' => 'ar_rev_id DESC'], 'join_conds' => []];
     ChangeTags::modifyDisplayQuery($archiveQueryInfo['tables'], $archiveQueryInfo['fields'], $archiveQueryInfo['conds'], $archiveQueryInfo['join_conds'], $archiveQueryInfo['options'], '');
     // Check if any requested revisions are available fully deleted.
     $archived = $db->select($archiveQueryInfo['tables'], $archiveQueryInfo['fields'], $archiveQueryInfo['conds'], __METHOD__, $archiveQueryInfo['options'], $archiveQueryInfo['join_conds']);
     if ($archived->numRows() == 0) {
         return $live;
     } elseif ($live->numRows() == 0) {
         return $archived;
     } else {
         // Combine the two! Whee
         $rows = [];
         foreach ($live as $row) {
             $rows[$row->rev_id] = $row;
         }
         foreach ($archived as $row) {
             $rows[$row->ar_rev_id] = $row;
         }
         krsort($rows);
         return new FakeResultWrapper(array_values($rows));
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:35,代码来源:RevDelRevisionList.php


示例9: wfSpecialCheckmylinks

function wfSpecialCheckmylinks($par)
{
    global $wgRequest, $wgSitename, $wgLanguageCode;
    global $wgDeferredUpdateList, $wgOut, $wgUser, $wgServer, $wgParser, $wgTitle;
    $fname = "wfCheckmylinks";
    $wgOut->addHTML(wfMsgWikiHtml('checkmylinks_summary'));
    if ($wgUser->getID() > 0) {
        $t = Title::makeTitle(NS_USER, $wgUser->getName() . "/Mylinks");
        if ($t->getArticleID() > 0) {
            $r = Revision::newFromTitle($t);
            $text = $r->getText();
            if ($text != "") {
                $ret = "<h3>" . wfMsg('mylinks') . "</h3>";
                $options = new ParserOptions();
                $output = $wgParser->parse($text, $wgTitle, $options);
                $ret .= $output->getText();
            }
            $size = strlen($ret);
            if ($size > 3000) {
                $wgOut->addHTML(wfMsgWikiHtml('checkmylinks_size_bad', number_format($size, 0, "", ",")));
            } else {
                $wgOut->addHTML(wfMsgWikiHtml('checkmylinks_size_good', number_format($size, 0, "", ",")));
            }
        } else {
            $wgOut->addHTML(wfMsgWikiHtml('checkmylinks_error'));
        }
    } else {
        $wgOut->addHTML(wfMsgWikiHtml('checkmylinks_notloggedin'));
    }
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:30,代码来源:Checkmylinks.php


示例10: doQuery

 /**
  * @param IDatabase $db
  * @return mixed
  */
 public function doQuery($db)
 {
     $ids = array_map('intval', $this->ids);
     $live = $db->select(array('revision', 'page', 'user'), array_merge(Revision::selectFields(), Revision::selectUserFields()), array('rev_page' => $this->title->getArticleID(), 'rev_id' => $ids), __METHOD__, array('ORDER BY' => 'rev_id DESC'), array('page' => Revision::pageJoinCond(), 'user' => Revision::userJoinCond()));
     if ($live->numRows() >= count($ids)) {
         // All requested revisions are live, keeps things simple!
         return $live;
     }
     // Check if any requested revisions are available fully deleted.
     $archived = $db->select(array('archive'), Revision::selectArchiveFields(), array('ar_rev_id' => $ids), __METHOD__, array('ORDER BY' => 'ar_rev_id DESC'));
     if ($archived->numRows() == 0) {
         return $live;
     } elseif ($live->numRows() == 0) {
         return $archived;
     } else {
         // Combine the two! Whee
         $rows = array();
         foreach ($live as $row) {
             $rows[$row->rev_id] = $row;
         }
         foreach ($archived as $row) {
             $rows[$row->ar_rev_id] = $row;
         }
         krsort($rows);
         return new FakeResultWrapper(array_values($rows));
     }
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:31,代码来源:RevDelRevisionList.php


示例11: copyCheck

 /**
  * check for plagiarism with copyscape
  * return true if there's an issue
  */
 private static function copyCheck($t)
 {
     $threshold = 0.05;
     $result = '';
     $r = Revision::newFromTitle($t);
     if (!$r) {
         return 'No such article';
     }
     $text = Wikitext::flatten($r->getText());
     $res = copyscape_api_text_search_internet($text, 'ISO-8859-1', 2);
     if ($res['count']) {
         $words = $res['querywords'];
         foreach ($res['result'] as $r) {
             if (!preg_match("@^http://[a-z0-9]*.(wikihow|whstatic|youtube).com@i", $r['url'])) {
                 //if ($r['minwordsmatched'] / $words > $threshold) {
                 //we got one!
                 $result .= '<b>Plagiarized:</b> <a href="' . $r['url'] . '">' . $r['url'] . '</a><br />';
                 //}
             }
         }
     } else {
         $result = '';
     }
     return $result;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:29,代码来源:AdminCopyCheck.body.php


示例12: parseWikitext

 protected function parseWikitext($title, $newRevId)
 {
     $apiParams = array('action' => 'parse', 'page' => $title->getPrefixedDBkey(), 'oldid' => $newRevId, 'prop' => 'text|revid|categorieshtml|displaytitle|modules|jsconfigvars');
     $api = new ApiMain(new DerivativeRequest($this->getRequest(), $apiParams, false), true);
     $api->execute();
     if (defined('ApiResult::META_CONTENT')) {
         $result = $api->getResult()->getResultData(null, array('BC' => array(), 'Types' => array(), 'Strip' => 'all'));
     } else {
         $result = $api->getResultData();
     }
     $content = isset($result['parse']['text']['*']) ? $result['parse']['text']['*'] : false;
     $categorieshtml = isset($result['parse']['categorieshtml']['*']) ? $result['parse']['categorieshtml']['*'] : false;
     $links = isset($result['parse']['links']) ? $result['parse']['links'] : array();
     $revision = Revision::newFromId($result['parse']['revid']);
     $timestamp = $revision ? $revision->getTimestamp() : wfTimestampNow();
     $displaytitle = isset($result['parse']['displaytitle']) ? $result['parse']['displaytitle'] : false;
     $modules = isset($result['parse']['modules']) ? $result['parse']['modules'] : array();
     $jsconfigvars = isset($result['parse']['jsconfigvars']) ? $result['parse']['jsconfigvars'] : array();
     if ($content === false || strlen($content) && $revision === null) {
         return false;
     }
     if ($displaytitle !== false) {
         // Escape entities as in OutputPage::setPageTitle()
         $displaytitle = Sanitizer::normalizeCharReferences(Sanitizer::removeHTMLtags($displaytitle));
     }
     return array('content' => $content, 'categorieshtml' => $categorieshtml, 'basetimestamp' => $timestamp, 'starttimestamp' => wfTimestampNow(), 'displayTitleHtml' => $displaytitle, 'modules' => $modules, 'jsconfigvars' => $jsconfigvars);
 }
开发者ID:sammykumar,项目名称:TheVRForums,代码行数:27,代码来源:ApiVisualEditorEdit.php


示例13: formatResult

 function formatResult($skin, $result)
 {
     global $wgContLang;
     # Make a link to the redirect itself
     $rd_title = Title::makeTitle($result->namespace, $result->title);
     $arr = $wgContLang->getArrow() . $wgContLang->getDirMark();
     $rd_link = $skin->makeKnownLinkObj($rd_title, '', 'redirect=no');
     # Find out where the redirect leads
     $revision = Revision::newFromTitle($rd_title);
     if ($revision) {
         # Make a link to the destination page
         $target = Title::newFromRedirect($revision->getText());
         if ($target) {
             $targetLink = $skin->makeLinkObj($target);
         } else {
             /** @todo Put in some decent error display here */
             $targetLink = '*';
         }
     } else {
         /** @todo Put in some decent error display here */
         $targetLink = '*';
     }
     # Format the whole thing and return it
     return "{$rd_link} {$arr} {$targetLink}";
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:25,代码来源:SpecialListredirects.php


示例14: renderSubpageToC

 /**
  * ToC rendering for non-hubs
  * @param $title Title of hub the ToC is generated off
  * @return string html
  */
 public function renderSubpageToC(Title $title)
 {
     $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
     // We assume $title is sane. This is supposed to be called with a $title gotten from CollaborationHubContent::getParentHub, which already checks if it is.
     $rev = Revision::newFromTitle($title);
     $content = $rev->getContent();
     $colour = $content->getThemeColour();
     $image = $content->getImage();
     $html = Html::openElement('div', ['class' => "mw-ck-theme-{$colour}"]);
     $html .= Html::openElement('div', ['class' => "mw-ck-subpage-toc"]);
     // ToC label
     $html .= Html::rawElement('div', ['class' => 'mw-ck-toc-label'], Html::rawElement('span', [], wfMessage('collaborationkit-subpage-toc-label')->inContentLanguage()->text()));
     // hubpage
     $name = $content->getDisplayName() == '' ? $title->getText() : $content->getDisplayName();
     $link = $this->renderItem($title, $name, $image, 16);
     $html .= Html::rawElement('div', ['class' => 'mw-ck-toc-subpage-hub'], $link);
     // Contents
     $html .= Html::openElement('ul', ['class' => 'mw-ck-toc-contents']);
     foreach ($content->getContent() as $item) {
         $itemTitle = Title::newFromText($item['title']);
         if (isset($item['display_title'])) {
             $itemDisplayTitle = $item['display_title'];
         } else {
             $itemDisplayTitle = $itemTitle->getSubpageText();
         }
         $itemImage = isset($item['image']) ? $item['image'] : $itemDisplayTitle;
         $itemLink = $this->renderItem($itemTitle, $itemDisplayTitle, $itemImage, $colour, 16);
         $html .= Html::rawElement('li', ['class' => 'mw-ck-toc-item'], $itemLink);
     }
     $html .= Html::closeElement('ul');
     $html .= Html::closeElement('div');
     $html .= Html::closeElement('div');
     return $html;
 }
开发者ID:wikimedia,项目名称:mediawiki-extensions-CollaborationKit,代码行数:39,代码来源:CollaborationHubTOC.php


示例15: removeImagesFromArticle

 private function removeImagesFromArticle($articleId)
 {
     $title = Title::newFromID($articleId);
     if ($title) {
         $revision = Revision::newFromTitle($title);
         $text = $revision->getText();
         //regular expressions copied out of maintenance/wikiphotoProcessImages.php
         //but modified to remove the leading BR tags if they exist
         //In the callback we keep track of each image name that we remove
         $text = preg_replace_callback('@(<\\s*br\\s*[\\/]?>)*\\s*\\[\\[Image:([^\\]]*)\\]\\]@im', function ($matches) {
             $image = $matches[2];
             $pipeLoc = strpos($image, "|");
             if ($pipeLoc !== false) {
                 $image = substr($image, 0, $pipeLoc);
             }
             AdminImageRemoval::$imagesRemoved[] = $image;
             return '';
         }, $text);
         $text = preg_replace_callback('@(<\\s*br\\s*[\\/]?>)*\\s*\\{\\{largeimage\\|([^\\}]*)\\}\\}@im', function ($matches) {
             $image = $matches[2];
             AdminImageRemoval::$imagesRemoved[] = $image;
             return '';
         }, $text);
         $text = preg_replace('@(<\\s*br\\s*[\\/]?>)*\\s*\\{\\{largeimage\\|[^\\}]*\\}\\}@im', '', $text);
         $article = new Article($title);
         $saved = $article->doEdit($text, 'Removing all images from article.');
     }
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:28,代码来源:AdminImageRemoval.body.php


示例16: execute

 public function execute()
 {
     $this->output("Looking for pages with page_latest set to 0...\n");
     $dbw = wfGetDB(DB_MASTER);
     $result = $dbw->select('page', array('page_id', 'page_namespace', 'page_title'), array('page_latest' => 0), __METHOD__);
     $n = 0;
     foreach ($result as $row) {
         $pageId = intval($row->page_id);
         $title = Title::makeTitle($row->page_namespace, $row->page_title);
         $name = $title->getPrefixedText();
         $latestTime = $dbw->selectField('revision', 'MAX(rev_timestamp)', array('rev_page' => $pageId), __METHOD__);
         if (!$latestTime) {
             $this->output(wfWikiID() . " {$pageId} [[{$name}]] can't find latest rev time?!\n");
             continue;
         }
         $revision = Revision::loadFromTimestamp($dbw, $title, $latestTime);
         if (is_null($revision)) {
             $this->output(wfWikiID() . " {$pageId} [[{$name}]] latest time {$latestTime}, can't find revision id\n");
             continue;
         }
         $id = $revision->getId();
         $this->output(wfWikiID() . " {$pageId} [[{$name}]] latest time {$latestTime}, rev id {$id}\n");
         if ($this->hasOption('fix')) {
             $article = new Article($title);
             $article->updateRevisionOn($dbw, $revision);
         }
         $n++;
     }
     $dbw->freeResult($result);
     $this->output("Done! Processed {$n} pages.\n");
     if (!$this->hasOption('fix')) {
         $this->output("This was a dry run; rerun with --fix to update page_latest.\n");
     }
 }
开发者ID:rocLv,项目名称:conference,代码行数:34,代码来源:attachLatest.php


示例17: run

 /**
  * Run a refreshLinks job
  * @return boolean success
  */
 function run()
 {
     global $wgParser;
     wfProfileIn(__METHOD__);
     $linkCache =& LinkCache::singleton();
     $linkCache->clear();
     if (is_null($this->title)) {
         $this->error = "refreshLinks: Invalid title";
         wfProfileOut(__METHOD__);
         return false;
     }
     $revision = Revision::newFromTitle($this->title);
     if (!$revision) {
         $this->error = 'refreshLinks: Article not found "' . $this->title->getPrefixedDBkey() . '"';
         wfProfileOut(__METHOD__);
         return false;
     }
     wfProfileIn(__METHOD__ . '-parse');
     $options = new ParserOptions();
     $parserOutput = $wgParser->parse($revision->getText(), $this->title, $options, true, true, $revision->getId());
     wfProfileOut(__METHOD__ . '-parse');
     wfProfileIn(__METHOD__ . '-update');
     $update = new LinksUpdate($this->title, $parserOutput, false);
     $update->doUpdate();
     wfProfileOut(__METHOD__ . '-update');
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:32,代码来源:RefreshLinksJob.php


示例18: displayQuickNoteButtons

 function displayQuickNoteButtons($id = '')
 {
     global $wgLanguageCode;
     // INTL: Only give these buttons to english site
     if ($wgLanguageCode != 'en') {
         return "";
     }
     list($tb1, $tb2, $tb3) = QuickNoteEdit::getQNTemplates();
     $start1 = strpos($tb1, "{{subst:") + strlen("{{subst:");
     $end1 = strpos($tb1, "|") - strlen("{{subst:");
     $tp1 = substr($tb1, $start1, $end1);
     $template = Title::makeTitle(NS_TEMPLATE, $tp1);
     $r = Revision::newFromTitle($template);
     $tb1_message = $r->getText();
     $tb1_message = preg_replace('/<noinclude>(.*?)<\\/noinclude>/is', '', $tb1_message);
     $tb1_message = str_replace("\n", "\\n", $tb1_message);
     $tb1_message = str_replace("'", "\\'", $tb1_message);
     $start3 = strpos($tb3, "{{subst:") + strlen("{{subst:");
     $end3 = strpos($tb3, "|") - strlen("{{subst:");
     $tp3 = substr($tb3, $start3, $end3);
     $template = Title::makeTitle(NS_TEMPLATE, $tp3);
     $r = Revision::newFromTitle($template);
     $tb3_message = $r->getText();
     $tb3_message = preg_replace('/<noinclude>(.*?)<\\/noinclude>/is', '', $tb3_message);
     $tb3_message = str_replace("\n", "\\n", $tb3_message);
     $tb3_message = str_replace("'", "\\'", $tb3_message);
     $buttons = "<div><br /><input tabindex='1' class='button secondary' type='button' value='" . wfMsg('Quicknote_Button1') . "' onclick=\"checkThumbsUp();qnButtons('postcommentForm_" . $id . "', '" . $tb1_message . "')\" />\n\t\t <input tabindex='3' class='button secondary' type='button' value='" . wfMsg('Quicknote_Button3') . "' onclick=\"qnButtons('postcommentForm_" . $id . "', '" . $tb3_message . "')\" /></div>";
     return $buttons;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:29,代码来源:QuickNoteEdit.body.php


示例19: handleImageFeedback

 private function handleImageFeedback()
 {
     global $wgRequest, $wgOut, $wgName, $wgUser;
     $dbw = wfGetDB(DB_MASTER);
     $reason = $wgRequest->getVal('reason');
     // Remove / chars from reason since this will be our delimeter in the ii_reason field
     $reason = $dbw->strencode(trim(str_replace("/", "", $reason)));
     // Add user who reported
     $reason = $wgUser->getName() . " says: {$reason}";
     $voteTypePrefix = $wgRequest->getVal('voteType') == 'good' ? 'ii_good' : 'ii_bad';
     $aid = $dbw->addQuotes($wgRequest->getVal('aid'));
     $imgUrl = substr(trim($wgRequest->getVal('imgUrl')), 1);
     $isWikiPhotoImg = 0;
     // Check if image is a wikiphoto image
     $t = Title::newFromUrl($imgUrl);
     if ($t && $t->exists()) {
         $r = Revision::newFromTitle($t);
         $userText = $r->getUserText();
         if (strtolower($r->getUserText()) == self::WIKIPHOTO_USER_NAME) {
             $isWikiPhotoImg = 1;
         }
         $url = substr($t->getLocalUrl(), 1);
         $voteField = $voteTypePrefix . "_votes";
         $reasonField = $voteTypePrefix . "_reasons";
         $sql = "INSERT INTO image_feedback \n\t\t\t\t(ii_img_page_id, ii_wikiphoto_img, ii_page_id, ii_img_url, {$voteField}, {$reasonField}) VALUES \n\t\t\t\t({$t->getArticleId()}, {$isWikiPhotoImg}, {$aid}, '{$url}', 1, '{$reason}') \n\t\t\t\tON DUPLICATE KEY UPDATE\n\t\t\t\t{$voteField} = {$voteField} + 1, {$reasonField} = CONCAT({$reasonField}, '/{$reason}')";
         $dbw->query($sql, __METHOD__);
         $wgOut->setArticleBodyOnly(true);
     }
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:29,代码来源:ImageFeedback.body.php


示例20: getQueryInfo

 function getQueryInfo()
 {
     $conds = $this->mConds;
     $conds['rev_page'] = $this->articleID;
     $conds[] = "rev_timestamp < " . $this->mDb->addQuotes($this->maxTimestamp);
     return ['tables' => ['revision', 'page', 'user'], 'fields' => array_merge(Revision::selectFields(), Revision::selectUserFields()), 'conds' => $conds, 'join_conds' => ['page' => Revision::pageJoinCond(), 'user' => Revision::userJoinCond()]];
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:7,代码来源:MergeHistoryPager.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Rewrite类代码示例发布时间:2022-05-23
下一篇:
PHP ReviewAssignment类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap