59 $this->user = RequestContext::getMain()->getUser();
66 if ( $this->title ===
null ) {
78 $titleObj = Title::newFromText(
$title );
79 if ( !$titleObj || !$titleObj->getArticleID() ) {
81 MessageValue::new(
'rest-nonexistent-title' )->plaintextParams(
$title ),
86 if ( !$this->permissionManager->userCan(
'read', $this->user, $titleObj ) ) {
88 MessageValue::new(
'rest-permission-denied-title' )->plaintextParams(
$title ),
94 $results = $this->
getDbResults( $titleObj->getArticleID() );
95 if ( count( $results ) > self::MAX_NUM_LINKS ) {
97 MessageValue::new(
'rest-media-too-many-links' )
98 ->plaintextParams(
$title )
99 ->numParams( self::MAX_NUM_LINKS ),
113 return $dbr->selectFieldValues(
116 [
'il_from' => $pageId ],
119 'ORDER BY' =>
'il_to',
120 'LIMIT' => self::MAX_NUM_LINKS + 1,
132 $findTitles = array_map(
function (
$title ) {
139 $files = $this->repoGroup->findFiles( $findTitles );
140 list( $maxWidth, $maxHeight ) = self::getImageLimitsFromOption( $this->user,
'imagesize' );
143 'maxWidth' => $maxWidth,
144 'maxHeight' => $maxHeight,
148 foreach ( $files as
$file ) {
149 $response[] = $this->getFileInfo(
$file, $this->user, $transforms );
166 self::PARAM_SOURCE =>
'path',
167 ParamValidator::PARAM_TYPE =>
'string',
168 ParamValidator::PARAM_REQUIRED =>
true,
197 return $title->getTouched();
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Prioritized list of file repositories.
Group all the pieces relevant to the context of a request into one instance @newable.
Represents a title within MediaWiki.
getLatestRevID( $flags=0)
What is the page_latest field for this page?
getTouched( $db=null)
Get the last touched timestamp.
getArticleID( $flags=0)
Get the article ID for this Title from the link cache, adding it if necessary.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.