Commit graph

95 commits

Author SHA1 Message Date
Aaron Schulz
7e9f8ec1df Simplified some code and broke lines in thumb.php
Change-Id: I99fc63ab473a3f2fe33e0227e5e283e0c195f01b
2013-09-20 18:10:31 +00:00
Brian Wolff
82a8e07935 Make thumb.php give http redirects if given a file redirect
See bug 22390 for some of the background. Basically there's two
reasons why we want this:
* Hotlinkers to commons. We don't want to break their links when
we move a file (Wikimedia blog is a prominent hotlinker)
* Cached entires. On wikis using commons files, a file move doesn't
trigger HTMLCacheUpdate jobs for the downstream wiki (it only
triggers it on commons). This means that these pages will still
use the old version of the html (with img tags that have the old
url) until the next edit or purge action. But these urls won't
work as soon as the file is moved.

I'm pretty confident that redirects will work at this point
in the thumb stack, as the redirects for long file names work
fine (provided no thumb exists in swift with the wrong name).

Change-Id: I40350121cf902f66fcbd3cf788335a988fa7ee33
2013-08-27 09:22:05 -06:00
Aaron Schulz
555664ac63 Simplified some tedious profiling code
Change-Id: Ia5d56b3a38feb1b151f6821d76abbdd6b2dd9f46
2013-08-22 11:18:19 -07:00
Brian Wolff
377f8ffa07 thumb_handler.php doesn't seem to extract path_info correctly
Set $wgArticlePath so that it works the way that [[Manual:Thumb.php]]
claims it does.

Change-Id: I35b4ab73e1d84dad10503d3a098ee154e8d58d8a
2013-06-16 22:43:13 -03:00
Timo Tijhof
4bd5471ca3 docs: Remove odd colons after @todo
Most were this way already:
https://doc.wikimedia.org/mediawiki-core/master/php/html/todo.html

Ran a find/replace on the odd ones. Also made them all
lower case.

Change-Id: I70c6a69344ddebc603e9a1c1d87e3cc4f4f4c560
2013-05-15 06:23:40 +00:00
Timo Tijhof
50e7985d4d phpcs: Fix WhiteSpace.LanguageConstructSpacing warnings
Squiz.WhiteSpace.LanguageConstructSpacing:
   Language constructs must be followed by a single space;
   expected "require_once expression" but found
   "require_once(expression)"

It is a keyword (e.g. like `new`, `return` and `print`). As
such the parentheses don't make sense.

Per our code conventions, we use a space after keywords like
these. We appeared to have an unwritten exception for `require`
that doesn't make sense. About 60% of require/include usage
was missing the space and/or had superfluous parentheses.

It is as silly as print("foo") or return("foo"), it works
because keywords have no significance for whitespace between
it and the expression that follows, and since experessions can
be wrapped in parentheses for clarity (e.g. when doing string
concatenation or mathematical operations) the parenthesis
before and after basiclaly just ignored.

Change-Id: I2df2f80b8123714bea7e0771bf94b51ad5bb4b87
2013-05-09 05:56:26 +02:00
Tim Starling
1fe9340bb3 Remove hphpc support and deprecate related functions
hphpc has been superseded by hhvm, so support for hphpc is no longer
needed.

* Continue to use Preprocessor_Hash under HipHop since it is still
  faster under hhvm
* Keep $wgCompiledFiles for now, so that wikihiero doesn't give an error
  before Ic9d1e795 is merged
* Migrate the run-server script and associated configuration file to
  hhvm. Enable EnableStaticContentFromDisk since it doesn't seem
  ridiculously inefficient at first glance. Run from $IP rather than
  $IP/.. since hhvm is apparently not picky about sourcing files from
  outside of the current directory.

Change-Id: Ic3e769f1fbad4f7ad26dd819406796fee48c6b45
2013-05-09 08:28:05 +10:00
Siebrand Mazeland
655f5c6b48 Update code formatting
Change-Id: I8741b5b979e55f38a666961a16c387586a92410e
2013-02-14 13:38:19 +00:00
Aaron Schulz
a04d9cb748 Improved some thumb.php error messages.
Change-Id: I5a61e898dd97db67b719a13ca044530c4baecc99
2013-01-23 11:11:44 -08:00
Aaron Schulz
dfe02f371b (bug 42302) Fixed broken thumbnails for files with a "+" in the name.
Change-Id: Ic5764fa17e12d24ddbc77bfc0523e97ed12b0afe
2012-11-24 15:47:22 -08:00
Aaron Schulz
3fca064bfc Fixed uncaught thumbName() exceptions and use $_GET.
* Using $_REQUEST is bad since cookie data is also in there.
* Also made a few tiny code cleanups.

Change-Id: Ib7064b95a2788484d05cf457034fe1d5be298bc4
2012-11-15 17:19:08 -08:00
Aaron Schulz
c43deebfd5 Simplified thumb.php for 404 handling.
* Made thumb_handler.php "just work" in a way similar to img_auth.
  It no longer needs any "handlerUrl" setting to be set.

