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


PHP WikiPage::getId方法代码示例

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


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

示例1: onArticleRollbackComplete

 /**
  * @desc Purge the contributors data to guarantee that it will be refreshed next time it is required
  *
  * @param WikiPage $wikiPage
  * @param User $user
  * @param $revision
  * @param $current
  * @return bool
  */
 public static function onArticleRollbackComplete(WikiPage $wikiPage, User $user, $revision, $current)
 {
     $articleId = $wikiPage->getId();
     $key = MercuryApi::getTopContributorsKey($articleId, MercuryApiController::NUMBER_CONTRIBUTORS);
     WikiaDataAccess::cachePurge($key);
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:MercuryApiHooks.class.php

示例2: testGetContent_failure

 /**
  * @covers Revision::getContent
  */
 public function testGetContent_failure()
 {
     $rev = new Revision(['page' => $this->the_page->getId(), 'content_model' => $this->the_page->getContentModel(), 'text_id' => 123456789]);
     $this->assertNull($rev->getContent(), "getContent() should return null if the revision's text blob could not be loaded.");
     // NOTE: check this twice, once for lazy initialization, and once with the cached value.
     $this->assertNull($rev->getContent(), "getContent() should return null if the revision's text blob could not be loaded.");
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:10,代码来源:RevisionStorageTest.php

示例3: getFromattedUgroupsThatCanReadWikiPage

 public function getFromattedUgroupsThatCanReadWikiPage(WikiPage $wiki_page)
 {
     $project = $this->project_manager->getProject($wiki_page->getGid());
     $ugroup_ids = $this->permission_manager->getAuthorizedUgroupIds($wiki_page->getId(), self::WIKI_PERMISSION_READ);
     $ugroup_ids = $this->filterWikiPagePermissionsAccordingToService($project, $ugroup_ids);
     $ugroup_ids = $this->filterWikiPagePermissionsAccordingToProject($project, $ugroup_ids);
     return $this->literalizer->ugroupIdsToString($ugroup_ids, $project);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:8,代码来源:PermissionsManager.class.php

示例4: makeRevision

 protected function makeRevision($props = null)
 {
     if ($props === null) {
         $props = array();
     }
     if (!isset($props['content']) && !isset($props['text'])) {
         $props['text'] = 'Lorem Ipsum';
     }
     if (!isset($props['comment'])) {
         $props['comment'] = 'just a test';
     }
     if (!isset($props['page'])) {
         $props['page'] = $this->the_page->getId();
     }
     $rev = new Revision($props);
     $dbw = wfgetDB(DB_MASTER);
     $rev->insertOn($dbw);
     return $rev;
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:19,代码来源:RevisionStorageTest.php

示例5: doDelete

 /**
  * Delete $page
  */
 protected function doDelete($page)
 {
     if ($page instanceof Title) {
         $page = new WikiPage($page);
     }
     if ($this->logActions) {
         print "Delete " . $page->getTitle() . " = " . $page->getId() . "\n";
     }
     $page->doDeleteArticle('-');
 }
开发者ID:hermannschwaerzlerUIBK,项目名称:IntraACL,代码行数:13,代码来源:evaluation.php

示例6: onArticleSaveComplete

 /**
  * Refresh cache when article is edited
  *
  * @param WikiPage $article
  */
 static function onArticleSaveComplete(&$article, &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId)
 {
     wfProfileIn(__METHOD__);
     $articleId = $article->getId();
     // tell service to invalidate cached data for edited page
     $service = new self($articleId);
     $service->regenerateData();
     wfDebug(__METHOD__ . ": cache cleared for page #{$articleId}\n");
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:16,代码来源:PageStatsService.class.php

示例7: elseif

 /**
  * @param WikiPage $page Page we are updating
  * @param integer|null $pageId ID of the page we are updating [optional]
  * @throws MWException
  */
 function __construct(WikiPage $page, $pageId = null)
 {
     parent::__construct(false);
     // no implicit transaction
     $this->page = $page;
     if ($page->exists()) {
         $this->pageId = $page->getId();
     } elseif ($pageId) {
         $this->pageId = $pageId;
     } else {
         throw new MWException("Page ID not known, perhaps the page doesn't exist?");
     }
 }
开发者ID:mb720,项目名称:mediawiki,代码行数:18,代码来源:LinksDeletionUpdate.php

示例8: elseif

 /**
  * @param WikiPage $page Page we are updating
  * @param integer|null $pageId ID of the page we are updating [optional]
  * @param string|null $timestamp TS_MW timestamp of deletion
  * @throws MWException
  */
 function __construct(WikiPage $page, $pageId = null, $timestamp = null)
 {
     parent::__construct();
     $this->page = $page;
     if ($pageId) {
         $this->pageId = $pageId;
         // page ID at time of deletion
     } elseif ($page->exists()) {
         $this->pageId = $page->getId();
     } else {
         throw new InvalidArgumentException("Page ID not known. Page doesn't exist?");
     }
     $this->timestamp = $timestamp ?: wfTimestampNow();
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:20,代码来源:LinksDeletionUpdate.php

示例9: fetchContent

 /**
  * Get text of an article from database
  * Does *NOT* follow redirects.
  *
  * @param $oldid Int: 0 for whatever the latest revision is
  * @return mixed string containing article contents, or false if null
  */
 function fetchContent($oldid = 0)
 {
     if ($this->mContentLoaded) {
         return $this->mContent;
     }
     # Pre-fill content with error message so that if something
     # fails we'll have something telling us what we intended.
     $t = $this->getTitle()->getPrefixedText();
     $d = $oldid ? wfMsgExt('missingarticle-rev', array('escape'), $oldid) : '';
     $this->mContent = wfMsgNoTrans('missing-article', $t, $d);
     if ($oldid) {
         $revision = Revision::newFromId($oldid);
         if (!$revision) {
             wfDebug(__METHOD__ . " failed to retrieve specified revision, id {$oldid}\n");
             return false;
         }
         // Revision title doesn't match the page title given?
         if ($this->mPage->getID() != $revision->getPage()) {
             $function = array(get_class($this->mPage), 'newFromID');
             $this->mPage = call_user_func($function, $revision->getPage());
             if (!$this->mPage->getId()) {
                 wfDebug(__METHOD__ . " failed to get page data linked to revision id {$oldid}\n");
                 return false;
             }
         }
     } else {
         if (!$this->mPage->getLatest()) {
             wfDebug(__METHOD__ . " failed to find page data for title " . $this->getTitle()->getPrefixedText() . "\n");
             return false;
         }
         $revision = $this->mPage->getRevision();
         if (!$revision) {
             wfDebug(__METHOD__ . " failed to retrieve current page, rev_id " . $this->mPage->getLatest() . "\n");
             return false;
         }
     }
     // @todo FIXME: Horrible, horrible! This content-loading interface just plain sucks.
     // We should instead work with the Revision object when we need it...
     $this->mContent = $revision->getText(Revision::FOR_THIS_USER);
     // Loads if user is allowed
     $this->mRevIdFetched = $revision->getId();
     $this->mContentLoaded = true;
     $this->mRevision =& $revision;
     wfRunHooks('ArticleAfterFetchContent', array(&$this, &$this->mContent));
     return $this->mContent;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:53,代码来源:Article.php

示例10: displayMenu

   /**
    * displayMenu - public
    */
   function displayMenu()
   {
       print '
   <table class="ServiceMenu">
     <tr>
       <td>';
       switch (DEFAULT_LANGUAGE) {
           case 'fr_FR':
               $attatch_page = "DéposerUnFichier";
               $preferences_page = "PréférencesUtilisateurs";
               break;
           case 'en_US':
           default:
               $attatch_page = 'UpLoad';
               $preferences_page = 'UserPreferences';
               break;
       }
       $attatch_menu = $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'menuattch');
       $preferences_menu = $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'menuprefs');
       $help_menu = $GLOBALS['Language']->getText('global', 'help');
       print '
   <ul class="ServiceMenu">
     <li><a href="' . $this->wikiLink . '&view=browsePages">' . $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'menupages') . '</a>&nbsp;|&nbsp;</li>';
       if (UserManager::instance()->getCurrentUser()->isLoggedIn()) {
           print '<li><a href="javascript:help_window(\'' . $this->wikiLink . '&pagename=' . $attatch_page . '&pv=1\')">' . $attatch_menu . '</a>&nbsp;|&nbsp;</li>';
           print '<li><a href="' . $this->wikiLink . '&pagename=' . $preferences_page . '">' . $preferences_menu . '</a>&nbsp;|&nbsp;</li>';
       }
       if (user_ismember($this->gid, 'W2')) {
           print '<li><a href="' . $this->wikiAdminLink . '">' . $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'menuadmin') . '</a>&nbsp;|&nbsp;</li>';
       }
       print '<li>' . help_button('WikiService.html', false, $help_menu) . '</li>
  </ul>';
       print '
 </td>
 <td align="right" valign="top">';
       if (user_ismember($this->gid, 'W2')) {
           $wiki = new Wiki($this->gid);
           $permInfo = "";
           if ('wiki' == $this->view) {
               // User is browsing a wiki page
               $wp = new WikiPage($this->gid, $_REQUEST['pagename']);
               $permLink = $this->wikiAdminLink . '&view=pagePerms&id=' . $wp->getId();
               if ($wp->permissionExist()) {
                   $permInfo = '<a href="' . $permLink . '"> ' . '<img src="' . util_get_image_theme("ic/lock.png") . '" border="0" alt="' . $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'lock_alt') . '" title="' . $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'lock_title_spec') . '"/></a>';
               }
           }
           if ($wiki->permissionExist()) {
               $permInfo .= '<a href="/wiki/admin/index.php?group_id=' . $this->gid . '&view=wikiPerms"> ' . '<img src="' . util_get_image_theme("ic/lock.png") . '" border="0" alt="' . $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'lock_alt') . '" title="' . $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'lock_title_set') . '"/>' . '</a>';
           }
           if ($permInfo) {
               print $permInfo;
           }
       }
       //Display printer_version link only in wiki pages
       if (isset($_REQUEST['pagename'])) {
           print '
         (<a href="' . $_SERVER['REQUEST_URI'] . '&pv=1" title="' . $GLOBALS['Language']->getText('wiki_views_wikiserviceviews', 'lighter_display') . '">
         <img src="' . util_get_image_theme("msg.png") . '" border="0">&nbsp;' . $GLOBALS['Language']->getText('global', 'printer_version') . '</A> ) 
         </li>';
       }
       print '
    </td>
   </tr>
 </table>';
   }
