27use InvalidArgumentException;
53 const SUPPRESSED_ALL = self::DELETED_TEXT | self::DELETED_COMMENT | self::DELETED_USER |
102 Assert::parameterType(
'string|boolean', $wikiId,
'$wikiId' );
105 $this->mSlots = $slots;
106 $this->mWiki = $wikiId;
109 $this->mPageId = $title->getArticleID();
118 throw new LogicException( __CLASS__ .
' is not serializable.' );
128 if ( $rec === $this ) {
167 public function getContent( $role, $audience = self::FOR_PUBLIC,
User $user =
null ) {
171 if ( !$this->
audienceCan( self::DELETED_TEXT, $audience, $user ) ) {
191 public function getSlot( $role, $audience = self::FOR_PUBLIC,
User $user =
null ) {
192 $slot = $this->mSlots->getSlot( $role );
194 if ( !$this->
audienceCan( self::DELETED_TEXT, $audience, $user ) ) {
209 return $this->mSlots->hasSlot( $role );
219 return $this->mSlots->getSlotRoles();
246 return new RevisionSlots( $this->mSlots->getOriginalSlots() );
261 return new RevisionSlots( $this->mSlots->getInheritedSlots() );
365 public function getUser( $audience = self::FOR_PUBLIC,
User $user =
null ) {
366 if ( !$this->
audienceCan( self::DELETED_USER, $audience, $user ) ) {
391 if ( !$this->
audienceCan( self::DELETED_COMMENT, $audience, $user ) ) {
458 if ( $audience == self::FOR_PUBLIC && $this->
isDeleted( $field ) ) {
460 }
elseif ( $audience == self::FOR_THIS_USER ) {
462 throw new InvalidArgumentException(
463 'A User object must be given when checking FOR_THIS_USER audience.'
467 if ( !$this->
userCan( $field, $user ) ) {
509 if ( $bitfield & $field ) {
510 if ( $bitfield & self::DELETED_RESTRICTED ) {
511 $permissions = [
'suppressrevision',
'viewsuppressed' ];
512 }
elseif ( $field & self::DELETED_TEXT ) {
513 $permissions = [
'deletedtext' ];
515 $permissions = [
'deletedhistory' ];
517 $permissionlist = implode(
', ', $permissions );
518 if ( $title ===
null ) {
519 wfDebug(
"Checking for $permissionlist due to $field match on $bitfield\n" );
520 return $user->isAllowedAny( ...$permissions );
522 $text = $title->getPrefixedText();
523 wfDebug(
"Checking for $permissionlist on $text due to $field match on $bitfield\n" );
524 foreach ( $permissions as $perm ) {
525 if ( $title->userCan( $perm, $user ) ) {
557 && $this->
getUser( self::RAW ) !==
null
558 && $this->mSlots->getSlotRoles() !== [];
567class_alias( RevisionRecord::class,
'MediaWiki\Storage\RevisionRecord' );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
namespace and then decline to actually register it file or subcat img or subcat $title
Base interface for content objects.