MediaWiki REL1_33
PageRestriction.php
Go to the documentation of this file.
1<?php
24
26
30 const TYPE = 'page';
31
35 const TYPE_ID = 1;
36
40 protected $title;
41
45 public function matches( \Title $title ) {
46 if ( !$this->getTitle() ) {
47 return false;
48 }
49
50 return $title->equals( $this->getTitle() );
51 }
52
60 public function setTitle( \Title $title ) {
61 $this->title = $title;
62
63 return $this;
64 }
65
72 public function getTitle() {
73 if ( $this->title === null ) {
74 $this->title = \Title::newFromID( $this->value );
75
76 // If the title does not exist, set to false to prevent multiple database
77 // queries.
78 if ( $this->title === null ) {
79 $this->title = false;
80 }
81 }
82
83 return $this->title ?? null;
84 }
85
89 public static function newFromRow( \stdClass $row ) {
90 $restriction = parent::newFromRow( $row );
91
92 // If the page_namespace and the page_title were provided, add the title to
93 // the restriction.
94 if ( isset( $row->page_namespace ) && isset( $row->page_title ) ) {
95 // Clone the row so it is not mutated.
96 $row = clone $row;
97 $row->page_id = $row->ir_value;
98 $title = \Title::newFromRow( $row );
99 $restriction->setTitle( $title );
100 }
101
102 return $restriction;
103 }
104}
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
static newFromRow(\stdClass $row)
@inheritDoc
Represents a title within MediaWiki.
Definition Title.php:40
equals(Title $title)
Compare with another title.
Definition Title.php:4006
title