38 parent::__construct( $imagePage->getContext() );
39 $this->mImagePage = $imagePage;
40 $this->mTitle = clone $imagePage->getTitle();
41 $this->mTitle->setFragment(
'#filehistory' );
44 $this->mRange = [ 0, 0 ];
79 if ( count( $this->mHist ) ) {
80 if ( $this->mImg->isLocal() ) {
83 for ( $i = $this->mRange[0]; $i <= $this->mRange[1]; $i++ ) {
84 $file = $this->mHist[$i];
85 $user = $file->getUser(
'text' );
89 $linkBatch->execute();
93 # Generate prev/next links
95 $s = $list->beginImageHistoryList( $navLink );
97 for ( $i = $this->mRange[0]; $i <= $this->mRange[1]; $i++ ) {
98 $file = $this->mHist[$i];
99 $s .= $list->imageHistoryLine( !$file->isOld(), $file );
101 $s .= $list->endImageHistoryList( $navLink );
103 if ( $list->getPreventClickjacking() ) {
111 if ( $this->mQueryDone ) {
114 $this->mImg = $this->mImagePage->getPage()->getFile();
115 if ( !$this->mImg->exists() ) {
118 $queryLimit = $this->mLimit + 1;
119 if ( $this->mIsBackwards ) {
121 $this->mHist = $this->mImg->getHistory( $queryLimit, null, $this->mOffset,
false );
123 $numRows = count( $this->mHist );
124 if ( $numRows <= $this->mLimit && $this->mImg->getTimestamp() >
$this->mOffset ) {
125 $this->mHist = array_merge( [ $this->mImg ], $this->mHist );
129 if ( !$this->mOffset || $this->mImg->getTimestamp() <
$this->mOffset ) {
133 $oiLimit = count( $this->mHist ) ? $this->mLimit : $this->mLimit + 1;
135 $this->mHist = array_merge( $this->mHist,
136 $this->mImg->getHistory( $oiLimit, $this->mOffset, null,
false ) );
138 $numRows = count( $this->mHist );
140 # Index value of top item in the list
141 $firstIndex = $this->mIsBackwards ?
142 $this->mHist[$numRows - 1]->getTimestamp() : $this->mHist[0]->getTimestamp();
143 # Discard the extra result row if there is one
144 if ( $numRows > $this->mLimit && $numRows > 1 ) {
145 if ( $this->mIsBackwards ) {
146 # Index value of item past the index
147 $this->mPastTheEndIndex = $this->mHist[0]->getTimestamp();
148 # Index value of bottom item in the list
149 $lastIndex = $this->mHist[1]->getTimestamp();
151 $this->mRange = [ 1, $numRows - 1 ];
153 # Index value of item past the index
154 $this->mPastTheEndIndex = $this->mHist[$numRows - 1]->getTimestamp();
155 # Index value of bottom item in the list
156 $lastIndex = $this->mHist[$numRows - 2]->getTimestamp();
158 $this->mRange = [ 0, $numRows - 2 ];
161 # Setting indexes to an empty string means that they will be
162 # omitted if they would otherwise appear in URLs. It just so
163 # happens that this is the right thing to do in the standard
164 # UI, in all the relevant cases.
165 $this->mPastTheEndIndex =
'';
166 # Index value of bottom item in the list
167 $lastIndex = $this->mIsBackwards ?
168 $this->mHist[0]->getTimestamp() : $this->mHist[$numRows - 1]->getTimestamp();
170 $this->mRange = [ 0, $numRows - 1 ];
175 $this->mPastTheEndIndex =
'';
177 if ( $this->mIsBackwards ) {
178 $this->mIsFirst = ( $numRows < $queryLimit );
179 $this->mIsLast = ( $this->mOffset ==
'' );
180 $this->mLastShown = $firstIndex;
181 $this->mFirstShown = $lastIndex;
183 $this->mIsFirst = ( $this->mOffset ==
'' );
184 $this->mIsLast = ( $numRows < $queryLimit );
185 $this->mLastShown = $lastIndex;
186 $this->mFirstShown = $firstIndex;
188 $this->mQueryDone =
true;
Builds the image revision log shown on image pages.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php