Commit graph

233 commits

Author SHA1 Message Date
Brion Vibber
67c4772b67 Fix regression causing incorrect image data to be stored in the oldimage table.
The call to upgradeRow() in purgeMetadataCache(), indirectly called during upload, caused data for the new file to be written into the 'image' table in the database before migration from 'image' to 'oldimage'. Thus data for the new file was recorded as belonging to the old file.
Have replaced this call with a call to loadFromFile(), so the new data goes only into cache
at this time, and won't get written to the database until after.
The 'purge' action in ImagePage now explicitly calls the upgradeRow() function in addition to cache purging... is it needed elsewhere?
This whole mess still stinks of race  conditions, though. Sigh.
2007-05-04 19:39:19 +00:00
Brion Vibber
f1bb5a385e E_STRICT fixlets: properly mark some static methods as static
Also removed a few obsolete object references
2007-05-02 15:36:17 +00:00
River Tarnell
9da4fdb875 remove schema check on upload, any wiki this old almost certainly won't work anyway, and it's a little mysql-specific 2007-05-02 01:44:46 +00:00
Tim Starling
bb63c1c604 More general thumbnail filename check on purge, to allow for general parameter strings 2007-04-30 10:28:21 +00:00
Tim Starling
97686ac0aa oops 2007-04-27 09:41:09 +00:00
Tim Starling
f6509ff750 Restored previous interface for thumbUrl(), for backwards compatibility. Fixed squid purging of thumbnails in Image::purgeCache(), broken since r21411. 2007-04-27 09:17:05 +00:00
Tim Starling
44ebc3d657 Bump cache version 2007-04-25 07:39:26 +00:00
Nick Jenkins
bd23ec29c6 Doc tweaks:
* Seems like an opportune time to introduce "@addtogroup Media" documentation tags.
* Merge "@addtogroup Metadata" (used by Exif.php) into "@addtogroup Media".
* Few more moving comment blocks to above classes.
2007-04-24 06:53:31 +00:00
Tim Starling
e885b638ac remove version 2007-04-23 15:50:49 +00:00
Tim Starling
d246232e07 Don't double-normalise parameters, introduces rounding errors. 2007-04-20 19:45:58 +00:00
Brion Vibber
6dff4efc61 use consistent URL encoding for Image::thumbUrl() whether hashed directories are in use or not 2007-04-20 16:26:12 +00:00
Tim Starling
b15d8cffc4 * Introduced media handler modules for file-type specific operations: thumbnailing, img_metadata, capabilities, etc.
* Deprecated $wgUseImageResize, thumbnailing will be enabled unconditionally.
* Fixed interaction of page parameter to ImagePage with the HTML file cache
* Improved error reporting for image thumbnailing
* Fixed MIME type for SVG files, will be silently changed from image/svg to image/svg+xml after loading from the database.
* Workaround for djvutoxml bug #1704049 (poor performance). Use djvudump instead.
* Fixed odd behaviour in ImagePage on DjVu thumbnailing errors
* Improved error reporting for image thumbnailing
* Added sharpening option for ImageMagick thumbnailing
* Removed Image::selectPage(), added page parameters to getWidth() and getHeight(), deprecated Image::renderThumb() and Image::getThumbnail()
* Changed default contents of img_metadata to empty string instead of a:0:{}
* Moved responsibility for respecting $wgGenerateThumbnailOnParse from the UI to Image.php
2007-04-20 12:31:36 +00:00
Nick Jenkins
9648f3b4d0 Some small doc tweaks to reduce Doxygen warnings, namely:
* @link. You might think @link would surely mean "here comes a web URL" ... but @link is a valid command 
  in Doxygen, which means an entirely different kind of link (an internal link to somewhere, so that you can separate 
  documentation and implementation). The result is a mess, and the best solution I can see is to use "@see" instead of "@link".
