Manual:LocalFile.php

From Linux Web Expert

LocalFile.php contains the class LocalFile, which extends File ) to represent a local file in the wiki's own database. It provides methods to retrieve paths, generate image thumbnails and to let users upload files.

See Manual:File.php for general advice on generating file objects.

Methods

Excluding protected, private and internal methods:

  • Create a LocalFile instance - to be called from inside a Repo class
    • newFromTitle(), newFromRow() and newFromKey()
  • Render
    • prerenderThumbnails()
  • Upload
    • upload() - Upload a file and record it in the DB
    • recordUpload3(), previously recordUpload2()
    • publish()
  • Move, delete, restore:
    • move()
    • deleteFile(), deleteOldFile()
    • restore()
  • Purge:
    • invalidateCache(), purgeCache(), purgeOldThumbnails(), purgeThumbnails()
  • DB:
    • upgradeRow()
  • File lock
    • acquireFileLock() and releaseFileLock() - supersede lock() and unlock() since 1.38
  • Load file metadata:
    • loadFromRow() and load()
  • Get metadata
    • getMetadataArray() and getMetadataItems() - supersede getMetadata()
    • getJsonMetadata()
  • Get description
    • getDescriptionShortUrl(), getDescriptionUrl(), getDescriptionText(), getDescription()
  • Get file objects associated with page revisions
    • getHistory()
  • Get upload information
    • nextHistoryLine() - Returns the history of the file, line by line
    • resetHistory() - Returns the history of this file, line by line
    • getTimestamp() - get 14-character timestamp
    • getDescriptionTouched() - get timestamp (TS_MW format) of the last change of the description page
    • getUploader() - get the user who uploaded the file
  • Get Repo info
    • getRepo() - returns LocalRepo
    • isMissing()
  • Get other information
    • getQueryInfo() - deprecated since 1.41 in favour of FileSelectQueryBuilder class
    • exists()
    • isCacheable
    • getSize(), getWidth() and getHeight()
    • getBitDepth()
    • getMimeType() and getMediaType()
    • getSha1() - get Secure Hash Algorithm 1 (Sha1)

In addition, many other methods are available that are inherited from File class.

See also