本文整理汇总了PHP中WikiPage::getTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP WikiPage::getTimestamp方法的具体用法?PHP WikiPage::getTimestamp怎么用?PHP WikiPage::getTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WikiPage
的用法示例。
在下文中一共展示了WikiPage::getTimestamp方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onNewRevisionFromEditComplete
/**
* Fetch additional information that is related to the saving that has just happened,
* e.g. regarding the last edit date. In runs where this hook is not triggered, the
* last DB entry (of MW) will be used to fill such properties.
*
* @note This method directly accesses a member of Article that is informally declared to
* be private. However, there is no way to otherwise access an article's parseroutput for
* the purpose of adding information there. If the private access ever becomes a problem,
* a global/static variable appears to be the only way to get more article data to
* LinksUpdate.
*
* @param WikiPage|Article $article WikiPage on 1.19 and later
* @param Revision $rev
* @param integer $baseID
* @param User $user
*
* @return true
*/
public static function onNewRevisionFromEditComplete($article, Revision $rev, $baseID, User $user)
{
global $smwgPageSpecialProperties;
if ($article->mPreparedEdit && $article->mPreparedEdit->output instanceof ParserOutput) {
$output = $article->mPreparedEdit->output;
$title = $article->getTitle();
if (!isset($title)) {
return true;
// nothing we can do
}
if (!isset($output->mSMWData)) {
// no data container yet, make one
$output->mSMWData = new SMWSemanticData(new SMWDIWikiPage($title->getDBkey(), $title->getNamespace(), $title->getInterwiki()));
}
$semdata = $output->mSMWData;
} else {
// give up, just keep the old data
return true;
}
if (in_array('_MDAT', $smwgPageSpecialProperties)) {
$timestamp = $article->getTimestamp();
$di = self::getDataItemFromMWTimestamp($timestamp);
if (!is_null($di)) {
$semdata->addPropertyObjectValue(new SMWDIProperty('_MDAT'), $di);
}
}
if (in_array('_LEDT', $smwgPageSpecialProperties)) {
$di = SMWDIWikiPage::newFromTitle($user->getUserPage());
if (!is_null($di)) {
$semdata->addPropertyObjectValue(new SMWDIProperty('_LEDT'), $di);
}
}
if (in_array('_NEWP', $smwgPageSpecialProperties)) {
$semdata->addPropertyObjectValue(new SMWDIProperty('_NEWP'), new SMWDIBoolean(is_null($rev->getParentId())));
}
return true;
}
示例2: showHeader
/**
* @return bool
*/
protected function showHeader()
{
global $wgOut, $wgUser, $wgMaxArticleSize, $wgLang;
global $wgAllowUserCss, $wgAllowUserJs;
if ($this->mTitle->isTalkPage()) {
$wgOut->addWikiMsg('talkpagetext');
}
// Add edit notices
$editNotices = $this->mTitle->getEditNotices($this->oldid);
if (count($editNotices)) {
$wgOut->addHTML(implode("\n", $editNotices));
} else {
$msg = wfMessage('editnotice-notext');
if (!$msg->isDisabled()) {
$wgOut->addHTML('<div class="mw-editnotice-notext">' . $msg->parseAsBlock() . '</div>');
}
}
if ($this->isConflict) {
$wgOut->wrapWikiMsg("<div class='mw-explainconflict'>\n\$1\n</div>", 'explainconflict');
$this->edittime = $this->page->getTimestamp();
} else {
if ($this->section != '' && !$this->isSectionEditSupported()) {
// We use $this->section to much before this and getVal('wgSection') directly in other places
// at this point we can't reset $this->section to '' to fallback to non-section editing.
// Someone is welcome to try refactoring though
$wgOut->showErrorPage('sectioneditnotsupported-title', 'sectioneditnotsupported-text');
return false;
}
if ($this->section != '' && $this->section != 'new') {
if (!$this->summary && !$this->preview && !$this->diff) {
$sectionTitle = self::extractSectionTitle($this->textbox1);
// FIXME: use Content object
if ($sectionTitle !== false) {
$this->summary = "/* {$sectionTitle} */ ";
}
}
}
if ($this->missingComment) {
$wgOut->wrapWikiMsg("<div id='mw-missingcommenttext'>\n\$1\n</div>", 'missingcommenttext');
}
if ($this->missingSummary && $this->section != 'new') {
$wgOut->wrapWikiMsg("<div id='mw-missingsummary'>\n\$1\n</div>", 'missingsummary');
}
if ($this->missingSummary && $this->section == 'new') {
$wgOut->wrapWikiMsg("<div id='mw-missingcommentheader'>\n\$1\n</div>", 'missingcommentheader');
}
if ($this->blankArticle) {
$wgOut->wrapWikiMsg("<div id='mw-blankarticle'>\n\$1\n</div>", 'blankarticle');
}
if ($this->selfRedirect) {
$wgOut->wrapWikiMsg("<div id='mw-selfredirect'>\n\$1\n</div>", 'selfredirect');
}
if ($this->hookError !== '') {
$wgOut->addWikiText($this->hookError);
}
if (!$this->checkUnicodeCompliantBrowser()) {
$wgOut->addWikiMsg('nonunicodebrowser');
}
if ($this->section != 'new') {
$revision = $this->mArticle->getRevisionFetched();
if ($revision) {
// Let sysop know that this will make private content public if saved
if (!$revision->userCan(Revision::DELETED_TEXT, $wgUser)) {
$wgOut->wrapWikiMsg("<div class='mw-warning plainlinks'>\n\$1\n</div>\n", 'rev-deleted-text-permission');
} elseif ($revision->isDeleted(Revision::DELETED_TEXT)) {
$wgOut->wrapWikiMsg("<div class='mw-warning plainlinks'>\n\$1\n</div>\n", 'rev-deleted-text-view');
}
if (!$revision->isCurrent()) {
$this->mArticle->setOldSubtitle($revision->getId());
$wgOut->addWikiMsg('editingold');
}
} elseif ($this->mTitle->exists()) {
// Something went wrong
$wgOut->wrapWikiMsg("<div class='errorbox'>\n\$1\n</div>\n", array('missing-revision', $this->oldid));
}
}
}
if (wfReadOnly()) {
$wgOut->wrapWikiMsg("<div id=\"mw-read-only-warning\">\n\$1\n</div>", array('readonlywarning', wfReadOnlyReason()));
} elseif ($wgUser->isAnon()) {
if ($this->formtype != 'preview') {
$wgOut->wrapWikiMsg("<div id='mw-anon-edit-warning'>\n\$1\n</div>", array('anoneditwarning', '{{fullurl:Special:UserLogin|returnto={{FULLPAGENAMEE}}}}', '{{fullurl:Special:UserLogin/signup|returnto={{FULLPAGENAMEE}}}}'));
} else {
$wgOut->wrapWikiMsg("<div id=\"mw-anon-preview-warning\">\n\$1</div>", 'anonpreviewwarning');
}
} else {
if ($this->isCssJsSubpage) {
# Check the skin exists
if ($this->isWrongCaseCssJsPage) {
$wgOut->wrapWikiMsg("<div class='error' id='mw-userinvalidcssjstitle'>\n\$1\n</div>", array('userinvalidcssjstitle', $this->mTitle->getSkinFromCssJsSubpage()));
}
if ($this->getTitle()->isSubpageOf($wgUser->getUserPage())) {
if ($this->formtype !== 'preview') {
if ($this->isCssSubpage && $wgAllowUserCss) {
$wgOut->wrapWikiMsg("<div id='mw-usercssyoucanpreview'>\n\$1\n</div>", array('usercssyoucanpreview'));
}
if ($this->isJsSubpage && $wgAllowUserJs) {
//.........这里部分代码省略.........
示例3: doSaveAsArticle
/**
* doSaveAsArticle store comment as article
*
* @static
*
* @param String $text
* @param Article|WikiPage $article
* @param User $user
* @param array $metadata
* @param string $summary
*
* @return Status TODO: Document
*/
protected static function doSaveAsArticle($text, $article, $user, $metadata = array(), $summary = '')
{
$result = null;
$editPage = new EditPage($article);
$editPage->edittime = $article->getTimestamp();
$editPage->textbox1 = self::removeMetadataTag($text);
$editPage->summary = $summary;
$editPage->watchthis = $user->isWatched($article->getTitle());
if (!empty($metadata)) {
$editPage->textbox1 = $text . Xml::element('ac_metadata', $metadata, ' ');
}
$bot = $user->isAllowed('bot');
return $editPage->internalAttemptSave($result, $bot);
}
示例4: internalAttemptSave
//.........这里部分代码省略.........
$defaultMessageText = $this->mTitle->getDefaultMessageText();
if ($this->mTitle->getNamespace() === NS_MEDIAWIKI && $defaultMessageText !== false) {
$defaultText = $defaultMessageText;
} else {
$defaultText = '';
}
if (!$this->allowBlankArticle && $this->textbox1 === $defaultText) {
$this->blankArticle = true;
$status->fatal('blankarticle');
$status->setResult(false, self::AS_BLANK_ARTICLE);
return $status;
}
if (!$this->runPostMergeFilters($textbox_content, $status, $wgUser)) {
return $status;
}
$content = $textbox_content;
$result['sectionanchor'] = '';
if ($this->section == 'new') {
if ($this->sectiontitle !== '') {
// Insert the section title above the content.
$content = $content->addSectionHeader($this->sectiontitle);
} elseif ($this->summary !== '') {
// Insert the section title above the content.
$content = $content->addSectionHeader($this->summary);
}
$this->summary = $this->newSectionSummary($result['sectionanchor']);
}
$status->value = self::AS_SUCCESS_NEW_ARTICLE;
} else {
# not $new
# Article exists. Check for edit conflict.
$this->page->clear();
# Force reload of dates, etc.
$timestamp = $this->page->getTimestamp();
$latest = $this->page->getLatest();
wfDebug("timestamp: {$timestamp}, edittime: {$this->edittime}\n");
// Check editRevId if set, which handles same-second timestamp collisions
if ($timestamp != $this->edittime || $this->editRevId !== null && $this->editRevId != $latest) {
$this->isConflict = true;
if ($this->section == 'new') {
if ($this->page->getUserText() == $wgUser->getName() && $this->page->getComment() == $this->newSectionSummary()) {
// Probably a duplicate submission of a new comment.
// This can happen when CDN resends a request after
// a timeout but the first one actually went through.
wfDebug(__METHOD__ . ": duplicate new section submission; trigger edit conflict!\n");
} else {
// New comment; suppress conflict.
$this->isConflict = false;
wfDebug(__METHOD__ . ": conflict suppressed; new section\n");
}
} elseif ($this->section == '' && Revision::userWasLastToEdit(DB_MASTER, $this->mTitle->getArticleID(), $wgUser->getId(), $this->edittime)) {
# Suppress edit conflict with self, except for section edits where merging is required.
wfDebug(__METHOD__ . ": Suppressing edit conflict, same user.\n");
$this->isConflict = false;
}
}
// If sectiontitle is set, use it, otherwise use the summary as the section title.
if ($this->sectiontitle !== '') {
$sectionTitle = $this->sectiontitle;
} else {
$sectionTitle = $this->summary;
}
$content = null;
if ($this->isConflict) {
wfDebug(__METHOD__ . ": conflict! getting section '{$this->section}' for time '{$this->edittime}'" . " (id '{$this->editRevId}') (article time '{$timestamp}')\n");
// @TODO: replaceSectionAtRev() with base ID (not prior current) for ?oldid=X case
示例5: onNewRevisionFromEditComplete
/**
* Fetch additional information that is related to the saving that has just happened,
* e.g. regarding the last edit date. In runs where this hook is not triggered, the
* last DB entry (of MW) will be used to fill such properties.
*
* @note This method directly accesses a member of Article that is informally declared to
* be private. However, there is no way to otherwise access an article's parseroutput for
* the purpose of adding information there. If the private access ever becomes a problem,
* a global/static variable appears to be the only way to get more article data to
* LinksUpdate.
*
* @param WikiPage|Article $article WikiPage on 1.19 and later
* @param Revision $rev
* @param integer $baseID
* @param User $user
*
* @return true
*/
public static function onNewRevisionFromEditComplete($article, Revision $rev, $baseID, User $user)
{
global $smwgPageSpecialProperties;
if ($article->mPreparedEdit && $article->mPreparedEdit->output instanceof ParserOutput) {
$semdata = self::getSMWDataFromParserOutput($article->mPreparedEdit->output, $article->getTitle());
} else {
// give up, just keep the old data
return true;
}
if (in_array('_MDAT', $smwgPageSpecialProperties)) {
$timestamp = $article->getTimestamp();
$di = self::getDataItemFromMWTimestamp($timestamp);
if (!is_null($di)) {
$semdata->addPropertyObjectValue(new SMWDIProperty('_MDAT'), $di);
}
}
if (in_array('_LEDT', $smwgPageSpecialProperties)) {
$di = SMWDIWikiPage::newFromTitle($user->getUserPage());
if (!is_null($di)) {
$semdata->addPropertyObjectValue(new SMWDIProperty('_LEDT'), $di);
}
}
if (in_array('_NEWP', $smwgPageSpecialProperties)) {
$semdata->addPropertyObjectValue(new SMWDIProperty('_NEWP'), new SMWDIBoolean(is_null($rev->getParentId())));
}
return true;
}