* Warning: argument `nourl' of command @param is not found in the argument list of Linker::makeMediaLinkObj($title,$text='')
* Moving few class descriptions to right above classes, and/or formatting into Javadoc style.
* "@addtogroup Special Pages" --> "@addtogroup SpecialPage" so that all special pages have the same @addtogroup tag.
* @fixme --> @todo (must have missed these before)
* "@param $specialPage @see" remove the "@" in the "@see" to stop warning.
* @throws wants type, then a brief description, to stop warning.

This last one is for PHPdocumentor only, but it fixes something for PHPDocumentor, and should be neutral for Doxygen:
* WARNING in includes/api/ApiFormatYaml_spyc.php on line 860: docblock template never terminated with /**#@-*/
2007-04-18 09:50:10 +00:00
Rob Church
859e431af3 Couple of new hooks; FileUpload and SearchUpdate 2007-04-10 02:18:42 +00:00
Tim Starling
a7c8d93b7e * Fix extension of DJVU output
* Specify output type in ImageMagick SVG rendering command line
* Make some Image functions static, for the benefit of WebStore.
* Fixed SVG MIME type, will be image/svg+xml from now on with both accepted.
2007-03-31 17:15:00 +00:00
Aaron Schulz
9359dd0601 *Rename FSarchivedFile to ArchivedFile, add to autoloader 2007-03-14 05:27:26 +00:00
Aaron Schulz
be7849a81d *Use constant prefix IMG, not REV 2007-03-14 01:05:08 +00:00
Aaron Schulz
ab5765b192 *Add FSarchivedFile() function, some revisiondelete constants, and "suppress" argument for later use 2007-03-14 00:15:40 +00:00
Brion Vibber
9b9485eb69 fix uggo notice selecting commons db 2007-03-05 20:03:45 +00:00
Tim Starling
3d8479f993 Use a separate connection for commons DB 2007-03-05 11:55:29 +00:00
Antoine Musso
6c0d8b22d3 Kill all whitespaces 2007-02-03 22:31:08 +00:00
Nick Jenkins
adbbd43292 Prevent under E_STRICT - Strict Standards: opendir(/var/www/hosts/mediawiki/wiki/images/thumb/9/9e/file.jpg) [<a href='function.opendir'>function.opendir</a>]: failed to open dir: No such file or directory in /var/www/hosts/mediawiki/wiki/includes/Image.php on line 1321. 2007-01-29 07:52:45 +00:00
Brion Vibber
455e77d168 Fix fix for 8652 (failures with bad XML metadata for DjVu files)
The mid-level functions in Image now fail gracefully on bogus data, as happens when the djvutoxml executable is missing.

Removed the bogus exception check in ImagePage high-level code (which actually just causes a fatal error by calling a nonexistent method :)

Also changed Image::initializeMultiPageXML to do clean lazy loading as Image::load does, and to return true/false as to success/failure for cleaner code using it.
2007-01-26 12:00:04 +00:00
Nick Jenkins
f88c771756 The war on redundant ampersand usage!
* Convert "$dbw =& wfGetDB( DB_MASTER );" --> "$dbw = wfGetDB( DB_MASTER );"
* convert "$skin =& $wgUser->getSkin();" --> "$skin = $wgUser->getSkin();"

For the time being have not changed the function definitions of wfGetDB() or User::getSkin() [i.e. they are still both return-by-ref], so as to ensure the interface does not change for extensions [some of which may still be trying to run on PHP4 environments]. However presumably at some point this can be changed too.

Also includes tiny tweak to newlines in parserTests - will show 1 rather than 2 newlines between the "Reading tests from" strings when in quiet mode.
2007-01-22 23:50:42 +00:00
Antoine Musso
c771fc9c96 Use Doxygen @addtogroup instead of phpdoc @package && @subpackage 2007-01-20 15:09:52 +00:00
Brion Vibber
d88bf87284 Apply most of the code tweaks from the live site:
* use configured cache servers for mctest.php
* bucket details in mcc.php
* fix input validation and remove debugging code in compressOld
* full ID range for moveToExternal
* fix resolveStubs.php for compatibility with older serialized data
* maximum line length for bar graphs in getLagTimes.php
* recognize specieswiki in rebuildInterwiki.inc
* --purge option to do additional parser-cache purging for purgeList.php
* default changed in MiniDonation extension
* profile unicode cleanup in Xml
* log slow parses in Article.php
* profile wfMsgReal
* log mkdir failures
* profile AutoLoader
* rebuild empty DjVu metadata containing ''
* security fix for DjVu metadata retrieval
2007-01-17 00:54:54 +00:00
Brion Vibber
8d4c6af284 revert r18517; should have been on branch 2006-12-23 09:03:36 +00:00
Paa Kwesi Imbeah
9574ae460f Minimal version of IC functionality. 2006-12-23 05:30:40 +00:00
Nick Jenkins
ae8554c45b Completing code housekeeping stuff for rest of includes/ directory: removing unused local vars, removing unused globals, replacing extract() where simple to do, declaring output arrays before calling preg_match(), and so forth. 2006-11-29 11:43:58 +00:00
Nick Jenkins
74ea267553 Prevent the following strict-standards warnings - i.e. when running with error_logging(E_ALL | E_STRICT); - which seems to disable the yucky "@" operator, as well as maxing out the pedantry of warnings. Nothing major found, just nice to be as explicit and as forward-compatible as possible.
* Strict Standards: Undefined index: switch in includes/Parser.php on line 3849
* Strict Standards: Undefined index: ref in includes/Parser.php on line 3818
* Strict Standards: Non-static method OutputPage::setEncodings() should not be called statically in index.php on line 11
* Strict Standards: Only variables should be assigned by reference in includes/Skin.php on line 888
* Strict Standards: Non-static method Title::newFromURL() should not be called statically in includes/SpecialContributions.php on line 178
* Strict Standards: Only variables should be assigned by reference in includes/GlobalFunctions.php on line 2054
* Strict Standards: Undefined index:  contributions-summary in languages/Language.php on line 764
* Strict Standards: Undefined index:  trackbackhtml in skins/MonoBook.php on line 86
* Strict Standards: Undefined index:  blockip in skins/MonoBook.php on line 204
* Strict Standards: Undefined index:  tagline in skins/MonoBook.php on line 261
* Strict Standards: Undefined index: uselang in includes/SkinTemplate.php on line 1159
* Strict Standards: Non-static method CoreParserFunctions::plural() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Undefined offset:  0 in includes/SkinTemplate.php on line 196
* Strict Standards: Undefined index:  USE INDEX in includes/Database.php on line 1015
* Strict Standards: Undefined index:  image_tests in includes/Parser.php on line 3488
* Strict Standards: Undefined offset:  0 in includes/Parser.php on line 3507
* Strict Standards: Non-static method ChangesList::newFromUser() should not be called statically in includes/SpecialWatchlist.php on line 361
* Strict Standards: Non-static method RecentChange::newFromCurRow() should not be called statically in includes/SpecialWatchlist.php on line 367
* Strict Standards: is_a(): Deprecated. Please use the instanceof operator in includes/Exception.php on line 168
* Strict Standards: Non-static method LogPage::logName() should not be called statically in includes/SpecialContributions.php on line 325
* Strict Standards: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush. in maintenance/commandLine.inc on line 191
* Strict Standards: Undefined index:  meatball in languages/Language.php on line 234
* Strict Standards: rmdir(/tmp/mwParser-2108164586-images/thumb): Directory not empty in maintenance/parserTests.inc on line 605
* Cleaning out some new temp files left over by parserTests (there were one or two straggler dirs/files that would persist after the test run ended, due to new tests being added over time)
* Strict Standards: Non-static method CoreParserFunctions::special() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Declaration of ListUsersPage::preprocessResults() should be compatible with that of QueryPage::preprocessResults() in includes/SpecialListusers.php on line 38
* Strict Standards: Only variables should be passed by reference in includes/SpecialBlockip.php on line 175
* Strict Standards: Skin::include_once(skins/Standard.deps.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in includes/Skin.php on line 121
* Strict Standards: Declaration of ApiMain::getResult() should be compatible with that of ApiBase::getResult() in includes/api/ApiMain.php on line 35
* Strict Standards: is_a(): Deprecated. Please use the instanceof operator in includes/WikiError.php on line 63
* Strict Standards: Non-static method WikiError::isError() should not be called statically in includes/SpecialImport.php on line 64
* Strict Standards: Non-static method ImportStreamSource::newFromInterwiki() should not be called statically in includes/SpecialImport.php on line 58<b
* Strict Standards: Only variables should be assigned by reference in includes/SpecialUndelete.php on line 501
* Strict Standards: Non-static method Image::newFromName() should not be called statically in thumb.php on line 56
* Strict Standards: Non-static method CoreParserFunctions::numberoffiles() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Non-static method CoreParserFunctions::statisticsFunction() should not be called statically in includes/CoreParserFunctions.php on line 139
* Strict Standards: Non-static method CoreParserFunctions::isRaw() should not be called statically in includes/CoreParserFunctions.php on line 128
* Strict Standards: Non-static method CoreParserFunctions::grammar() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Undefined offset:  1 in includes/SpecialMIMEsearch.php on line 130
* Strict Standards: Undefined index:  recentchangeslinked in skins/MonoBook.php on line 184
* Strict Standards: Declaration of DumpNotalkFilter::pass() should be compatible with that of DumpFilter::pass() in includes/Export.php on line 612
* Strict Standards: Declaration of DumpNamespaceFilter::pass() should be compatible with that of DumpFilter::pass() in includes/Export.php on line 665
* Strict Standards: Non-static method ImportStreamSource::newFromUpload() should not be called statically in includes/SpecialImport.php on line 46
* Strict Standards: Undefined offset:  5 in includes/Sanitizer.php on line 396
* Strict Standards: Undefined index:  wikidbUserName in includes/SpecialUserlogin.php on line 562
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryBase.php on line 95
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryBase.php on line 116
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryWatchlist.php on line 128
* Strict Standards: Undefined property:  stdClass::$rc_id in includes/api/ApiQueryBase.php on line 131
* Strict Standards: Undefined property:  stdClass::$rc_last_oldid in includes/api/ApiQueryBase.php on line 164
* Strict Standards: Undefined property:  stdClass::$rc_moved_to_ns in includes/api/ApiQueryBase.php on line 285
* Strict Standards: Undefined property:  stdClass::$rc_patrolled in includes/api/ApiQueryBase.php on line 176
* Strict Standards: Undefined index:  comment in includes/api/ApiFeedWatchlist.php on line 85
* Strict Standards: Undefined offset:  0 in includes/Skin.php on line 302
* Strict Standards: Non-static method User::SetupSession() should not be called statically in includes/SpecialUserlogin.php on line 15

... There are certain to be other things too, so this is not intended to be comprehensive, rather the above just stops most of the notifications I observed.
2006-11-29 05:45:03 +00:00
Nick Jenkins
a474761d9a Changing lines like this: "extract( $dbw->tableNames( 'page', 'archive' ) );" to be like this: "list ($page, $archive) = $dbw->tableNamesN( 'page', 'archive' );".
Three reasons for this:
1) It's better for analysis tools [which want explicit variable declaration]
2) It's easier for a human to read, as it's completely explicit where the variables came from [which is something you don't get with extract() ]
3) It makes it easier to find everywhere where a variable is used with search/grep [which you can't currently do with $tbl_page variables from things like: "extract($db->tableNames( 'page', 'revision'), EXTR_PREFIX_ALL, 'tbl');"].

Otherwise, from a functionality/efficiency perspective the two forms should be identical.

By doing this have been able run static analysis over the usages of these variables, thus eliminating 5 unneeded table names from calls, plus removing 3 unused calls entirely, and it just feels subjectively slightly nicer to me.
2006-11-27 08:36:57 +00:00
Tim Starling
2f12a58d93 * Introduced StringUtils.php, populated it with some generic string functions, both new and collected from various other files.
* Removed some backtracking regexes with an O(N^2) worst case, replaced with StringUtils::delimiterReplace(). There is a beneficial functional difference: /*/ is no longer considered to be a complete CSS comment.
* Changed the parser strip state from an array to an object. This should hopefully avoid the PHP bugs with array references. StripState uses the new ReplacementArray to do the replacements, thereby supporting FSS. 
* Removed DatabaseFunctions.php from the default startup sequence. Moved wfGetDB() to GlobalFunctions.php.
* Introduced the SiteStats class, with a collection of cached site stats accessor functions.
* Removed all global functions from Parser.php, they don't belong there.
* Made LanguageConverter use the new ReplacementArray class instead of managing its own FSS objects.
2006-11-21 09:53:45 +00:00
Brion Vibber
68ce1cb3bf * Fix purging for updated SVG files
Purging was using getViewUrl(), which is a generated thumbnail for SVG and other render-only formats.
Switched to using getUrl(), which returns the file itself. The thumb will be separately covered as is.
2006-10-29 18:04:11 +00:00
Brion Vibber
ad447f6bf4 * (bug 7599) Fix thumbnail purging, PHP notices on HTCP image page purge
Somebody changed the parameters and return value of Image->thumbUrl()
and didn't update all uses. Silly of them!

Also add a paranoia check on urls in the list in SquidUpdate

And don't redefine the socket options constants when called a second time
2006-10-16 19:12:56 +00:00
Ilmari Karonen
0471eded8a use ImageMagick -thumbnail option instead of -resize 2006-10-05 14:55:41 +00:00
Tim Starling
e174a4ddfb Abolished $wgDBname as a unique wiki identifier, it doesn't work with the new-fangled feature we call "table prefixes". Instead use wfWikiID() for an identifier containing the DB name and the prefix if there is one, and wfMemcKey() for cache key construction.
Caches for wikis with table prefixes will be lost on upgrade, caches for wikis without table prefixes will be preserved. Custom cache keys in extensions can be migrated at leisure. Extensions which write to core cache keys should be migrated ASAP, as I have done with Special:Makesysop.
2006-10-04 09:06:18 +00:00
Tim Starling
3005679b0e * Removed lots of explicit require_once statements. The autoloader should theoretically be faster, because it always uses an absolute path, eliminating the need for a search, and it is never called unnecessarily. Absolute paths are also more robust in the face of odd configurations or usage patterns. Moved a few constants around to support this, they always have to be available before the method call.
* Deleted DatabaseMysql.php, no longer necessary, database classes are autoloaded. 
* Moved wfGetMimeMagic() to MimeMagic::singleton()
* Fixed a couple of __CLASS__.'::'.__FUNCTION__ things.
2006-10-03 13:00:52 +00:00
Brion Vibber
c8acd3393b * Cleaner error behavior on thumb.php with invalid page selection 2006-10-02 21:12:28 +00:00
Jens Frank
41440bf516 update metadata for old images, ignore page= if no djvu renderer has been supplied 2006-08-27 18:36:54 +00:00
Jens Frank
27624af90a DJVU rendering: Handle old DB metadata entries 2006-08-13 21:09:20 +00:00
Jens Frank
5c6c53b39a remove superfluous debugging code 2006-08-13 20:03:11 +00:00
Jens Frank
7f7e79022b (bug 6420) Render thumbnails for djvu images, show multipage preview on image page 2006-08-13 17:34:48 +00:00
Tim Starling
6530b5eb12 Allow negative caching for sites with no commons 2006-08-06 13:32:56 +00:00
Brion Vibber
5721fe68c0 Restore factory function to avoid gratuitously breaking extensions for no reason whatsoever what the heck 2006-07-12 06:39:55 +00:00
Antoine Musso
fa813bd470 Fix #6622: image::newFromTitle deprecated but still used 2006-07-10 19:49:22 +00:00
Antoine Musso
5c225aa659 static function 2006-07-10 19:34:07 +00:00
Tim Starling
13cbb3dd29 Fixed SVG bug introduced in 15342 2006-07-05 12:51:38 +00:00
Tim Starling
643396ce0a profiling 2006-07-05 07:20:11 +00:00
Tim Starling
5bd1f1f834 removed debugging code 2006-07-05 05:15:17 +00:00
Tim Starling
179733a3f0 Created $wgGenerateThumbnailOnParse, set to false to allow NFS stat calls to be suppressed. 2006-07-05 05:04:06 +00:00