开发者ID:nterray,项目名称:tuleap,代码行数:68,代码来源:WikiServiceViews.class.php

示例11: broken_testDoRollback

 /**
  * @todo FIXME: this is a better rollback test than the one below, but it
  * keeps failing in jenkins for some reason.
  */
 public function broken_testDoRollback()
 {
     $admin = new User();
     $admin->setName("Admin");
     $text = "one";
     $page = $this->newPage("WikiPageTest_testDoRollback");
     $page->doEditContent(ContentHandler::makeContent($text, $page->getTitle()), "section one", EDIT_NEW, false, $admin);
     $user1 = new User();
     $user1->setName("127.0.1.11");
     $text .= "\n\ntwo";
     $page = new WikiPage($page->getTitle());
     $page->doEditContent(ContentHandler::makeContent($text, $page->getTitle()), "adding section two", 0, false, $user1);
     $user2 = new User();
     $user2->setName("127.0.2.13");
     $text .= "\n\nthree";
     $page = new WikiPage($page->getTitle());
     $page->doEditContent(ContentHandler::makeContent($text, $page->getTitle()), "adding section three", 0, false, $user2);
     # we are having issues with doRollback spuriously failing. Apparently
     # the last revision somehow goes missing or not committed under some
     # circumstances. So, make sure the last revision has the right user name.
     $dbr = wfGetDB(DB_SLAVE);
     $this->assertEquals(3, Revision::countByPageId($dbr, $page->getId()));
     $page = new WikiPage($page->getTitle());
     $rev3 = $page->getRevision();
     $this->assertEquals('127.0.2.13', $rev3->getUserText());
     $rev2 = $rev3->getPrevious();
     $this->assertEquals('127.0.1.11', $rev2->getUserText());
     $rev1 = $rev2->getPrevious();
     $this->assertEquals('Admin', $rev1->getUserText());
     # now, try the actual rollback
     $admin->addGroup("sysop");
     #XXX: make the test user a sysop...
     $token = $admin->getEditToken(array($page->getTitle()->getPrefixedText(), $user2->getName()), null);
     $errors = $page->doRollback($user2->getName(), "testing revert", $token, false, $details, $admin);
     if ($errors) {
         $this->fail("Rollback failed:\n" . print_r($errors, true) . ";\n" . print_r($details, true));
     }
     $page = new WikiPage($page->getTitle());
     $this->assertEquals($rev2->getSha1(), $page->getRevision()->getSha1(), "rollback did not revert to the correct revision");
     $this->assertEquals("one\n\ntwo", $page->getContent()->getNativeData());
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:45,代码来源:WikiPageTest.php

示例12: doSubmit

 /**
  * Submit the form parameters for the page config to the DB.
  *
  * @return mixed (true on success, error string on failure)
  */
 public function doSubmit()
 {
     # Double-check permissions
     if (!$this->isAllowed()) {
         return 'review_denied';
     }
     # We can only approve actual revisions...
     if ($this->getAction() === 'approve') {
         $rev = Revision::newFromTitle($this->page, $this->oldid);
         # Check for archived/deleted revisions...
         if (!$rev || $rev->getVisibility()) {
             return 'review_bad_oldid';
         }
         # Check for review conflicts...
         if ($this->lastChangeTime !== null) {
             // API uses null
             $lastChange = $this->oldFrev ? $this->oldFrev->getTimestamp() : '';
             if ($lastChange !== $this->lastChangeTime) {
                 return 'review_conflict_oldid';
             }
         }
         $status = $this->approveRevision($rev, $this->oldFrev);
         # We can only unapprove approved revisions...
     } elseif ($this->getAction() === 'unapprove') {
         # Check for review conflicts...
         if ($this->lastChangeTime !== null) {
             // API uses null
             $lastChange = $this->oldFrev ? $this->oldFrev->getTimestamp() : '';
             if ($lastChange !== $this->lastChangeTime) {
                 return 'review_conflict_oldid';
             }
         }
         # Check if we can find this flagged rev...
         if (!$this->oldFrev) {
             return 'review_not_flagged';
         }
         $status = $this->unapproveRevision($this->oldFrev);
     } elseif ($this->getAction() === 'reject') {
         $newRev = Revision::newFromTitle($this->page, $this->oldid);
         $oldRev = Revision::newFromTitle($this->page, $this->refid);
         # Do not mess with archived/deleted revisions
         if (!$oldRev || $oldRev->isDeleted(Revision::DELETED_TEXT)) {
             return 'review_bad_oldid';
         } elseif (!$newRev || $newRev->isDeleted(Revision::DELETED_TEXT)) {
             return 'review_bad_oldid';
         }
         # Check that the revs are in order
         if ($oldRev->getTimestamp() > $newRev->getTimestamp()) {
             return 'review_cannot_undo';
         }
         # Make sure we are only rejecting pending changes
         $srev = FlaggedRevision::newFromStable($this->page, FR_MASTER);
         if ($srev && $oldRev->getTimestamp() < $srev->getRevTimestamp()) {
             return 'review_cannot_reject';
             // not really a use case
         }
         $article = new WikiPage($this->page);
         # Get text with changes after $oldRev up to and including $newRev removed
         $new_text = $article->getUndoText($newRev, $oldRev);
         if ($new_text === false) {
             return 'review_cannot_undo';
         }
         $baseRevId = $newRev->isCurrent() ? $oldRev->getId() : 0;
         # Actually make the edit...
         $editStatus = $article->doEdit($new_text, $this->getComment(), 0, $baseRevId, $this->user);
         $status = $editStatus->isOK() ? true : 'review_cannot_undo';
         if ($editStatus->isOK() && class_exists('EchoEvent') && $editStatus->value['revision']) {
             $affectedRevisions = array();
             // revid -> userid
             $revisions = wfGetDB(DB_SLAVE)->select('revision', array('rev_id', 'rev_user'), array('rev_id <= ' . $newRev->getId(), 'rev_timestamp <= ' . $newRev->getTimestamp(), 'rev_id > ' . $oldRev->getId(), 'rev_timestamp > ' . $oldRev->getTimestamp(), 'rev_page' => $article->getId()), __METHOD__);
             foreach ($revisions as $row) {
                 $affectedRevisions[$row->rev_id] = $row->rev_user;
             }
             EchoEvent::create(array('type' => 'reverted', 'title' => $this->page, 'extra' => array('revid' => $editStatus->value['revision']->getId(), 'reverted-users-ids' => array_values($affectedRevisions), 'reverted-revision-ids' => array_keys($affectedRevisions), 'method' => 'flaggedrevs-reject'), 'agent' => $this->user));
         }
         # If this undid one edit by another logged-in user, update user tallies
         if ($status === true && $newRev->getParentId() == $oldRev->getId() && $newRev->getRawUser()) {
             if ($newRev->getRawUser() != $this->user->getId()) {
                 // no self-reverts
                 FRUserCounters::incCount($newRev->getRawUser(), 'revertedEdits');
             }
         }
     }
     # Watch page if set to do so
     if ($status === true) {
         if ($this->user->getOption('flaggedrevswatch') && !$this->page->userIsWatching()) {
             $this->user->addWatch($this->page);
         }
     }
     return $status;
 }
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:96,代码来源:RevisionReviewForm.php

示例13: getOptionsKey

 /**
  * @param WikiPage $article
  * @return mixed|string
  */
 protected function getOptionsKey($article)
 {
     $pageid = $article->getId();
     return wfMemcKey('pcache', 'idoptions', "{$pageid}");
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:9,代码来源:ParserCache.php

示例14: WikiPage

 /**
  * pagePerms - public View
  */
 function _pagePerms($postUrl = '')
 {
     $wp = new WikiPage($_REQUEST['id']);
     $pagename = $wp->getPagename();
     $eM =& EventManager::instance();
     $referenced = false;
     $eM->processEvent('isWikiPageReferenced', array('referenced' => &$referenced, 'wiki_page' => $pagename, 'group_id' => $this->gid));
     if ($referenced) {
         $label = '';
         $eM->processEvent('getPermsLabelForWiki', array('label' => &$label));
         print '<p align="center"><br><b>' . $label . '</b></p>';
     } else {
         print $GLOBALS['Language']->getText('wiki_views_wikiviews', 'set_perm_title');
         if (empty($pagename)) {
             print $GLOBALS['Language']->getText('wiki_views_wikiviews', 'empty_page');
         } else {
             print $GLOBALS['Language']->getText('wiki_views_wikiviews', 'not_empty_page', array($pagename));
             permission_display_selection_form("WIKIPAGE_READ", $wp->getId(), $this->gid, $postUrl);
         }
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:24,代码来源:WikiViews.class.php

示例15: onArticleSaveComplete

 /**
  * @param WikiPage $wikiPage
  * @param User $user
  * @param string $text
  * @param string $summary
  * @param $minoredit
  * @param $watchthis
  * @param $sectionanchor
  * @param $flags
  * @param $revision
  * @param $status
  * @param $baseRevId
  * @return bool
  */
 public static function onArticleSaveComplete(WikiPage $wikiPage, User $user, $text, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId)
 {
     ArticlesApiController::purgeCache($wikiPage->getTitle()->getArticleID());
     ArticlesApiController::purgeMethods([['getAsJson', ['id' => $wikiPage->getId()]], ['getAsJson', ['title' => $wikiPage->getTitle()->getPartialURL()]]]);
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:20,代码来源:ApiHooks.class.php


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