Go to the documentation of this file.
47 # The null default value is only here to avoid an E_STRICT
48 if (
$time ===
null ) {
49 throw new MWException( __METHOD__ .
' got null for $time parameter' );
62 return new self(
$title,
$repo,
null, $archiveName );
73 $file->loadFromRow( $row,
'oi_' );
96 $row =
$dbr->selectRow(
'oldimage', self::selectFields(), $conds, __METHOD__ );
138 $this->requestedTime =
$time;
139 $this->archive_name = $archiveName;
140 if ( is_null(
$time ) && is_null( $archiveName ) ) {
141 throw new MWException( __METHOD__ .
': must specify at least one of $time or $archiveName' );
156 if ( !isset( $this->archive_name ) ) {
180 $this->dataLoaded =
true;
181 $dbr = $this->repo->getSlaveDB();
183 if ( is_null( $this->requestedTime ) ) {
186 $conds[
'oi_timestamp'] =
$dbr->timestamp( $this->requestedTime );
189 $conds, __METHOD__,
array(
'ORDER BY' =>
'oi_timestamp DESC' ) );
193 $this->fileExists =
false;
205 $this->extraDataLoaded =
true;
206 $dbr = $this->repo->getSlaveDB();
208 if ( is_null( $this->requestedTime ) ) {
211 $conds[
'oi_timestamp'] =
$dbr->timestamp( $this->requestedTime );
215 $conds, __METHOD__,
array(
'ORDER BY' =>
'oi_timestamp DESC' ) );
218 $dbr = $this->repo->getMasterDB();
220 $conds, __METHOD__,
array(
'ORDER BY' =>
'oi_timestamp DESC' ) );
229 throw new MWException(
"Could not find data for image '{$this->archive_name}'." );
240 $fields = parent::getCacheFields( $prefix );
241 $fields[] = $prefix .
'archive_name';
242 $fields[] = $prefix .
'deleted';
265 # Don't destroy file info of missing files
266 if ( !$this->fileExists ) {
267 wfDebug( __METHOD__ .
": file does not exist, aborting\n" );
273 $dbw = $this->repo->getMasterDB();
276 wfDebug( __METHOD__ .
': upgrading ' . $this->archive_name .
" to the current schema\n" );
277 $dbw->update(
'oldimage',
279 'oi_size' => $this->size,
280 'oi_width' => $this->width,
281 'oi_height' => $this->height,
282 'oi_bits' => $this->bits,
283 'oi_media_type' => $this->media_type,
284 'oi_major_mime' => $major,
285 'oi_minor_mime' => $minor,
286 'oi_metadata' => $this->metadata,
287 'oi_sha1' => $this->sha1,
290 'oi_archive_name' => $this->archive_name ),
304 return ( $this->deleted & $field ) == $field;
346 $dstRel =
'archive/' . $this->
getHashPath() . $archiveName;
347 $status = $this->
publishTo( $srcPath, $dstRel,
351 if ( $status->isGood() ) {
353 $status->fatal(
'filenotfound', $srcPath );
373 $dbw = $this->repo->getMasterDB();
374 $dbw->begin( __METHOD__ );
376 $dstPath = $this->repo->getZonePath(
'public' ) .
'/' . $this->
getRel();
377 $props = $this->repo->getFileProps( $dstPath );
378 if ( !$props[
'fileExists'] ) {
382 $dbw->insert(
'oldimage',
385 'oi_archive_name' => $archiveName,
386 'oi_size' => $props[
'size'],
387 'oi_width' => intval( $props[
'width'] ),
388 'oi_height' => intval( $props[
'height'] ),
389 'oi_bits' => $props[
'bits'],
390 'oi_timestamp' => $dbw->timestamp(
$timestamp ),
392 'oi_user' =>
$user->getId(),
393 'oi_user_text' =>
$user->getName(),
394 'oi_metadata' => $props[
'metadata'],
395 'oi_media_type' => $props[
'media_type'],
396 'oi_major_mime' => $props[
'major_mime'],
397 'oi_minor_mime' => $props[
'minor_mime'],
398 'oi_sha1' => $props[
'sha1'],
402 $dbw->commit( __METHOD__ );
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
see documentation in includes Linker php for Linker::makeImageLink & $time
unprefixRow( $row, $prefix='img_')
FileRepo LocalRepo ForeignAPIRepo bool $repo
Some member variables can be lazy-initialised using __get().
static newFromKey( $sha1, $repo, $timestamp=false)
Create a OldLocalFile from a SHA-1 key Do not call this except from inside a repo class.
unlock()
Decrement the lock reference count.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
loadFromDB()
Load file metadata from the DB.
getVisibility()
Returns bitfield value.
wfProfileIn( $functionname)
Begin profiling of a function.
int $user
User ID of uploader *.
static selectFields()
Fields in the oldimage table.
uploadOld( $srcPath, $archiveName, $timestamp, $comment, $user, $flags=0)
Upload a file directly into archive.
string $sha1
SHA-1 base 36 content hash *.
static splitMime( $mime)
Split an internet media type into its two components; if not a two-part name, set the minor type to '...
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this revision,...
it s the revision text itself In either if gzip is the revision text is gzipped $flags
recordOldUpload( $srcPath, $archiveName, $timestamp, $comment, $user)
Record a file upload in the oldimage table, without adding log entries.
string $requestedTime
Timestamp *.
string $archive_name
Archive name *.
publishTo( $srcPath, $dstRel, $flags=0, array $options=array())
Move or copy a file to a specified location.
upgradeRow()
Fix assorted version-related problems with the image row by reloading it from the file.
loadFromRow( $row, $prefix='img_')
Load file metadata from a DB result row.
int $deleted
Bitfield akin to rev_deleted *.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
loadExtraFromDB()
Load lazy file metadata from the DB.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
__construct( $title, $repo, $time, $archiveName)
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Class to represent a local file in the wiki's own database.
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
lock()
Start a transaction and lock the image for update Increments a reference counter if the lock is alrea...
load( $flags=0)
Load file metadata from cache or DB, unless already loaded.
getName()
Return the name of this file.
string $timestamp
Upload timestamp *.
static newFromRow( $row, $repo)
if(PHP_SAPI !='cli') $file
getCacheFields( $prefix='img_')
getLazyCacheFields( $prefix='img_')
static newFromTitle( $title, $repo, $time=null)
loadFromFile()
Load metadata from the file itself.
userCan( $field, User $user=null)
Determine if the current user is allowed to view a particular field of this image file,...
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 as
string $name
The name of a file from its title object *.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Class to represent a file in the oldimage table.
static newFromArchiveName( $title, $repo, $archiveName)
getHashPath()
Get the filename hash component of the directory including trailing slash, e.g.
exists()
canRender inherited