本文整理汇总了PHP中ChangesList::isUnpatrolled方法的典型用法代码示例。如果您正苦于以下问题:PHP ChangesList::isUnpatrolled方法的具体用法?PHP ChangesList::isUnpatrolled怎么用?PHP ChangesList::isUnpatrolled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ChangesList
的用法示例。
在下文中一共展示了ChangesList::isUnpatrolled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newFromRecentChange
/**
* @param RecentChange $baseRC
* @param bool $watched
*
* @return RCCacheEntry
*/
public function newFromRecentChange(RecentChange $baseRC, $watched)
{
$user = $this->context->getUser();
$counter = $baseRC->counter;
$cacheEntry = RCCacheEntry::newFromParent($baseRC);
// Should patrol-related stuff be shown?
$cacheEntry->unpatrolled = ChangesList::isUnpatrolled($baseRC, $user);
$cacheEntry->watched = $cacheEntry->mAttribs['rc_type'] == RC_LOG ? false : $watched;
$cacheEntry->numberofWatchingusers = $baseRC->numberofWatchingusers;
$cacheEntry->link = $this->buildCLink($cacheEntry);
$cacheEntry->timestamp = $this->buildTimestamp($cacheEntry);
// Make "cur" and "diff" links. Do not use link(), it is too slow if
// called too many times (50% of CPU time on RecentChanges!).
$showDiffLinks = $this->showDiffLinks($cacheEntry, $user);
$cacheEntry->difflink = $this->buildDiffLink($cacheEntry, $showDiffLinks, $counter);
$cacheEntry->curlink = $this->buildCurLink($cacheEntry, $showDiffLinks, $counter);
$cacheEntry->lastlink = $this->buildLastLink($cacheEntry, $showDiffLinks);
// Make user links
$cacheEntry->userlink = $this->getUserLink($cacheEntry);
if (!ChangesList::isDeleted($cacheEntry, Revision::DELETED_USER)) {
$cacheEntry->usertalklink = Linker::userToolLinks($cacheEntry->mAttribs['rc_user'], $cacheEntry->mAttribs['rc_user_text']);
}
return $cacheEntry;
}
示例2: extractRowInfo
/**
* Extracts from a single sql row the data needed to describe one recent change.
*
* @param stdClass $row The row from which to extract the data.
* @return array An array mapping strings (descriptors) to their respective string values.
* @access public
*/
public function extractRowInfo($row)
{
/* Determine the title of the page that has been changed. */
$title = Title::makeTitle($row->rc_namespace, $row->rc_title);
$user = $this->getUser();
/* Our output data. */
$vals = array();
$type = intval($row->rc_type);
$vals['type'] = RecentChange::parseFromRCType($type);
$anyHidden = false;
/* Create a new entry in the result for the title. */
if ($this->fld_title || $this->fld_ids) {
if ($type === RC_LOG && $row->rc_deleted & LogPage::DELETED_ACTION) {
$vals['actionhidden'] = true;
$anyHidden = true;
}
if ($type !== RC_LOG || LogEventsList::userCanBitfield($row->rc_deleted, LogPage::DELETED_ACTION, $user)) {
if ($this->fld_title) {
ApiQueryBase::addTitleInfo($vals, $title);
}
if ($this->fld_ids) {
$vals['pageid'] = intval($row->rc_cur_id);
$vals['revid'] = intval($row->rc_this_oldid);
$vals['old_revid'] = intval($row->rc_last_oldid);
}
}
}
if ($this->fld_ids) {
$vals['rcid'] = intval($row->rc_id);
}
/* Add user data and 'anon' flag, if user is anonymous. */
if ($this->fld_user || $this->fld_userid) {
if ($row->rc_deleted & Revision::DELETED_USER) {
$vals['userhidden'] = true;
$anyHidden = true;
}
if (Revision::userCanBitfield($row->rc_deleted, Revision::DELETED_USER, $user)) {
if ($this->fld_user) {
$vals['user'] = $row->rc_user_text;
}
if ($this->fld_userid) {
$vals['userid'] = $row->rc_user;
}
if (!$row->rc_user) {
$vals['anon'] = true;
}
}
}
/* Add flags, such as new, minor, bot. */
if ($this->fld_flags) {
$vals['bot'] = (bool) $row->rc_bot;
$vals['new'] = $row->rc_type == RC_NEW;
$vals['minor'] = (bool) $row->rc_minor;
}
/* Add sizes of each revision. (Only available on 1.10+) */
if ($this->fld_sizes) {
$vals['oldlen'] = intval($row->rc_old_len);
$vals['newlen'] = intval($row->rc_new_len);
}
/* Add the timestamp. */
if ($this->fld_timestamp) {
$vals['timestamp'] = wfTimestamp(TS_ISO_8601, $row->rc_timestamp);
}
/* Add edit summary / log summary. */
if ($this->fld_comment || $this->fld_parsedcomment) {
if ($row->rc_deleted & Revision::DELETED_COMMENT) {
$vals['commenthidden'] = true;
$anyHidden = true;
}
if (Revision::userCanBitfield($row->rc_deleted, Revision::DELETED_COMMENT, $user)) {
if ($this->fld_comment && isset($row->rc_comment)) {
$vals['comment'] = $row->rc_comment;
}
if ($this->fld_parsedcomment && isset($row->rc_comment)) {
$vals['parsedcomment'] = Linker::formatComment($row->rc_comment, $title);
}
}
}
if ($this->fld_redirect) {
$vals['redirect'] = (bool) $row->page_is_redirect;
}
/* Add the patrolled flag */
if ($this->fld_patrolled) {
$vals['patrolled'] = $row->rc_patrolled == 1;
$vals['unpatrolled'] = ChangesList::isUnpatrolled($row, $user);
}
if ($this->fld_loginfo && $row->rc_type == RC_LOG) {
if ($row->rc_deleted & LogPage::DELETED_ACTION) {
$vals['actionhidden'] = true;
$anyHidden = true;
}
if (LogEventsList::userCanBitfield($row->rc_deleted, LogPage::DELETED_ACTION, $user)) {
$vals['logid'] = intval($row->rc_logid);
//.........这里部分代码省略.........
示例3: extractRowInfo
//.........这里部分代码省略.........
// These should already have been filtered out of the query, but just in case.
if ($type === RC_LOG && $row->rc_deleted & LogPage::DELETED_ACTION) {
$vals['actionhidden'] = '';
$anyHidden = true;
}
if ($type !== RC_LOG || LogEventsList::userCanBitfield($row->rc_deleted, LogPage::DELETED_ACTION, $user)) {
if ($this->fld_title) {
ApiQueryBase::addTitleInfo($vals, $title);
}
if ($this->fld_ids) {
$vals['pageid'] = intval($row->rc_cur_id);
$vals['revid'] = intval($row->rc_this_oldid);
$vals['old_revid'] = intval($row->rc_last_oldid);
}
}
}
/* Add user data and 'anon' flag, if user is anonymous. */
if ($this->fld_user || $this->fld_userid) {
if ($row->rc_deleted & Revision::DELETED_USER) {
$vals['userhidden'] = '';
$anyHidden = true;
}
if (Revision::userCanBitfield($row->rc_deleted, Revision::DELETED_USER, $user)) {
if ($this->fld_userid) {
$vals['userid'] = $row->rc_user;
// for backwards compatibility
$vals['user'] = $row->rc_user;
}
if ($this->fld_user) {
$vals['user'] = $row->rc_user_text;
}
if (!$row->rc_user) {
$vals['anon'] = '';
}
}
}
/* Add flags, such as new, minor, bot. */
if ($this->fld_flags) {
if ($row->rc_bot) {
$vals['bot'] = '';
}
if ($row->rc_type == RC_NEW) {
$vals['new'] = '';
}
if ($row->rc_minor) {
$vals['minor'] = '';
}
}
/* Add sizes of each revision. (Only available on 1.10+) */
if ($this->fld_sizes) {
$vals['oldlen'] = intval($row->rc_old_len);
$vals['newlen'] = intval($row->rc_new_len);
}
/* Add the timestamp. */
if ($this->fld_timestamp) {
$vals['timestamp'] = wfTimestamp(TS_ISO_8601, $row->rc_timestamp);
}
if ($this->fld_notificationtimestamp) {
$vals['notificationtimestamp'] = $row->wl_notificationtimestamp == null ? '' : wfTimestamp(TS_ISO_8601, $row->wl_notificationtimestamp);
}
/* Add edit summary / log summary. */
if ($this->fld_comment || $this->fld_parsedcomment) {
if ($row->rc_deleted & Revision::DELETED_COMMENT) {
$vals['commenthidden'] = '';
$anyHidden = true;
}
if (Revision::userCanBitfield($row->rc_deleted, Revision::DELETED_COMMENT, $user)) {
if ($this->fld_comment && isset($row->rc_comment)) {
$vals['comment'] = $row->rc_comment;
}
if ($this->fld_parsedcomment && isset($row->rc_comment)) {
$vals['parsedcomment'] = Linker::formatComment($row->rc_comment, $title);
}
}
}
/* Add the patrolled flag */
if ($this->fld_patrol && $row->rc_patrolled == 1) {
$vals['patrolled'] = '';
}
if ($this->fld_patrol && ChangesList::isUnpatrolled($row, $user)) {
$vals['unpatrolled'] = '';
}
if ($this->fld_loginfo && $row->rc_type == RC_LOG) {
if ($row->rc_deleted & LogPage::DELETED_ACTION) {
$vals['actionhidden'] = '';
$anyHidden = true;
}
if (LogEventsList::userCanBitfield($row->rc_deleted, LogPage::DELETED_ACTION, $user)) {
$vals['logid'] = intval($row->rc_logid);
$vals['logtype'] = $row->rc_log_type;
$vals['logaction'] = $row->rc_log_action;
$logEntry = DatabaseLogEntry::newFromRow((array) $row);
ApiQueryLogEvents::addLogParams($this->getResult(), $vals, $logEntry->getParameters(), $logEntry->getType(), $logEntry->getSubtype(), $logEntry->getTimestamp());
}
}
if ($anyHidden && $row->rc_deleted & Revision::DELETED_RESTRICTED) {
$vals['suppressed'] = '';
}
return $vals;
}
示例4: extractRowInfo
private function extractRowInfo($row)
{
/* Determine the title of the page that has been changed. */
$title = Title::makeTitle($row->rc_namespace, $row->rc_title);
$user = $this->getUser();
/* Our output data. */
$vals = [];
$type = intval($row->rc_type);
$vals['type'] = RecentChange::parseFromRCType($type);
$anyHidden = false;
/* Create a new entry in the result for the title. */
if ($this->fld_title || $this->fld_ids) {
// These should already have been filtered out of the query, but just in case.
if ($type === RC_LOG && $row->rc_deleted & LogPage::DELETED_ACTION) {
$vals['actionhidden'] = true;
$anyHidden = true;
}
if ($type !== RC_LOG || LogEventsList::userCanBitfield($row->rc_deleted, LogPage::DELETED_ACTION, $user)) {
if ($this->fld_title) {
ApiQueryBase::addTitleInfo($vals, $title);
}
if ($this->fld_ids) {
$vals['pageid'] = intval($row->rc_cur_id);
$vals['revid'] = intval($row->rc_this_oldid);
$vals['old_revid'] = intval($row->rc_last_oldid);
}
}
}
/* Add user data and 'anon' flag, if user is anonymous. */
if ($this->fld_user || $this->fld_userid) {
if ($row->rc_deleted & Revision::DELETED_USER) {
$vals['userhidden'] = true;
$anyHidden = true;
}
if (Revision::userCanBitfield($row->rc_deleted, Revision::DELETED_USER, $user)) {
if ($this->fld_userid) {
$vals['userid'] = (int) $row->rc_user;
// for backwards compatibility
$vals['user'] = (int) $row->rc_user;
}
if ($this->fld_user) {
$vals['user'] = $row->rc_user_text;
}
if (!$row->rc_user) {
$vals['anon'] = true;
}
}
}
/* Add flags, such as new, minor, bot. */
if ($this->fld_flags) {
$vals['bot'] = (bool) $row->rc_bot;
$vals['new'] = $row->rc_type == RC_NEW;
$vals['minor'] = (bool) $row->rc_minor;
}
/* Add sizes of each revision. (Only available on 1.10+) */
if ($this->fld_sizes) {
$vals['oldlen'] = intval($row->rc_old_len);
$vals['newlen'] = intval($row->rc_new_len);
}
/* Add the timestamp. */
if ($this->fld_timestamp) {
$vals['timestamp'] = wfTimestamp(TS_ISO_8601, $row->rc_timestamp);
}
if ($this->fld_notificationtimestamp) {
$vals['notificationtimestamp'] = $row->wl_notificationtimestamp == null ? '' : wfTimestamp(TS_ISO_8601, $row->wl_notificationtimestamp);
}
/* Add edit summary / log summary. */
if ($this->fld_comment || $this->fld_parsedcomment) {
if ($row->rc_deleted & Revision::DELETED_COMMENT) {
$vals['commenthidden'] = true;
$anyHidden = true;
}
if (Revision::userCanBitfield($row->rc_deleted, Revision::DELETED_COMMENT, $user)) {
if ($this->fld_comment && isset($row->rc_comment)) {
$vals['comment'] = $row->rc_comment;
}
if ($this->fld_parsedcomment && isset($row->rc_comment)) {
$vals['parsedcomment'] = Linker::formatComment($row->rc_comment, $title);
}
}
}
/* Add the patrolled flag */
if ($this->fld_patrol) {
$vals['patrolled'] = $row->rc_patrolled == 1;
$vals['unpatrolled'] = ChangesList::isUnpatrolled($row, $user);
}
if ($this->fld_loginfo && $row->rc_type == RC_LOG) {
if ($row->rc_deleted & LogPage::DELETED_ACTION) {
$vals['actionhidden'] = true;
$anyHidden = true;
}
if (LogEventsList::userCanBitfield($row->rc_deleted, LogPage::DELETED_ACTION, $user)) {
$vals['logid'] = intval($row->rc_logid);
$vals['logtype'] = $row->rc_log_type;
$vals['logaction'] = $row->rc_log_action;
$vals['logparams'] = LogFormatter::newFromRow($row)->formatParametersForApi();
}
}
if ($anyHidden && $row->rc_deleted & Revision::DELETED_RESTRICTED) {
$vals['suppressed'] = true;
//.........这里部分代码省略.........