I want to get the file description in a language other then
the user language in an extension (I5e6bc45f9751).
Change-Id: Ifcae821a51f4207e7816e710d3b3857c7ed438b6
MediaHandler::getHandler() can return false when a handler cannot be
determined for the given file's derived mime type. This change adds
guards to invocations that I could find that did not properly check for
this potential return result.
Bug: 53820
Change-Id: I8c0165311cc75f9920ac30ce2b38ccd207439198
Inform upstream caches when a file asset is deleted by calling
SquidUpdate::purge(). This helps prevent unintentional information leakage in
the event that the asset is being deleted for reasons of license or content.
Bug: 51064
Change-Id: Ibf57e8f32d7dd04b8508a69706be5a40b49e5abd
This tends to become extremely expensive as the number of
oldversions of a file increase. It is also not generally
needed since ?action=purge is usually targeting the
current version (additionally old versions of the file
have fixed urls, so they're less likely to get out
of sync). If an old version does need to be purged, one
can revdel and un-revdel it.
It should be noted that this extra purging was added
for bug 30192. However, since that bug was fixed,
most of the places requiring purging of old thumbnails
have now done it directly instead of by relying on
$file->purgeCache. The exception being revision
deletion, which still assumes $file->purgeCache clears
the thumbnails of old versions of the file.
There's no real bug for this, but I kind of hijacked
bug 49362
Change-Id: Ib399132cabe79fd2b4b23bad5708bfa50b282074
getPageDimensions returning false for failure wasn't being handled
properly, causing ugly output. The doc comment on that method was
wrong as well.
Most notably causing random whitespace output:
https://commons.wikimedia.org/wiki/?curid=22151015
(screenshot: http://i.imgur.com/c21EpVx.png).
Bug: 41281
Change-Id: I1a49474309e15808928f877dfc29ae366d028928
Primary motivation here is to make Special:Recentchangelinked work
correctly for uploads where the description page doesn't exist yet.
(Previously it was mostly only showing reupload log entries)
Mild downside to this approach is adding the recentchanges row is
now in a different commit...
Change-Id: I74c68b972c47c03066d3065e3748769a27a654fb
When someone uploads a new file, we should refresh all the pages
that use that image, so that [[Category:Pages with broken file links]]
gets removed.
Future fixme would to run this again on file deletes, but that's
less critical as they will eventually get added on next reparse
and people don't expect that to happen instantly like when fixing
the issue. Ditto for someone creating a new file redirect.
Bug: 46749
Change-Id: I7889598eee54a1c07c64f750b8499e922ba59704
I came across people complaining that it was hard to associate
upload log events to actual images since img_timestamp could
be different from log_timestamp, and generally no unique id.
Well I was there I made uploads use the new logging system.
Change-Id: Icd8662ecb9eb0f6c0ff9841bdbd5736d6dd0d015
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !
Fixed windows newline style
Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.
Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments
Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
Moves the giving of a user one level up, because File::recordUpload2
already needs this (and fallback to $wgUser).
Can also use the user for the watching of the file, which was using
$wgUser before.
Change-Id: I697ae0df65b07ea59ab11b62804853cdc03cb172
* Only BEGIN on lock() if no trx was in progress.
Likewise, only COMMIT in unlock() if the lock() call started a trx.
* This can avoid problems with commiting page update transactions
prematurely, which could leave broken page stub rows. (bug 40178)
Change-Id: I9a0adb25ee107df9a6bf70c6103ddfb7f034be25
* Previously, large values that could not fit into memcached would not be cached
and the master DB would be hit for any file loading (djvu files hit this often).
Change-Id: I3ed8ad4a85d6e3084330b56c3b48ee76103bd2b8
While we don't want to re-encode videos on purge, they should still
be removed from squid; compute the list of all urls before extensions
can filter it to remove files that should not be deleted from the
file backend.
Change-Id: Id837843b5a203e49a8594439ce3620da9b3c7b6a
reverting a file a virtual url is passed to upload without props,
get props from backend, virutal urls are not local files.
Change-Id: I1d56a6237e1d2af9941f29e4ba3f0262817b0e8d
* For backends that support it, custom HTTP headers can be set on files.
* Added a getStreamHeaders() function to MediaHandler to let subclasses
recommend header name/value pairs to be used for responses to GET/HEAD
requests. For example, an OGG handler could set "X-Content-Duration".
* Made LocalFile use this function to set HTTP headers of new uploads.
Change-Id: I1b017e1342513f0097fe6d142aae18e819403293
This allows sha1 searches with the api in miser mode for deleted files
Added script to populate the rows
Adding new field to selects and handle it in all places, where needed
Using a 10 byte index for the new field per
http://lists.wikimedia.org/pipermail/wikitech-l/2012-September/063429.html
Change-Id: Ie54a513fe361202e63df44be44a0fdd91926c974
The transaction bracket in LocalFile::recordUpload2 used to span a call
to WikiPage::doEdit, which in turn opens a transaction. Nesting transactions
this way does not work: the first transaction is committed prematurely when
the second one starts. This may cause serious database corruption and
generally exciting behavior.
This change commits LocalFile's own transaction before any interaction
with WikiPage. There may be a race condition here, but that case seems to
be already handled in the code. Also, in the previous "broken" state, all
transactional protection got lost anyway - so this should at least be no
worse than what we had.
This may be changed back if and when we have support for nested
transactions.
Change-Id: I20d90fedb2d19c64ccf0f3942ddda756fe511c12
This change updates the log_page in a second step after performing
the edit, which is not terribly elegant, but is very robust.
Change-Id: I9015230df772d049b2879fb34914c68183f1da05
* Replaced WikiPage::DATA_FROM_* constants with IDBAccessObject ones.
* Renamed IDBAccessObject constants a bit for visual consistency.
* Removed AVOID_MASTER parameter and replaced calling instances with READ_NORMAL.
Instead of getting page_latest from the master and the revision from a
slave, just get it all from the master in one RTT. Most callers used
AVOID_MASTER (and now READ_NORMAL), so this case is barely hit anymore.
Change-Id: Ifbefdcd4490094b38e49bbb46c95fdb71b5c9e1a
* The main Revision functions now allow various QoS and locking flags.
* Added tiny DBAO interface add made Revision implement it.
Since a lot of objects will need (or have) the same functionality.
* Use "self" keyword in Revision class consistently.
* Made Revisison::newFromConds() private.
Change-Id: I3139956999218a2bb44b5c845b8079e33b2328bb
* Made SiteStatsUpdate fields protected
* Added factory function for unretarded object construction
* Changed FileRepo code to use deferred stats updates like everything else
Change-Id: I93039104b14f0362509e37b6852604ffb0898dc7
* Purge old version thumbnails on move
* Pushed purge operations outside of the DB transaction for move/delete
Change-Id: I260940149599eea814226d3c5b7092f4d6544a72
* Make sure locks for file moves cover the whole operation.
* Pushed purging out of the move/delete/restore transactions.
Change-Id: I398c5627808fa79739f0dee632c4edf7416507c1
* Added quickImport()/quickPurge() functions to store and delete files as fast as possible.
* Also added a cleanDir() function to avoid having File directly use FileBackend functions.
Change-Id: I9a19862f1a720c5a464bd37f79b58a505c5961f9
* Made RepoGroup avoid caching files with large metadata and also reduced max cache size to 500 to avoid OOMs.
* Factored out a pingCache() function in RepoGroup.
Change-Id: I52f6413b9eb8b11fbffbde0f0e7acf97c7a2ff89
* Made File::isHashed() wrap FileRepo::getHashLevels(). Removed now-used FileRepo::isHashed().
* Removed FileRepo::simpleClean(). Not useful anymore since the paths in Status errors don't have $IP or upload dirs anymore.
* Removed code in FileRepo::fileExistsBatch() and FileRepo::cleanupBatch() to handle FS file paths, which should never be passed in anymore. Likewise, removed FILES_ONLY parameter.
* Removed FileRepo::append()/appendFinish() stub functions.
* Added FileRepo::assertWritableRepo() function to better handle repos that are read-only by design rather than the hack of overwriting each function (several were missed).
* Added FileBackend::isPathTraversalFree() function and used it in FileRepo::validateFilename() to avoid duplication.
* Tweaked FileRepo::freeTemp() to avoid file locking and made FileRepo::cleanupBatch() return a Status.
* Moved FileRepo::cleanupDeletedBatch() near FileRepo::deleteBatch().
* Added type hinting to a few places.
* Tweaked some misleading doc comments and added function visibility markers.
Change 1:
* Simplified NullRepo to also use assertWritableRepo(). It is currently only used by a single unit test.
Change-Id: I1cd0f4971011772e38e5156f94ffc50325372f28
* Added getReadOnlyReason() function to FileRepo to check read-only status. Added such checks to the File object functions that mutate files in storage. This should make read-only mode more tolerable (which is needed at least briefly when switching backends).
* Added lock()/unlock() calls to File restore() function.
* Use proper isOK() accessor for Status objects.
Change-Id: I7368912b01f7fd1ec34125d12c0844388cbb3b2d
* Added getReadOnlyReason() function to FileRepo to check read-only status. Added such checks to the File object functions that mutate files in storage. This should make read-only mode more tolerable (which is needed at least briefly when switching backends).
* Added lock()/unlock() calls to File restore() function.
* Use proper isOK() accessor for Status objects.
* Made upload() explicitly check $status->successCount rather than isOk() as FileRepo::publish() gives fatal statuses where it used to only give warnings. This way, failed uploads still displace the current image DB row to oldimage rather than do nothing and have the same image row point to a new file (which can cause mismatched metadata).
* Disabled exception about invalid oi_archive_name. This makes things more broken in that when people get this an error on upload (which happens when the FS has no current file but the DB does), the new file is added as the current version in the FS but the DB is unchanged. Thus, the metadata can be mismatched.
* Removed bogus rmdir() call.
* Added lock() calls to upgradeRow()/getSha1().
* Use FileRepo getFileSha1() in getSha1() rather than via FSFile.
* Made purgeThumbList()/migrateThumbFile() use FileRepo::cleanupBatch().
* A few other minor cleanups.
* w/s cleanup in recordUpload2().
In FSRepo:
* Removed deleted zone config code from constructor; useless since r107028.
In FileBackend:
* Make sure 'latest' param gets passed through via $params for some functions.
* Cleaned up doMoveInternal() to use *_Internal() functions.