Change-Id: I557ba1f94db3cef0f21f5c0e2b60d8e381ea3f96
2012-11-08 17:31:05 +11:00
Aaron Schulz
3338587604 [FileRepo] Allow different file URLs for media based on file extension.
Change-Id: Ib647377312c93c8ed046f7b9510d0e656788cdc3
2012-11-08 06:19:39 +00:00
Jan Gerber
02624d0016 Allow ExtractThumbParameters before local regexp
ExtractThumbParameters might be able to extract more params but still
match the local regexp. To be able to extract all params, check
ExtractThumbParameters first and only fallback to regexp.

Change-Id: I26efdec1af5fb2bd5e3cc503f36692d12668b2e2
2012-11-02 08:47:32 +00:00
Aaron Schulz
42c0f35133 Avoid thumb.php fatal for bad titles on private wikis.
Change-Id: Id2c19d888989fdbaad6412aa9eb62bb22a75f241
2012-10-10 11:16:28 -07:00
Aaron
56266b2ac4 Merge "Worked around hash path inconsistency to unbreak stash file thumbs." 2012-09-20 16:59:09 +00:00
Aaron Schulz
94158d6387 Don't send empty Vary headers.
Change-Id: I0b6bd7ab24323782302c28cf1438dce62f5b8c5a
2012-09-19 21:18:19 -07:00
Aaron
3bbb73468a Worked around hash path inconsistency to unbreak stash file thumbs.
Change-Id: I567467b75a600841440b36352d5675866d3fca2b
2012-09-19 17:45:39 -07:00
Aaron Schulz
e456ef4a0e (bug 39975) Fixed thumb_handler.php handling of /temp thumb urls.
This basically makes the 'rel404' param for temp thumbanils not
start with "/temp" anymore so that they don't count as bogus.

Change-Id: I88c2c50b5372c7b95108d26ba16ddcd91fdb1154
2012-09-18 11:47:27 -07:00
Tim Starling
f1d13a6653 Add Vary: X-Forwarded-Proto to the thumb.php redirect
Also added missing return. Untested.

Change-Id: I975b82d18ba98d1d9b1f2124150af9e5c41f418e
2012-09-12 21:17:37 +00:00
Aaron
97832b6b1d thumb.php now handles short and long thumbnail name formats when possible.
Change-Id: I33932ac0e0294dc13332dce9d4ab00a75d9cdcba
2012-09-12 21:17:09 +00:00
Aaron Schulz
5fbef994cf Revert "thumb.php now handles short and long thumbnail name formats when possible."
Doesn't quite work, since $img->transform() still saved the thumb under the normal name.

This reverts commit 5b33e66b74
2012-09-06 17:52:33 +00:00
Aaron
5b33e66b74 thumb.php now handles short and long thumbnail name formats when possible.
Change-Id: I8e53ce711e23127854185661c5ce8bddbb226623
2012-09-04 14:59:26 -07:00
Aaron Schulz
d22c890890 Fixed and normalized content-disposition for thumbs.
* Previously, thumbnails could have a hex tmp file name as the disposition.

Change-Id: I495860dc54c02d2b3e053e998a41674cd6d07f2f
2012-08-31 22:32:47 -07:00
Tim Starling
ad03f2f753 Revert Uri class due to bug 39710
Revert 94f623363b. Apparently all
ReverseChronologicalPager subclasses were broken by the unexplained
interface change in wfArrayToCgi(): changing the interpretation of
null array values from "omit this key" to "include this key with no
value". The function has always been called with the former
interpretation, that's why the special case was in there.

Also reverted dependent changes 4b517fa and part of 3d97704.

Change-Id: I41dadbde5d0e0e4c54cc76bfc13c263c15c73828
2012-08-28 10:53:09 +10:00
jeroendedauw
38c7f444e1 Use __DIR__ instead of dirname( __FILE__ )
We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :)

Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
2012-08-27 21:45:00 +02:00
Siebrand Mazeland
3d97704f91 Replace some deprecated method calls.
Change-Id: Id4beca7b6821139fcc319c5694917e68668835ee
2012-08-19 23:27:43 +02:00
Alex Monk
2fabea7eea Use wfMessage instead of deprecated wfMsg*
Or $this->msg in special pages.

Change-Id: I774a89d646615053c8424050e42ad95601f92543
2012-08-18 14:11:05 +02:00
Aaron
25fe23a403 Various thumb.php fixes.
* Made wfThumbHandle404() handle full REQUEST_URI urls.
* Made wfExtractThumbParams() handle protocal relative zone urls.
* Added FileRepo::getZoneHandlerUrl() and site zone configuration to simplify wmf rewrite rules.
* Renamed some variables to be less misleading.

