Go to the documentation of this file.
106 $this->
title =
false;
108 $this->
group =
'deleted';
114 $this->metadata =
'';
115 $this->mime =
"unknown/unknown";
116 $this->media_type =
'';
117 $this->description =
'';
119 $this->timestamp =
null;
121 $this->dataLoaded =
false;
143 throw new MWException(
"No specifications provided to ArchivedFile constructor." );
153 if ( $this->dataLoaded ) {
158 if ( $this->
id > 0 ) {
165 if ( $this->
title ) {
166 $conds[
'fa_name'] = $this->
title->getDBkey();
172 if ( !
count( $conds ) ) {
173 throw new MWException(
"No specific information for retrieving archived file" );
177 $this->dataLoaded =
true;
180 $row =
$dbr->selectRow(
181 $fileQuery[
'tables'],
182 $fileQuery[
'fields'],
185 [
'ORDER BY' =>
'fa_timestamp DESC' ],
196 throw new MWException(
'This title does not correspond to an image page.' );
211 $file->loadFromRow( $row );
229 throw new BadMethodCallException(
230 'Cannot use ' . __METHOD__
231 .
' when $wgActorTableSchemaMigrationStage has SCHEMA_COMPAT_READ_NEW'
252 'fa_actor' =>
'NULL',
255 'fa_deleted_timestamp',
257 ] + MediaWikiServices::getInstance()->getCommentStore()->getFields(
'fa_description' );
270 $commentQuery = MediaWikiServices::getInstance()->getCommentStore()->getJoin(
'fa_description' );
273 'tables' => [
'filearchive' ] + $commentQuery[
'tables'] + $actorQuery[
'tables'],
290 'fa_deleted_timestamp',
292 ] + $commentQuery[
'fields'] + $actorQuery[
'fields'],
293 'joins' => $commentQuery[
'joins'] + $actorQuery[
'joins'],
304 $this->
id = intval( $row->fa_id );
305 $this->
name = $row->fa_name;
306 $this->archive_name = $row->fa_archive_name;
307 $this->
group = $row->fa_storage_group;
308 $this->
key = $row->fa_storage_key;
309 $this->size = $row->fa_size;
310 $this->bits = $row->fa_bits;
311 $this->
width = $row->fa_width;
312 $this->height = $row->fa_height;
313 $this->metadata = $row->fa_metadata;
314 $this->mime =
"$row->fa_major_mime/$row->fa_minor_mime";
315 $this->media_type = $row->fa_media_type;
316 $this->description = MediaWikiServices::getInstance()->getCommentStore()
320 $this->timestamp = $row->fa_timestamp;
321 $this->deleted = $row->fa_deleted;
322 if ( isset( $row->fa_sha1 ) ) {
323 $this->sha1 = $row->fa_sha1;
328 if ( !$this->
title ) {
339 if ( !$this->
title ) {
351 if ( $this->
name ===
false ) {
373 return $this->exists;
467 if ( !isset( $this->
handler ) ) {
540 if (
$type ===
'object' ) {
542 } elseif (
$type ===
'text' ) {
543 return $this->
user ? $this->
user->getName() :
'';
544 } elseif (
$type ===
'id' ) {
545 return $this->
user ? $this->
user->getId() : 0;
580 return $this->
getUser(
'text' );
613 return ( $this->deleted & $field ) == $field;
loadFromRow( $row)
Load ArchivedFile object fields from a DB row.
int $deleted
Bitfield akin to rev_deleted.
const SCHEMA_COMPAT_READ_NEW
string $sha1
SHA-1 hash of file content.
getKey()
Return the FileStore key.
getTimestamp()
Return upload timestamp.
static userCanBitfield( $bitfield, $field, User $user=null, Title $title=null)
Determine if the current user is allowed to view a particular field of this revision,...
string $metadata
Metadata string.
bool $dataLoaded
Whether or not all this has been loaded from the database (loadFromXxx)
string $group
FileStore storage group.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
isDeleted( $field)
for file or revision rows
static getQueryInfo()
Return the tables, fields, and join conditions to be selected to create a new archivedfile object.
static newFromAnyId( $userId, $userName, $actorId)
Static factory method for creation from an ID, name, and/or actor ID.
string $key
FileStore SHA-1 key.
getStorageKey()
Return the FileStore key (overriding base File class)
static newMigration()
Static constructor.
static getHashFromKey( $key)
Gets the SHA1 hash from a storage key.
static normalizeTitle( $title, $exception=false)
Given a string or Title object return either a valid Title object with namespace NS_FILE or null.
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
string $archive_name
Original base filename.
getMetadata()
Get handler-specific metadata.
getSize()
Return the size of the image file, in bytes.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves set to a MediaTransformOutput the error message to be returned in an array you should do so by altering $wgNamespaceProtection and $wgNamespaceContentModels outside the handler
load()
Loads a file object from the filearchive table.
and how to run hooks for an and one after Each event has a name
getDBkey()
Get the main part with underscores.
getHandler()
Get a MediaHandler instance for this file.
int $id
Filearchive row ID.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same user
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
getMimeType()
Returns the MIME type of the file.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
getTitle()
Return the associated title object.
pageCount()
Returns the number of pages of a multipage document, or false for documents which aren't multipage do...
getVisibility()
Returns the deletion bitfield.
__construct( $title, $id=0, $key='', $sha1='')
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
int $size
File size in bytes.
userCan( $field, User $user=null)
Determine if the current user is allowed to view a particular field of this FileStore image file,...
getDescription()
Return upload description.
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message key
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Class representing a row of the 'filearchive' table.
int false $pageCount
Number of pages of a multipage document, or false for documents which aren't multipage documents.
getSha1()
Get the SHA-1 base 36 hash of the file.
getName()
Return the file name.
getGroup()
Return the FileStore storage group.
getWidth()
Return the width of the image.
getRawUserText()
Return the user name of the uploader.
getUser( $type='text')
Returns ID or name of user who uploaded the file.
string $timestamp
Time of upload.
Represents a title within MediaWiki.
getRawDescription()
Return upload description.
string $description
Upload description.
getHeight()
Return the height of the image.
getBits()
Return the bits of the image file, in bytes.
static selectFields()
Fields in the filearchive table.
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 MediaWikiServices
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
no text was provided for refs named< code > blankwithnoreference</code ></span ></li ></ol ></div > ! end ! test with< references/> in group ! wikitext Wikipedia rocks< ref > Proceeds of vol XXI</ref > Wikipedia rocks< ref group=note > Proceeds of vol XXI</ref >< references/>< references group=note/> ! html< p > Wikipedia rocks< sup id="cite_ref-1" class="reference">< a href="#cite_note-1"> &Wikipedia rocks< sup id="cite_ref-2" class="reference">< a href="#cite_note-2"> &</p >< div class="mw-references-wrap">< ol class="references">< li id="cite_note-1">< span class="mw-cite-backlink">< a href="#cite_ref-1"> ↑</a ></span >< span class="reference-text"> Proceeds of vol XXI</span ></li ></ol ></div >< div class="mw-references-wrap">< ol class="references">< li id="cite_note-2">< span class="mw-cite-backlink">< a href="#cite_ref-2"> ↑</a ></span >< span class="reference-text"> Proceeds of vol XXI</span ></li ></ol ></div > ! end ! test with< references/> in group
getRawUser()
Return the user ID of the uploader.
string $media_type
Media type.
static newFromRow( $row)
Loads a file object from the filearchive table.
getMediaType()
Return the type of the media in the file.
int $wgActorTableSchemaMigrationStage
Actor table schema migration stage.