Change-Id: Ic3e23c2a623c1241ee22a9811aee073fb07aa68c
2012-07-26 13:59:07 -07:00
Alexandre Emsenhuber
f27ff698fb Added missing GPLv2 headers in some places.
Also made file documentation more consistent.

Change-Id: I30e124514396f110a572467b94ca06cefd5f7b46
2012-05-23 13:41:30 +02:00
Aaron Schulz
8667a6354d [FileRepo] Added support for temp file repos (to preserve our thumb.php hack).
* Added FileRepo::getTempRepo() to get a temporary repo similiar to the one used in wmf1.19 thumb.php.
* Merged and cleaned up wmf1.19 code into thumb.php to handle temp files and thumbnails.

Change 1: prevent FileRepo::getTempRepo() from being called on the result of FileRepo::getTempRepo().

Change 2: made FileRepo::getTempRepo() account for cases when the 'directory' param is not the empty string.

Change 3:
* Tweaked TempFileRepo to override getTempRepo() to enforce restriction.
* Added FileRepo::getTempHashPath() and used in thumb.php to get the correct path.

Change-Id: I2937b5ffb3ec9a7e2741b42bc28dc76833053fcd
2012-04-06 15:55:44 -07:00
Platonides
9951f9f9ae trunk/phase3 is now mediawiki/core
Change-Id: Ief2721ee6573a5e54a276c91de636d9e1a678b8b
2012-03-23 17:19:22 +01:00
Sam Reed
356799f95a Drag in a change noticed in wmf branches 2012-02-11 15:14:15 +00:00
Aaron Schulz
224dfaeb33 * Removed thumb.php comment about ProofreadPage, page numbers are more general.
* Added ExtractThumbParameters hook handlers for ogg and tiff handler extensions.
2012-02-10 20:52:57 +00:00
Aaron Schulz
30ed85146a r111076: url decode the 'rel404' path...*ahem*. Archived files and files with special chars are otherwise broken. 2012-02-10 01:35:13 +00:00
Aaron Schulz
5e91795785 (bug 34231) - 'Make thumb.php error or redirect for urls with bogus paths but valid file & thumb names.' 2012-02-09 19:45:12 +00:00
Aaron Schulz
8f0814e64c Similar to r108937: fixed breakage where the zone urls were defined as relative paths. 2012-01-20 20:52:09 +00:00
Aaron Schulz
cae80e3738 r105512: Handle REDIRECT_URL discrepancies and always work with URI paths for thumb 404 handling 2012-01-14 19:17:17 +00:00
Aaron Schulz
5a6559d8b1 Reverted r108743 per CR comment. This should at least be discussed first. 2012-01-12 19:41:18 +00:00
Sam Reed
a5c200a25b Kill "* @return void" 2012-01-12 19:12:24 +00:00
Aaron Schulz
c8a0908bdf FU r105512: urldecode() the file and thumb name in wfExtractThumbParams() for 404 handling as needed. 2011-12-22 00:43:11 +00:00
Aaron Schulz
5275f9b097 Merged FileBackend branch. Manually avoiding merging the many prop-only changes SVN likes to sprinkle in (easy to spot from the change list). Did not add SwiftFileBackend.php as it still is in development. 2011-12-20 03:52:06 +00:00
Robin Pepermans
be2de16942 update all core usage of deprecated Title::userCanRead() 2011-12-13 11:05:30 +00:00
Aaron Schulz
056651c3f0 FU r105512: just always use thumb.php style errors 2011-12-08 04:58:26 +00:00
Aaron Schulz
dcbe8e7dd3 FU r101117: removed cURL thumb handler code and made thumb_handler.php a thin wrapper around thumb.php
* Moved original URL fetching code and parameter extraction code to thumb.php
* Made use of local repo URL and hash settings to avoid extra config code
* This makes it easy to add hooks for extensions/config to alter behavoir (ExtractThumbParameters hook added)
* Added FileRepo::getHashLevels()
2011-12-08 03:43:07 +00:00
Aaron Schulz
3a6b5d6005 FU r100535:
* Thumb handler can now also work without cURL
* Combined related config vars into array config vars
* Folded $thgThumb404File into $thgThumbCallbacks
* Avoided some global pollution
2011-10-28 05:12:12 +00:00
Aaron Schulz
12b7bfe233 More whitespace tweaks...and fixed doc typo 2011-10-20 19:05:48 +00:00
Aaron Schulz
ed74ccc6da Minor code style cleanups and tweaks 2011-10-19 00:14:13 +00:00
Sam Reed
d90b987ade Fix whitespace, braces
Fix return items
2011-10-15 22:58:42 +00:00
Chad Horohoe
1a1e917c86 Move wfStreamFile() into a class, update all callers in core (only 3 extensions use it afaict), leave wfStreamFile() as a b/c alias for now.
Yay less global functions, autoloading and less manual require()s.
2011-08-13 19:03:51 +00:00