[MediaWiki-commits] [Gerrit] Move Tyler and csteipp to the developers section of CREDITS. - change (mediawiki/core)

2015-08-22 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/233126

Change subject: Move Tyler and csteipp to the developers section of CREDITS.
..

Move Tyler and csteipp to the developers section of CREDITS.

I think both of them are more than just patch contributors.

Change-Id: I53df9a62cb856ba2afc8cb1570d6da4095032d02
---
M CREDITS
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/26/233126/1

diff --git a/CREDITS b/CREDITS
index d93f97d..255e49a 100644
--- a/CREDITS
+++ b/CREDITS
@@ -24,6 +24,7 @@
 * Bryan Tong Minh
 * Chad Horohoe
 * Charles Melbye
+* Chris Steipp
 * church of emacs
 * Daniel Friesen
 * Daniel Kinzler
@@ -91,6 +92,7 @@
 * Tim Starling
 * Timo Tijhof
 * Trevor Parscal
+* Tyler Anthony Romeo
 * Victor Vasiliev
 * Yesid Carrillo
 * Yuri Astrakhan
@@ -116,7 +118,6 @@
 * Brianna Laugher
 * Carlin
 * Carsten Nielsen
-* Chris Steipp
 * Christian Aistleitner
 * Christian Neubauer
 * Conrad Irwin
@@ -236,7 +237,6 @@
 * The Evil IP address
 * Tim Landscheidt
 * Tisane
-* Tyler Anthony Romeo
 * Umherirrender
 * Van de Bugger
 * Ville Stadista

-- 
To view, visit https://gerrit.wikimedia.org/r/233126
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I53df9a62cb856ba2afc8cb1570d6da4095032d02
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add JamesF to credits in developers section - change (mediawiki/core)

2015-08-22 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/233127

Change subject: Add JamesF to credits in developers section
..

Add JamesF to credits in developers section

Change-Id: Ic47f4e49d663d502195bc9661f0e48b57adecf1e
---
M CREDITS
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/27/233127/1

diff --git a/CREDITS b/CREDITS
index 255e49a..5362286 100644
--- a/CREDITS
+++ b/CREDITS
@@ -44,6 +44,7 @@
 * Jack D. Pond
 * Jack Phoenix
 * Jackmcbarn
+* James Forrester
 * Jan Paul Posma
 * Jason Richey
 * Jeroen De Dauw

-- 
To view, visit https://gerrit.wikimedia.org/r/233127
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic47f4e49d663d502195bc9661f0e48b57adecf1e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix classname mismatch between upload js and templates/thumb... - change (mediawiki/core)

2015-08-23 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/233345

Change subject: Fix classname mismatch between upload js and 
templates/thumbnail.html
..

Fix classname mismatch between upload js and templates/thumbnail.html

Classname was changed to use newer jQuery library, but js was still
hardcoding the old classname. This resulted in the preview of the
to be uploaded file, not to be shown.

I added an html comment to the template file to warn future
modifies about the dependency. I'm not sure if html comments in
template files are considered "appropriate".

Bug: T109952
Change-Id: I098a86260453d32644ff9ab06194c13998643de9
Follow-up: 6a70cc6968a3780c0b118e07f02f5ef015e655bb
---
M resources/src/mediawiki.special/mediawiki.special.upload.js
M resources/src/mediawiki.special/templates/thumbnail.html
2 files changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/45/233345/1

diff --git a/resources/src/mediawiki.special/mediawiki.special.upload.js 
b/resources/src/mediawiki.special/mediawiki.special.upload.js
index ea1eb99..7dd0369 100644
--- a/resources/src/mediawiki.special/mediawiki.special.upload.js
+++ b/resources/src/mediawiki.special/mediawiki.special.upload.js
@@ -369,7 +369,7 @@
ctx.clearRect( 0, 0, 180, 180 );
ctx.rotate( rotation / 180 * Math.PI );
ctx.drawImage( img, x, y, width, height 
);
-   thumb.find( '.mw-small-spinner' 
).replaceWith( $canvas );
+   thumb.find( '.mw-spinner-small' 
).replaceWith( $canvas );
 
// Image size
info = mw.msg( 'widthheight', 
logicalWidth, logicalHeight ) +
diff --git a/resources/src/mediawiki.special/templates/thumbnail.html 
b/resources/src/mediawiki.special/templates/thumbnail.html
index 4f41fad..305f20c 100644
--- a/resources/src/mediawiki.special/templates/thumbnail.html
+++ b/resources/src/mediawiki.special/templates/thumbnail.html
@@ -1,5 +1,6 @@
 

+   




-- 
To view, visit https://gerrit.wikimedia.org/r/233345
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I098a86260453d32644ff9ab06194c13998643de9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Workaround im bug where greyscale have assumed gamma of 1 - change (mediawiki/core)

2015-07-23 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/226665

Change subject: Workaround im bug where greyscale have assumed gamma of 1
..

Workaround im bug where greyscale have assumed gamma of 1

On versions prior to image magick 6.9.0-1, greyscale images with
no gAMA, sRGB, or iCCP chunk are treated as being linear
greyscale. This is almost always not the case, and a more sane
default is to assume a gAMA of .45455 (or 2.2 depending on your
perspective). The result of this is thumbnails appear to be
very light.

Detect if image is affected, and override the default gamma on
affected versions of image magick.

Since its required to make this change work, this also adds
detection for if image is marked with a colour profile, and
mentions that fact on the image description page under metadata
(hidden by default).

For reference, the changes to PNGMetadataExtractor are based
on PNG spec at http://www.w3.org/TR/PNG/

This is semi-wip, as I should add tests for the PNG metadata
extractor changes.

Bug: T106516
Change-Id: Ief2fb0aa6e7a7639d41d0c7f1fb9da983bf2828d
---
M includes/media/Bitmap.php
M includes/media/PNGMetadataExtractor.php
2 files changed, 46 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/65/226665/1

diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php
index 4be20b2..11c35a7 100644
--- a/includes/media/Bitmap.php
+++ b/includes/media/Bitmap.php
@@ -136,6 +136,22 @@
}
}
 
+   if ( $params['mimeType'] === 'image/png' ) {
+   // Work-around T106516 (Wrong default gamma on 
greyscale png images w/o gAMA chunk)
+   MediaWiki\suppressWarnings();
+   $pngMeta = unserialize( $image->getMetadata() );
+   MediaWiki\restoreWarnings();
+   if ( $pngMeta && isset( $pngMeta['gamma'] )
+   && $pngMeta['gamma'] === false
+   && ( $pngMeta['colorType'] === 
'greyscale-alpha' || $pngMeta['colorType'] === 'greyscale' )
+   && !isset( $pngMeta['metadata']['ColorSpace'] )
+   && version_compare( $this->getMagickVersion(), 
"6.9.0-1" ) < 0
+   ) {
+   $animation_pre[] = '+gamma';
+   $animation_pre[] = '.45455';
+   }
+   }
+
// Use one thread only, to avoid deadlock bugs on OOM
$env = array( 'OMP_NUM_THREADS' => 1 );
if ( strval( $wgImageMagickTempDir ) !== '' ) {
diff --git a/includes/media/PNGMetadataExtractor.php 
b/includes/media/PNGMetadataExtractor.php
index ac92460..98c656f 100644
--- a/includes/media/PNGMetadataExtractor.php
+++ b/includes/media/PNGMetadataExtractor.php
@@ -80,6 +80,7 @@
$duration = 0.0;
$bitDepth = 0;
$colorType = 'unknown';
+   $gamma = false;
 
if ( !$filename ) {
throw new Exception( __METHOD__ . ": No file name 
specified" );
@@ -358,6 +359,34 @@
// 3 = dots per cm (from Exif).
}
}
+   } elseif ( $chunk_type === 'gAMA' ) {
+   if ( $chunk_size !== 4 ) {
+   throw new Exception( __METHOD__ . ": 
gAMA wrong size" );
+   }
+   $buf = self::read( $fh, $chunk_size );
+   $res = unpack( "Nvalue", $buf );
+   $gamma = 10/$res['value'];
+   } elseif ( $chunk_type === 'sRGB' ) {
+   if ( $chunk_size !== 1 ) {
+   throw new Exception( __METHOD__ . ": 
sRGB wrong size" );
+   }
+   $buf = self::read( $fh, $chunk_size );
+   $res = unpack( "Cvalue", $buf );
+   // 1 for consistency with how Exif identifies 
sRGB
+   $text['ColorSpace'] = 1;
+   } elseif ( $chunk_type === 'iCCP' ) {
+   $profileNameRead = max( $chunk_size, 80 );
+   $buf = self::read( $fh, max( $chunk_size, 80 ) 
);
+   $cutoff = strpos( $buf, "\0" );
+   if ( $cutoff === false ) {
+   throw new Exception( __METHOD__ . ": 
iCCP profile name not null terminated" );
+   }
+   $res = trim( substr( $buf, 0, 

[MediaWiki-commits] [Gerrit] Fix double escaping in special:log/gwtoolset - change (mediawiki...GWToolset)

2015-07-24 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/226724

Change subject: Fix double escaping in special:log/gwtoolset
..

Fix double escaping in special:log/gwtoolset

Note the  tag (from calling ->parse on the message) in
https://commons.wikimedia.org/?title=Special:Log&offset=20150724115413&type=gwtoolset&user=Jason.nlw&limit=2

Note the surounding of things by < > in
https://commons.wikimedia.org/?title=Special:Log&type=gwtoolset&user=Jason.nlw&offset=20150724122545&limit=1
caused by giving status::newFatal the results of wfMessage( .. )->text()
instead of the message name like its supposed to take.

Ideally this would be modified to have the messages expanded by
the log handler (Like newstyle logs), but that's a much larger
change, and I'd first like to just get the escaped html out
of the log view.

Bug: T87044
Change-Id: I72123fde8e8aad9401ca861f057acd946f1c8d93
---
M includes/GWTException.php
M includes/Handlers/UploadHandler.php
2 files changed, 15 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GWToolset 
refs/changes/24/226724/1

diff --git a/includes/GWTException.php b/includes/GWTException.php
index 8875c82..9c7874a 100644
--- a/includes/GWTException.php
+++ b/includes/GWTException.php
@@ -44,14 +44,16 @@
 
if ( is_array( $message ) ) {
foreach ( $message as $key => $params ) {
-   $result .= wfMessage( $key )->params( $params 
)->parse();
+   $result .= wfMessage( $key )->params( $params 
)->text();
}
-   } else if ( strpos( $message, 'gwtoolset-' ) !== false ) {
-   $result .= wfMessage( $message )->parse();
+   } else if ( strpos( $message, 'gwtoolset-' ) === 0 ) {
+   $result .= wfMessage( $message )->text();
} else {
-   $result = Sanitizer::removeHTMLtags( $message );
+   $result = $message;
}
 
+   $result = Sanitizer::removeHTMLtags( $result );
+
return $result;
}
 
diff --git a/includes/Handlers/UploadHandler.php 
b/includes/Handlers/UploadHandler.php
index 926008c..d9a434a 100644
--- a/includes/Handlers/UploadHandler.php
+++ b/includes/Handlers/UploadHandler.php
@@ -244,24 +244,18 @@
if ( $warnings['exists']['warning'] === 'exists' ) {
// check if another contributor has altered 
this title
if ( $this->otherContributors( $title ) ) {
-   $msg =
-   wfMessage( 
'gwtoolset-mediafile-other-contributors' )
-   ->params( 
$warnings['exists']['file']->getTitle() )
-   ->text();
-
-   $status = Status::newFatal( $msg );
+   $status = Status::newFatal( 
'gwtoolset-mediafile-other-contributors',
+   
$warnings['exists']['file']->getTitle()
+   );
 
// this title’s most recent mediafile is the 
same as the one being uploaded
} else if (
$upload->getTempFileSha1Base36() ===
$warnings['exists']['file']->getSha1()
) {
-   $msg =
-   wfMessage( 
'gwtoolset-mediafile-duplicate-same-title' )
-   ->params( 
$warnings['exists']['file']->getTitle() )
-   ->text();
-
-   $status = Status::newFatal( $msg );
+   $status = Status::newFatal( 
'gwtoolset-mediafile-duplicate-same-title',
+   
$warnings['exists']['file']->getTitle()
+   );
}
}
}
@@ -272,12 +266,9 @@
&& isset( $warnings['duplicate'] )
&& count( $warnings['duplicate'] ) > 0
) {
-   $msg =
-   wfMessage( 
'gwtoolset-mediafile-duplicate-another-title' )
-   ->params( 
$warnings['duplicate'][0]->getTitle() )
-   ->text();
-
-   $status = Status::newFatal( $msg );
+   $status = Status::newFatal( 
'gwtoolse

[MediaWiki-commits] [Gerrit] The http-invalid-url message has a parameter, so send it - change (mediawiki/core)

2015-07-24 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/226725

Change subject: The http-invalid-url message has a parameter, so send it
..

The http-invalid-url message has a parameter, so send it

Currently was outputting raw $1 to user.

Change-Id: If1d10270f4d446c4d1703457903034e8356c1503
---
M includes/HttpFunctions.php
M includes/upload/UploadFromUrl.php
2 files changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/25/226725/1

diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php
index 825cd06..7b43a2d 100644
--- a/includes/HttpFunctions.php
+++ b/includes/HttpFunctions.php
@@ -252,7 +252,7 @@
$this->parsedUrl = wfParseUrl( $this->url );
 
if ( !$this->parsedUrl || !Http::isValidURI( $this->url ) ) {
-   $this->status = Status::newFatal( 'http-invalid-url' );
+   $this->status = Status::newFatal( 'http-invalid-url', 
$url );
} else {
$this->status = Status::newGood( 100 ); // continue
}
diff --git a/includes/upload/UploadFromUrl.php 
b/includes/upload/UploadFromUrl.php
index 4c099b3..f578745 100644
--- a/includes/upload/UploadFromUrl.php
+++ b/includes/upload/UploadFromUrl.php
@@ -195,7 +195,7 @@
 */
public function fetchFile( $httpOptions = array() ) {
if ( !Http::isValidURI( $this->mUrl ) ) {
-   return Status::newFatal( 'http-invalid-url' );
+   return Status::newFatal( 'http-invalid-url', 
$this->mUrl );
}
 
if ( !self::isAllowedHost( $this->mUrl ) ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/226725
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If1d10270f4d446c4d1703457903034e8356c1503
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Do not encode '~' as %7E. Fixes redirect loop in chrome. - change (mediawiki/core)

2015-07-08 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/223727

Change subject: Do not encode '~' as %7E. Fixes redirect loop in chrome.
..

Do not encode '~' as %7E. Fixes redirect loop in chrome.

As of 155d555b83eca640, we now redirect variations on hex escapes
into their canonical form. This was causing '~' to be redirected
to %7E. However google chrome seems to canonicalize %7E back
into ~, causing a redirect loop.

RFC 3986 says ~ is unreserved, so not hex encoding it should be
fine. To quote: "For consistency, percent-encoded octets in the
ranges of...tilde (%7E) should not be created by URI producers"

Bug: T105265
Change-Id: I01556eee496e2fb540de8ff09c082c1fedddb5f7
Follow-up: 155d555b83eca640
---
M includes/GlobalFunctions.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/27/223727/1

diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 97042fd..e5694fc 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -426,7 +426,7 @@
}
 
if ( is_null( $needle ) ) {
-   $needle = array( '%3B', '%40', '%24', '%21', '%2A', '%28', 
'%29', '%2C', '%2F' );
+   $needle = array( '%3B', '%40', '%24', '%21', '%2A', '%28', 
'%29', '%2C', '%2F', '%7E' );
if ( !isset( $_SERVER['SERVER_SOFTWARE'] ) ||
( strpos( $_SERVER['SERVER_SOFTWARE'], 
'Microsoft-IIS/7' ) === false )
) {
@@ -437,7 +437,7 @@
$s = urlencode( $s );
$s = str_ireplace(
$needle,
-   array( ';', '@', '$', '!', '*', '(', ')', ',', '/', ':' ),
+   array( ';', '@', '$', '!', '*', '(', ')', ',', '/', '~', ':' ),
$s
);
 

-- 
To view, visit https://gerrit.wikimedia.org/r/223727
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I01556eee496e2fb540de8ff09c082c1fedddb5f7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix fatal when non-ascii message key is normalized - change (mediawiki/core)

2015-07-19 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/225678

Change subject: Fix fatal when non-ascii message key is normalized
..

Fix fatal when non-ascii message key is normalized

Missing global decleration when using $wgContLang in
MessageCache::normalizeKey

Change-Id: Ia1c1f41244fd5629527b99a5f2038f607cff42c4
Follow-up: 47e0f0c3
---
M includes/cache/MessageCache.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/78/225678/1

diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php
index f63e0fb..67a7461 100644
--- a/includes/cache/MessageCache.php
+++ b/includes/cache/MessageCache.php
@@ -137,6 +137,7 @@
 * @return string Normalized message key
 */
public static function normalizeKey( $key ) {
+   global $wgContLang;
$lckey = strtr( $key, ' ', '_' );
if ( ord( $lckey ) < 128 ) {
$lckey[0] = strtolower( $lckey[0] );

-- 
To view, visit https://gerrit.wikimedia.org/r/225678
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia1c1f41244fd5629527b99a5f2038f607cff42c4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add tests for 47e0f0c3 (MessageCache::normalizeKey()) - change (mediawiki/core)

2015-07-19 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/225679

Change subject: Add tests for 47e0f0c3 (MessageCache::normalizeKey())
..

Add tests for 47e0f0c3 (MessageCache::normalizeKey())

Change-Id: If8c88383ccfcfcf08d3d85e5648eb338f0d14268
---
M tests/phpunit/includes/cache/MessageCacheTest.php
1 file changed, 20 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/79/225679/1

diff --git a/tests/phpunit/includes/cache/MessageCacheTest.php 
b/tests/phpunit/includes/cache/MessageCacheTest.php
index 9c59e65..5386e48 100644
--- a/tests/phpunit/includes/cache/MessageCacheTest.php
+++ b/tests/phpunit/includes/cache/MessageCacheTest.php
@@ -124,4 +124,24 @@
);
}
 
+   /**
+* @dataProvider provideNormalizeKey
+*/
+   public function testNormalizeKey( $key, $expected ) {
+   $actual = MessageCache::normalizeKey( $key );
+   $this->assertEquals( $expected, $actual );
+   }
+
+   public function provideNormalizeKey() {
+   return array(
+   array( 'Foo', 'foo' ),
+   array( 'foo', 'foo' ),
+   array( 'fOo', 'fOo' ),
+   array( 'FOO', 'fOO' ),
+   array( 'Ćab', 'ćab' ),
+   array( 'ĆAB', 'ćAB' ),
+   array( 'ćab', 'ćab' ),
+   array( 'ćaB', 'ćaB' ),
+   );
+   }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/225679
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If8c88383ccfcfcf08d3d85e5648eb338f0d14268
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Show different message if image thumb in different format th... - change (mediawiki/core)

2015-07-19 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/225682

Change subject: Show different message if image thumb in different format than 
img
..

Show different message if image thumb in different format than img

Users on commons feel that the other resolution links on the image
page can be confusing to users if they are in a different format
than the original image. Use a different message in that case
to clarify the situation.

See discussion at https://commons.wikimedia.org/?oldid=165672017

Change-Id: I76d7155e1c1e48a9824819135943d2385a0ee41a
---
M includes/page/ImagePage.php
M languages/i18n/en.json
M languages/i18n/qqq.json
3 files changed, 25 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/82/225682/1

diff --git a/includes/page/ImagePage.php b/includes/page/ImagePage.php
index 7ea4ed7..108ec3f 100644
--- a/includes/page/ImagePage.php
+++ b/includes/page/ImagePage.php
@@ -378,9 +378,29 @@
$msgsmall = '';
$sizeLinkBigImagePreview = 
$this->makeSizeLink( $params, $width, $height );
if ( $sizeLinkBigImagePreview ) {
-   $msgsmall .= 
$this->getContext()->msg( 'show-big-image-preview' )->
-   rawParams( 
$sizeLinkBigImagePreview )->
-   parse();
+   // Show a different message of 
preview is different format from original.
+   $previewTypeDiffers = false;
+   $origExt = $thumbExt = 
$this->displayImg->getExtension();
+   if ( 
$this->displayImg->getHandler() ) {
+   $origMime = 
$this->displayImg->getMimeType();
+   $typeParams = $params;
+   
$this->displayImg->getHandler()->normaliseParams( $this->displayImg, 
$typeParams );
+   list( $thumbExt, 
$thumbMime ) = $this->displayImg->getHandler()->getThumbType( $origExt, 
$origMime, $typeParams );
+   if ( $thumbMime !== 
$origMime ) {
+   
$previewTypeDiffers = true;
+   }
+   }
+   if ( $previewTypeDiffers ) {
+   $msgsmall .= 
$this->getContext()->msg( 'show-big-image-preview-differ' )->
+   rawParams( 
$sizeLinkBigImagePreview )->
+   params( 
strtoupper( $origExt ) )->
+   params( 
strtoupper( $thumbExt ) )->
+   parse();
+   } else {
+   $msgsmall .= 
$this->getContext()->msg( 'show-big-image-preview' )->
+   rawParams( 
$sizeLinkBigImagePreview )->
+   parse();
+   }
}
if ( count( $otherSizes ) ) {
$msgsmall .= ' ' .
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 00bd980..bd6e5cd 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -2666,6 +2666,7 @@
"svg-long-error": "Invalid SVG file: $1",
"show-big-image": "Original file",
"show-big-image-preview": "Size of this preview: $1.",
+   "show-big-image-preview-differ": "Size of this $3 preview of this $2 
file: $1.",
"show-big-image-other": "Other {{PLURAL:$2|resolution|resolutions}}: 
$1.",
"show-big-image-size": "$1 × $2 pixels",
"file-info-gif-looped": "looped",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index cc9dcc6..d80a021 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -2837,6 +2837,7 @@
"svg-long-error": "Displayed for invalid SVG file metadata. 
Parameters:\n* $1 - the error message\nSee also:\n* {{msg-mw|Thumbnail error}}",
"show-big-image": "Displayed under the file on file description pages, 
when a reduced-size thumbnail of the origina

[MediaWiki-commits] [Gerrit] Increase $wgSVGMaxSize to 5120 pixels wide (previously 2048). - change (mediawiki/core)

2015-07-19 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/225683

Change subject: Increase $wgSVGMaxSize to 5120 pixels wide (previously 2048).
..

Increase $wgSVGMaxSize to 5120 pixels wide (previously 2048).

People use mediawiki for all sorts of things, restricting to
2048px wide seems much to strict as the default setting (imo).

It should be noted, MediaWiki, can, in the default config
(but with some non-default user prefs), include images of
up to size 2560 px on the image description page, so the max
svg size should at least be that big.

Change-Id: I306a792e61e7c738982b9dbde8a63aa31acf38a8
Note: this doesn't affect WMF, as they have it overridden to 4096
---
M includes/DefaultSettings.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/83/225683/1

diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index baefef9..22e9e30 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -1021,7 +1021,7 @@
 /**
  * Don't scale a SVG larger than this
  */
-$wgSVGMaxSize = 2048;
+$wgSVGMaxSize = 5120;
 
 /**
  * Don't read SVG metadata beyond this point.

-- 
To view, visit https://gerrit.wikimedia.org/r/225683
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I306a792e61e7c738982b9dbde8a63aa31acf38a8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Do not suggest alternate svg sizes bigger than $wgMaxSVGSize... - change (mediawiki/core)

2015-07-19 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/225688

Change subject: Do not suggest alternate svg sizes bigger than $wgMaxSVGSize on 
img pg
..

Do not suggest alternate svg sizes bigger than $wgMaxSVGSize on img pg

Suggesting a size bigger than the max svg size, will simply result
in a smaller rendering than the user has been lead to believe they
would recieve.

Additionally fix wrong argument order to $this->getThumbSizes
which was causing the nominal size for an SVG to not be suggested
as an alternate size on the image page.

See some of the comments T106263 (However, that bug is not about
this issue).

Change-Id: Ia63ddd6e89725f8e7979687310c3b6819da0cbbc
---
M includes/page/ImagePage.php
1 file changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/88/225688/1

diff --git a/includes/page/ImagePage.php b/includes/page/ImagePage.php
index 7ea4ed7..c279837 100644
--- a/includes/page/ImagePage.php
+++ b/includes/page/ImagePage.php
@@ -296,7 +296,7 @@
}
 
protected function openShowImage() {
-   global $wgEnableUploads, $wgSend404Code;
+   global $wgEnableUploads, $wgSend404Code, $wgSVGMaxSize;
 
$this->loadFile();
$out = $this->getContext()->getOutput();
@@ -351,7 +351,7 @@
);
$linktext = $this->getContext()->msg( 
'show-big-image' )->escaped();
 
-   $thumbSizes = $this->getThumbSizes( 
$width, $height, $width_orig, $height_orig );
+   $thumbSizes = $this->getThumbSizes( 
$width_orig, $height_orig );
# Generate thumbnails or thumbnail 
links as needed...
$otherSizes = array();
foreach ( $thumbSizes as $size ) {
@@ -361,10 +361,12 @@
// the current thumbnail's size 
($width/$height)
// since that is added to the 
message separately, so
// it can be denoted as the 
current size being shown.
-   // Vectorized images are 
"infinitely" big, so all thumb
-   // sizes are shown.
+   // Vectorized images are 
limited by $wgSVGMaxSize big,
+   // so all thumbs less than that 
are shown.
if ( ( ( $size[0] <= 
$width_orig && $size[1] <= $height_orig )
-   || 
$this->displayImg->isVectorized() )
+   || ( 
$this->displayImg->isVectorized()
+   && max( 
$size[0], $size[1] ) < $wgSVGMaxSize )
+   )
&& $size[0] != $width 
&& $size[1] != $height
) {
$sizeLink = 
$this->makeSizeLink( $params, $size[0], $size[1] );

-- 
To view, visit https://gerrit.wikimedia.org/r/225688
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia63ddd6e89725f8e7979687310c3b6819da0cbbc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Use system default location for cafile when using php fopen. - change (mediawiki/core)

2015-07-01 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/222079

Change subject: Use system default location for cafile when using php fopen.
..

Use system default location for cafile when using php fopen.

If not set, php appears to just use no CA's, and just explode.

Still won't work on windows.

Only possible downside is if some future of PHP actually makes
fopen ssl wrapper sane, and this overrides a sane default behaviour.

Bug: T75203
Change-Id: I07736c150fe0783e09d297395ed25adf335edbd3
---
M includes/HttpFunctions.php
1 file changed, 23 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/79/222079/1

diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php
index 825cd06..240fa14 100644
--- a/includes/HttpFunctions.php
+++ b/includes/HttpFunctions.php
@@ -915,12 +915,29 @@
$options['ssl']['CN_match'] = $this->parsedUrl['host'];
}
 
-   if ( is_dir( $this->caInfo ) ) {
-   $options['ssl']['capath'] = $this->caInfo;
-   } elseif ( is_file( $this->caInfo ) ) {
-   $options['ssl']['cafile'] = $this->caInfo;
-   } elseif ( $this->caInfo ) {
-   throw new MWException( "Invalid CA info passed: 
{$this->caInfo}" );
+   if ( $this->caInfo ) {
+   $certLocations = array( $this->caInfo );
+   } else {
+   // Default locations, based on
+   // 
https://www.happyassassin.net/2015/01/12/a-note-about-ssltls-trusted-certificate-stores-and-platforms/
+   // PHP doesn't seem to have sane defaults, so we set 
ourselves.
+   $certLocations = array(
+   '/etc/pki/tls/certs/ca-bundle.crt', # Fedora et 
al
+   '/etc/ssl/certs',  # Debian et al
+   '/etc/pki/tls/certs/ca-bundle.trust.crt',
+   
'/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem',
+   '/System/Library/OpenSSL', # OSX
+   );
+   }
+
+   foreach( $certLocations as $cert ) {
+   if ( is_dir( $cert ) ) {
+   $options['ssl']['capath'] = $cert;
+   break;
+   } elseif ( is_file( $cert ) ) {
+   $options['ssl']['cafile'] = $cert;
+   break;
+   }
}
 
$context = stream_context_create( $options );

-- 
To view, visit https://gerrit.wikimedia.org/r/222079
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I07736c150fe0783e09d297395ed25adf335edbd3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Workaround fopen lack of SubjectAltName support for instantC... - change (mediawiki/core)

2015-07-01 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/222086

Change subject: Workaround fopen lack of SubjectAltName support for 
instantCommons
..

Workaround fopen lack of SubjectAltName support for instantCommons

Hacky work around, where on php < 5.6.0 where SubjectAltName is not
supported, if a request to commons.wikimedia.org fails, retry the
request but telling php fopen wrapper to treat it as if it came
from en.wikipedia.org for validation purposes, since as of
c02fab71422a that's what the common name of the cert will be.

In the ideal world, everyone would just have curl installed.

I know this is super hacky, but I'd really like instant commons to
work out of the box even without curl installed.

Note: I'm basing the php 5.6 part on documentation, I have not tested
this with a copy of that version of php.

Bug: T75199
Change-Id: Ibde59be61a5b3d7cd5397ba352dce9be11e1b06f
---
M includes/HttpFunctions.php
1 file changed, 20 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/86/222086/1

diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php
index 825cd06..2029092 100644
--- a/includes/HttpFunctions.php
+++ b/includes/HttpFunctions.php
@@ -912,7 +912,13 @@
}
 
if ( $this->sslVerifyHost ) {
-   $options['ssl']['CN_match'] = $this->parsedUrl['host'];
+   // PHP 5.6.0 deprecates CN_match, in favour of 
peer_name which
+   // actually checks SubjectAltName properly.
+   if ( version_compare( PHP_VERSION, '5.6.0', '>=' ) ) {
+   $options['ssl']['peer_name'] = 
$this->parsedUrl['host'];
+   } else {
+   $options['ssl']['CN_match'] = 
$this->parsedUrl['host'];
+   }
}
 
if ( is_dir( $this->caInfo ) ) {
@@ -943,6 +949,19 @@
MediaWiki\restoreWarnings();
 
if ( !$fh ) {
+   // HACK for instant commons.
+   // If we are contacting 
(commons|upload).wikimedia.org
+   // try again with CN_match for en.wikipedia.org
+   // as php does not handle SubjectAltName 
properly
+   // prior to "peer_name" option in php 5.6
+   if ( isset( $options['ssl']['CN_match'] )
+   && ( $options['ssl']['CN_match'] === 
'commons.wikimedia.org'
+   || $options['ssl']['CN_match'] 
=== 'upload.wikimedia.org' )
+   ) {
+   $options['ssl']['CN_match'] = 
'en.wikipedia.org';
+   $context = stream_context_create( 
$options );
+   continue;
+   }
break;
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/222086
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibde59be61a5b3d7cd5397ba352dce9be11e1b06f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] When using fopen on https streams, disable weak ciphers and ... - change (mediawiki/core)

2015-07-01 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/222088

Change subject: When using fopen on https streams, disable weak ciphers and 
compression
..

When using fopen on https streams, disable weak ciphers and compression

Per recomendation of
http://www.docnet.nu/tech-portal/2014/06/26/ssl-and-php-streams-part-1-you-are-doing-it-wrongtm/C0

Change-Id: I69d063ff4aa4248dd4f3d03de5a168c4b5a99c50
---
M includes/HttpFunctions.php
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/88/222088/1

diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php
index 825cd06..c47b5e6 100644
--- a/includes/HttpFunctions.php
+++ b/includes/HttpFunctions.php
@@ -899,6 +899,8 @@
'ssl' => array(
'verify_peer' => $this->sslVerifyCert,
'SNI_enabled' => true,
+   'ciphers' => 'HIGH:!SSLv2:!SSLv3',
+   'disable_compression' => true,
),
);
 

-- 
To view, visit https://gerrit.wikimedia.org/r/222088
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I69d063ff4aa4248dd4f3d03de5a168c4b5a99c50
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Log http error in ForeignAPIRepo::httpGet - change (mediawiki/core)

2015-07-02 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/222511

Change subject: Log http error in ForeignAPIRepo::httpGet
..

Log http error in ForeignAPIRepo::httpGet

This makes at least the "SSL certificate problem: unable to get local
issuer certificate" visible.

Change-Id: Icf0658b5e9f7ac9c58f98291345442f8e405435f
(cherry picked from commit d2d692e17b8fa64f3d15b7ddf23173954317d31b)
---
M includes/filerepo/ForeignAPIRepo.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/11/222511/1

diff --git a/includes/filerepo/ForeignAPIRepo.php 
b/includes/filerepo/ForeignAPIRepo.php
index 7ead968..3c03192 100644
--- a/includes/filerepo/ForeignAPIRepo.php
+++ b/includes/filerepo/ForeignAPIRepo.php
@@ -521,6 +521,7 @@
if ( $status->isOK() ) {
return $req->getContent();
} else {
+   wfDebug( "ForeignAPIRepo: ERROR on GET: " . 
$status->getWikiText() );
return false;
}
}

-- 
To view, visit https://gerrit.wikimedia.org/r/222511
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf0658b5e9f7ac9c58f98291345442f8e405435f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_25
Gerrit-Owner: Brian Wolff 
Gerrit-Reviewer: Umherirrender 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Log http error in ForeignAPIRepo::httpGet - change (mediawiki/core)

2015-07-02 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/222512

Change subject: Log http error in ForeignAPIRepo::httpGet
..

Log http error in ForeignAPIRepo::httpGet

This makes at least the "SSL certificate problem: unable to get local
issuer certificate" visible.

Change-Id: Icf0658b5e9f7ac9c58f98291345442f8e405435f
(cherry picked from commit d2d692e17b8fa64f3d15b7ddf23173954317d31b)
---
M includes/filerepo/ForeignAPIRepo.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/12/222512/1

diff --git a/includes/filerepo/ForeignAPIRepo.php 
b/includes/filerepo/ForeignAPIRepo.php
index 6924f0a..3e36a8f 100644
--- a/includes/filerepo/ForeignAPIRepo.php
+++ b/includes/filerepo/ForeignAPIRepo.php
@@ -521,6 +521,7 @@
if ( $status->isOK() ) {
return $req->getContent();
} else {
+   wfDebug( "ForeignAPIRepo: ERROR on GET: " . 
$status->getWikiText() );
return false;
}
}

-- 
To view, visit https://gerrit.wikimedia.org/r/222512
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf0658b5e9f7ac9c58f98291345442f8e405435f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_24
Gerrit-Owner: Brian Wolff 
Gerrit-Reviewer: Umherirrender 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Log http error in ForeignAPIRepo::httpGet - change (mediawiki/core)

2015-07-02 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/222513

Change subject: Log http error in ForeignAPIRepo::httpGet
..

Log http error in ForeignAPIRepo::httpGet

This makes at least the "SSL certificate problem: unable to get local
issuer certificate" visible.

Change-Id: Icf0658b5e9f7ac9c58f98291345442f8e405435f
(cherry picked from commit d2d692e17b8fa64f3d15b7ddf23173954317d31b)
---
M includes/filerepo/ForeignAPIRepo.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/13/222513/1

diff --git a/includes/filerepo/ForeignAPIRepo.php 
b/includes/filerepo/ForeignAPIRepo.php
index 35ac60f..695f706 100644
--- a/includes/filerepo/ForeignAPIRepo.php
+++ b/includes/filerepo/ForeignAPIRepo.php
@@ -521,6 +521,7 @@
if ( $status->isOK() ) {
return $req->getContent();
} else {
+   wfDebug( "ForeignAPIRepo: ERROR on GET: " . 
$status->getWikiText() );
return false;
}
}

-- 
To view, visit https://gerrit.wikimedia.org/r/222513
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf0658b5e9f7ac9c58f98291345442f8e405435f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_23
Gerrit-Owner: Brian Wolff 
Gerrit-Reviewer: Umherirrender 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix error reporting for ffmpeg2theora if don't recognize codec - change (mediawiki...TimedMediaHandler)

2014-01-16 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/108000


Change subject: Fix error reporting for ffmpeg2theora if don't recognize codec
..

Fix error reporting for ffmpeg2theora if don't recognize codec

Ffmpeg2theora still gives a return code of 0 even if transcoding
failed due to not recognizing the codec (e.g. VP9). Make it also
check that a non-zero byte file exists so that the error message
is reported properly

Previously the error message was reported as '1' (true cast to
string), as noted on bug 53863.

Change-Id: Id681b481c1a86d1d63528cf63c2a7dc5e430129b
---
M WebVideoTranscode/WebVideoTranscodeJob.php
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/00/108000/1

diff --git a/WebVideoTranscode/WebVideoTranscodeJob.php 
b/WebVideoTranscode/WebVideoTranscodeJob.php
index 49251c0..e8093e5 100644
--- a/WebVideoTranscode/WebVideoTranscodeJob.php
+++ b/WebVideoTranscode/WebVideoTranscodeJob.php
@@ -597,7 +597,8 @@
}
 
// Add the output target:
-   $cmd.= ' -o ' . wfEscapeShellArg ( $this->getTargetEncodePath() 
);
+   $outputFile = $this->getTargetEncodePath();
+   $cmd.= ' -o ' . wfEscapeShellArg ( $outputFile );
 
$this->output( "Running cmd: \n\n" .$cmd . "\n" );
 
@@ -605,7 +606,9 @@
$retval = 0;
$shellOutput = $this->runShellExec( $cmd, $retval );
wfProfileOut( 'ffmpeg2theora_encode' );
-   if( $retval != 0 ){
+
+   // ffmpeg2theora returns 0 status on some errors, so also check 
for file
+   if( $retval != 0 || !is_file( $outputFile ) || filesize( 
$outputFile ) === 0 ){
return $cmd .
"\n\nExitcode: $retval\nMemory: 
$wgTranscodeBackgroundMemoryLimit\n\n" .
$shellOutput;

-- 
To view, visit https://gerrit.wikimedia.org/r/108000
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id681b481c1a86d1d63528cf63c2a7dc5e430129b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix transcodes on files with long non-ascii names - change (mediawiki...TimedMediaHandler)

2014-01-17 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/108170


Change subject: Fix transcodes on files with long non-ascii names
..

Fix transcodes on files with long non-ascii names

Swift doesn't like it if the urlencoded version of the path
is > 1024 bytes, which includes files with names longer than
170 bytes that are non-ascii (Since each byte gets tripled to
percent encode, and the filename is repeated twice).

In these cases shorten the transcode name, much like how we
shorten thumbnail names for files with long names. Only do this
for files which would currently be broken, so we don't have to
worry about migrating existing transcodes.

Also remove backwards compatability in extension for versions
of MediaWiki not having File::getTranscodedUrl method.

Change-Id: I826af75ede734025352244608640a8b71929109a
---
M TranscodeStatusTable.php
M WebVideoTranscode/WebVideoTranscode.php
M WebVideoTranscode/WebVideoTranscodeJob.php
3 files changed, 37 insertions(+), 20 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/70/108170/1

diff --git a/TranscodeStatusTable.php b/TranscodeStatusTable.php
index 83ca01c..8fc5ad6 100644
--- a/TranscodeStatusTable.php
+++ b/TranscodeStatusTable.php
@@ -88,14 +88,7 @@
 * @return string
 */
public static function getSourceUrl( $file, $transcodeKey ){
-   $thumbName = $file->thumbName( array() );
-   if ( method_exists( $file, 'getTranscodedUrl' ) ) {
-   $thumbUrl = $file->getTranscodedUrl( $thumbName );
-   } else {
-   $thumbUrl = $file->getThumbUrl( $thumbName );
-   }
-   $thumbUrlDir = dirname( $thumbUrl );
-   return $thumbUrlDir . '/' . rawurlencode( $file->getName() ) . 
'.' . $transcodeKey;
+   return WebVideoTranscode::getTranscodedUrlForFile( $file, 
$transcodeKey );
}
 
/**
diff --git a/WebVideoTranscode/WebVideoTranscode.php 
b/WebVideoTranscode/WebVideoTranscode.php
index a1a6d86..e72fe36 100644
--- a/WebVideoTranscode/WebVideoTranscode.php
+++ b/WebVideoTranscode/WebVideoTranscode.php
@@ -254,12 +254,40 @@
 * @param $transcodeKey string
 * @return string
 */
-   static public function getDerivativeFilePath( &$file, $transcodeKey){
-   if ( method_exists( $file, 'getTranscodedPath' ) ) {
-   return $file->getTranscodedPath( $file->getName() . '.' 
. $transcodeKey );
+   static public function getDerivativeFilePath( $file, $transcodeKey ) {
+   return $file->getTranscodedPath( 
self::getTranscodeFileBaseName( $file, $transcodeKey ) );
+   }
+
+   /**
+* Get the name to use as the base name for the transcode.
+*
+* Swift has problems where the url-encoded version of
+* the path (ie 'filename.ogv/filename.ogv.720p.webm' )
+* is greater that > 1024 bytes, so shorten in that case.
+*
+* Future versions might respect FileBackend->abbrvThreshold.
+*
+* @param File $file
+* @param String $suffix Optional suffix (e.g. transcode key).
+* @return String File name, or the string transcode.
+*/
+   static public function getTranscodeFileBaseName( $file, $suffix = '' ) {
+   $name = $file->getName();
+   if ( strlen( urlencode( $name ) ) * 2 + 12 > 1024 ) {
+   return 'transcode' . '.' . $suffix;
} else {
-   return $file->getThumbPath( $file->getName() . '.' . 
$transcodeKey );
+   return $name . '.' . $suffix;
}
+   }
+
+   /**
+* Get url for a transcode.
+*
+* @param $file
+* @param $suffix Transcode key
+*/
+   static public function getTranscodedUrlForFile( $file, $suffix = '' ) {
+   return $file->getTranscodedUrl( self::getTranscodeFileBaseName( 
$file, $suffix ) );
}
 
/**
@@ -619,7 +647,7 @@
// Remove files by key:
$urlsToPurge = array();
foreach ( $removeKeys as $tKey ) {
-   $urlsToPurge[] = $file->getTranscodedUrl( 
$file->getName() . '.' . $tKey );
+   $urlsToPurge[] = self::getTranscodedUrlForFile( $file, 
$tKey );
$filePath = self::getDerivativeFilePath( $file, $tKey );
if( $file->repo->fileExists( $filePath ) ){
wfSuppressWarnings();
@@ -753,12 +781,7 @@
 
$fileName = $file->getTitle()->getDbKey();
 
-   $thumbName = $file->thumbName( array() );
-   if ( MWInit::methodExists( $file, 'getTranscodedUrl' ) ) {
-   $src = $file->getTranscodedUrl( $fi

[MediaWiki-commits] [Gerrit] Fix js bug where error report was always for first link. - change (mediawiki...TimedMediaHandler)

2014-01-17 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/108172


Change subject: Fix js bug where error report was always for first link.
..

Fix js bug where error report was always for first link.

If you clicked on show error on the transcode table, the
javascript always showed the first error, even if you clicked
on the second error link. The title was also all the error
titles concated instead of just the appropriate title.

Change-Id: I4ba07a4184de56a8991422c0d1ebbb59a309492b
---
M resources/ext.tmh.transcodetable.js
1 file changed, 7 insertions(+), 6 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/72/108172/1

diff --git a/resources/ext.tmh.transcodetable.js 
b/resources/ext.tmh.transcodetable.js
index 4bfebdd..5b1e443 100644
--- a/resources/ext.tmh.transcodetable.js
+++ b/resources/ext.tmh.transcodetable.js
@@ -25,13 +25,14 @@
$( '.mw-filepage-transcodestatus .errorlink' ).click( errorPopup );
// New version.
$errorLink = $( '.mw-filepage-transcodestatus 
.mw-tmh-pseudo-error-link' );
-   $errorLink.wrapInner(
-   $( '' ).attr( {
+   $errorLink.wrapInner( function() {
+   var $this = $(this);
+   return $( '' ).attr( {
href: '#',
-   title: $errorLink.text(),
-   'data-error': $errorLink.attr('data-error')
-   } ).click( errorPopup )
-   );
+   title: $this.text(),
+   'data-error': $this.attr('data-error')
+   } ).click( errorPopup );
+   } );
 
// Reset transcode action:
$('.mw-filepage-transcodereset a').click( function(){

-- 
To view, visit https://gerrit.wikimedia.org/r/108172
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4ba07a4184de56a8991422c0d1ebbb59a309492b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Output ogg metadata on image description page. - change (mediawiki...TimedMediaHandler)

2014-01-18 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/108203


Change subject: Output ogg metadata on image description page.
..

Output ogg metadata on image description page.

As an aside, this was one of the primary goals of my 2010
gsoc project. I'm only 4 years late.

This just does basic support (throws all the metadata of each
type together), nothing fancy like separating out metadata by
different streams is attempted.

Change-Id: I2adacf4199a4da559f8225fd9f37cbcc3eac21ce
---
M handlers/OggHandler/OggHandler.php
1 file changed, 87 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/03/108203/1

diff --git a/handlers/OggHandler/OggHandler.php 
b/handlers/OggHandler/OggHandler.php
index a225483..c90e8c2 100644
--- a/handlers/OggHandler/OggHandler.php
+++ b/handlers/OggHandler/OggHandler.php
@@ -49,6 +49,93 @@
}
 
/**
+* Display metadata box on file description page.
+*
+* This is pretty basic, it puts data from all the streams together,
+* and only outputs a couple of the most commonly used ogg "comments",
+* with comments from all the streams combined
+*
+* @param File $file
+* @return array|bool
+*/
+   public function formatMetadata( $file ) {
+   $meta = $this->getCommonMetaArray( $file );
+   if ( count( $meta ) === 0 ) {
+   return false;
+   }
+   return $this->formatMetadataHelper( $meta );
+   }
+
+   /**
+* Get some basic metadata properties that are common across file types.
+*
+* @param File $file
+* @return array Array of metadata. See MW's FormatMetadata class for 
format.
+*/
+   public function getCommonMetaArray( $file ) {
+   $metadata = $this->unpackMetadata( $file->getMetadata() );
+   if ( !$metadata || isset( $metadata['error'] ) || !isset( 
$metadata['streams'] ) ) {
+   return false;
+   }
+   wfProfileIn( __METHOD__ );
+
+   // See http://www.xiph.org/vorbis/doc/v-comment.html
+   // http://age.hobba.nl/audio/mirroredpages/ogg-tagging.html
+   $metadataMap = array(
+   'title' => 'ObjectName',
+   'artist' => 'Artist',
+   'performer' => 'Artist',
+   'description' => 'ImageDescription',
+   'license' => 'UsageTerms',
+   'copyright' => 'Copyright',
+   'organization' => 'dc-publisher',
+   'date' => 'DateTimeDigitized',
+   'location' => 'LocationDest',
+   'contact' => 'Contact',
+   'encoded_using' => 'Software',
+   'encoder' => 'Software',
+   // OpenSubtitles.org hash. Identifies source video.
+   'source_ohash' => 'OriginalDocumentID',
+   'comment' => 'UserComment',
+   'language' => 'LanguageCode',
+   );
+
+   $props = array();
+
+   foreach( $metadata['streams'] as $stream ) {
+   if ( isset( $stream['vendor'] ) ) {
+   if ( !isset( $props['Software'] ) ) {
+   $props['Software'] = array();
+   }
+   $props['Software'][] = trim( $stream['vendor'] 
);
+   }
+   if ( !isset( $stream['comments'] ) ) {
+   continue;
+   }
+   foreach( $stream['comments'] as $name => $value ) {
+   if ( trim( $value ) === '' ) {
+   continue;
+   }
+   if ( isset( $metadataMap[strtolower( $name )] ) 
) {
+   $convertedName = 
$metadataMap[strtolower( $name )];
+   if ( !isset( $props[$convertedName] ) ) 
{
+   $props[$convertedName] = 
array();
+   }
+   $props[$convertedName][] = trim( $value 
);
+   }
+   }
+
+   }
+   // properties might be duplicated across streams
+   foreach( $props as &$type ) {
+   $type = array_unique( $type );
+   $type = array_values( $type );
+   }
+   wfProfileOut( __METHOD__ );
+   return $props;
+   }
+
+   /**
   

[MediaWiki-commits] [Gerrit] Make sure jquery.ui.dialog is loaded if there are pop up videos - change (mediawiki...TimedMediaHandler)

2014-01-19 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/108472


Change subject: Make sure jquery.ui.dialog is loaded if there are pop up videos
..

Make sure jquery.ui.dialog is loaded if there are pop up videos

Follow up d20058ed77. If jquery.ui.dialog isn't loaded at
the beginning, then when someone clicks on a pop up video, the
pop up dialog has the wrong dimensions. This issue has not
appeared on Wikimedia, as other scripts are loading jquery.ui.dialog.

Not entirely sure if I took the right approach for loading it, but
this seemed like the most straightforward way to do it and have it
only on pages where needed.

Change-Id: Ia903cded423a8505528425e15abb1c87513f1c49
---
M resources/mw.PopUpThumbVideo.js
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/72/108472/1

diff --git a/resources/mw.PopUpThumbVideo.js b/resources/mw.PopUpThumbVideo.js
index 8d9a802..944c9a1 100644
--- a/resources/mw.PopUpThumbVideo.js
+++ b/resources/mw.PopUpThumbVideo.js
@@ -3,7 +3,13 @@
 */
 ( function( mw, $ ) {
$(document).ready(function(){
-   $('.PopUpMediaTransform a').each( function(){
+   var $popUp = $('.PopUpMediaTransform a');
+   if ( $popUp.length ) {
+   // If there is actually a pop-up media on this page, 
need to
+   // make sure jquery.dialog is loaded, or pop-up has 
wrong dimensions
+   mw.loader.load( 'jquery.ui.dialog', 'text/javascript', 
true );
+   }
+   $popUp.each( function(){
var parent = $(this).parent();
if ( parent.attr( 'videopayload' ) ) {
$( this ).click( function( event ){

-- 
To view, visit https://gerrit.wikimedia.org/r/108472
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia903cded423a8505528425e15abb1c87513f1c49
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Follow-up 08091667f4c7, avoid flash of unstyled content - change (mediawiki...TimedMediaHandler)

2014-01-19 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/108473


Change subject: Follow-up 08091667f4c7, avoid flash of unstyled content
..

Follow-up 08091667f4c7, avoid flash of unstyled content

Change-Id: I6273eb461fcf8897a77b685c36db825328bcac93
---
M TimedMediaHandler.hooks.php
M TimedMediaHandler_body.php
2 files changed, 4 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/73/108473/1

diff --git a/TimedMediaHandler.hooks.php b/TimedMediaHandler.hooks.php
index 2fac670..d642324 100644
--- a/TimedMediaHandler.hooks.php
+++ b/TimedMediaHandler.hooks.php
@@ -347,7 +347,8 @@
 * @return bool
 */
static function pageOutputHook(  &$out, &$sk ){
-   $out->addModules( 'mw.PopUpMediaTransform' );
+   $out->addModuleScripts( 'mw.PopUpMediaTransform' );
+   $out->addModuleStyles( 'mw.PopUpMediaTransform' );
return true;
}
 
diff --git a/TimedMediaHandler_body.php b/TimedMediaHandler_body.php
index e203ff9..4919b96 100644
--- a/TimedMediaHandler_body.php
+++ b/TimedMediaHandler_body.php
@@ -195,7 +195,8 @@
 */
static function outputHook( $outputPage, $parserOutput, $data ) {
// Add the PopUpMediaTransform code
-   $outputPage->addModules( 'mw.PopUpMediaTransform' );
+   $outputPage->addModuleScripts( 'mw.PopUpMediaTransform' );
+   $outputPage->addModuleStyles( 'mw.PopUpMediaTransform' );
$outputPage->addModules( 'mw.TMHGalleryHook.js' );
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/108473
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6273eb461fcf8897a77b685c36db825328bcac93
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Let TMH detect webm files using opus and VP9 codecs - change (mediawiki...TimedMediaHandler)

2014-01-19 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/108482


Change subject: Let TMH detect webm files using opus and VP9 codecs
..

Let TMH detect webm files using opus and VP9 codecs

From what I understand VP9/Opus is the future of webm. This
patch will make sure such files are properly identified
in their long descriptions. It should also prevent TMH from
trying to play a VP9 file in a browser only supporting webm.

Bug: 60245
Change-Id: Icd368504d986821d4650347694c5b6705ceabe5d
---
M handlers/WebMHandler/WebMHandler.php
1 file changed, 19 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/82/108482/1

diff --git a/handlers/WebMHandler/WebMHandler.php 
b/handlers/WebMHandler/WebMHandler.php
index 356755c..fae4812 100644
--- a/handlers/WebMHandler/WebMHandler.php
+++ b/handlers/WebMHandler/WebMHandler.php
@@ -89,7 +89,14 @@
 * @return String
 */
function getWebType( $file ) {
-   return 'video/webm; codecs="vp8, vorbis"';
+   $streams = $this->getStreamTypes( $file );
+   if ( count( $streams ) === 0 ) {
+   return 'video/webm';
+   }
+
+   $codecs = strtolower( implode( ', ', $streams ) );
+
+   return 'video/webm; codecs="' . $streams . '"';
}
 
/**
@@ -104,10 +111,21 @@
}
if( isset( $metadata['audio'] ) && 
$metadata['audio']['dataformat'] == 'vorbis' ){
$streamTypes[] =  'Vorbis';
+   } elseif ( isset( $metadata['audio'] ) &&
+   ( $metadata['audio']['dataformat'] == 'opus'
+   || $metadata['audio']['dataformat'] == 'A_OPUS'
+   ) ) {
+   // Currently getID3 calls it A_OPUS. That will probably 
change to 'opus'
+   // once getID3 actually gets support for the codec.
+   $streamTypes[] = 'Opus';
}
// id3 gives 'V_VP8' for what we call VP8
if( $metadata['video']['dataformat'] == 'vp8' ){
$streamTypes[] =  'VP8';
+   } elseif( $metadata['video']['dataformat'] === 'vp9' || 
$metadata['video']['dataformat'] === 'V_VP9' ) {
+   // Currently getID3 calls it V_VP9. That will probably 
change to vp9
+   // once getID3 actually gets support for the codec.
+   $streamTypes[] =  'VP9';
}
 
return $streamTypes;

-- 
To view, visit https://gerrit.wikimedia.org/r/108482
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd368504d986821d4650347694c5b6705ceabe5d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Remove z-index on cannot play file warning - change (mediawiki...TimedMediaHandler)

2014-01-20 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/108631


Change subject: Remove z-index on cannot play file warning
..

Remove z-index on cannot play file warning

This was causing the text in the warning to be unselectable, and
unclickable. Given that commons has links in that message, this
is a pretty severe usability issue.

I don't know why the z-index was set on this element. If it was
important, giving it a higher z-index (It was 2, would need to
be > 1002 to be above the containing div) would also fix the
issue.

Change-Id: Ibd95d533b91f1f8b6bb9c983486e849c95005e8b
---
M MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js
1 file changed, 0 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/31/108631/1

diff --git 
a/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js 
b/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js
index 0fabaeb..d5d2b46 100644
--- a/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js
+++ b/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js
@@ -1429,7 +1429,6 @@
'left' : '10px',
'right' : '10px',
'padding' : '4px',
-   'z-index' : 2
})
.html( warningMsg );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/108631
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd95d533b91f1f8b6bb9c983486e849c95005e8b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Make play button have higher z-index so its clickable. - change (mediawiki...MwEmbedSupport)

2014-01-20 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/108637


Change subject: Make play button have higher z-index so its clickable.
..

Make play button have higher z-index so its clickable.

If the z-index is < the pop up dialog, button cannot be clicked
which is very confusing to the user.

See also Ibd95d533b9 and bug 60243.

Change-Id: Ifbe20df984efd8323e8736cb03680534500f6841
---
M MwEmbedModules/MwEmbedSupport/skins/common/MwEmbedCommonStyle.css
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MwEmbedSupport 
refs/changes/37/108637/1

diff --git a/MwEmbedModules/MwEmbedSupport/skins/common/MwEmbedCommonStyle.css 
b/MwEmbedModules/MwEmbedSupport/skins/common/MwEmbedCommonStyle.css
index b9602f7..5736017 100644
--- a/MwEmbedModules/MwEmbedSupport/skins/common/MwEmbedCommonStyle.css
+++ b/MwEmbedModules/MwEmbedSupport/skins/common/MwEmbedCommonStyle.css
@@ -78,7 +78,8 @@
position : absolute;
cursor : pointer;
border : none !important;
-   z-index : 1;
+   /* Needs to have a higher z-index than dialog in pop up mode or can't 
click */
+   z-index : 1501;
 }
 
 .play-btn-large:hover {
@@ -215,4 +216,4 @@
 
 .alert-text {
color : black !important;
-}
\ No newline at end of file
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/108637
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbe20df984efd8323e8736cb03680534500f6841
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MwEmbedSupport
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix broken link in mwe-embedplayer-for_best_experience message - change (mediawiki...TimedMediaHandler)

2014-01-20 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/108639


Change subject: Fix broken link in mwe-embedplayer-for_best_experience message
..

Fix broken link in mwe-embedplayer-for_best_experience message

I'm not sure if this previously worked. If it did, the js message
api is weird. In any case it definitely doesn't work now. It
seemed like the easiest work around would be to put the link
tag directly in the message.

Change-Id: Ic98cb213082b431177b9d5ad40fbe7861e50f00d
---
M MwEmbedModules/EmbedPlayer/EmbedPlayer.i18n.php
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/39/108639/1

diff --git a/MwEmbedModules/EmbedPlayer/EmbedPlayer.i18n.php 
b/MwEmbedModules/EmbedPlayer/EmbedPlayer.i18n.php
index 37fd360..613c947 100644
--- a/MwEmbedModules/EmbedPlayer/EmbedPlayer.i18n.php
+++ b/MwEmbedModules/EmbedPlayer/EmbedPlayer.i18n.php
@@ -65,7 +65,7 @@
'mwe-embedplayer-ogg-player-kplayer' => 'Kaltura player',
'mwe-embedplayer-ogg-player-selected' => '(selected)',
'mwe-embedplayer-ogg-player-omtkplayer' => 'OMTK Flash Vorbis',
-   'mwe-embedplayer-for_best_experience' => 'For a better video playback 
experience we recommend a [$1 HTML5 video browser].',
+   'mwe-embedplayer-for_best_experience' => 'For a better video playback 
experience we recommend an HTML5 video browser.',
'mwe-embedplayer-download-warn' => 'No compatible in-browser player was 
detected: for in-browser playback, please download the [$1 latest Firefox]',
'mwe-embedplayer-fullscreen-tip' => 'Press F11 toggle web 
browser fullscreen',
'mwe-embedplayer-fullscreen-tip-osx' => 'Press shift ⌘ F to 
toggle fullscreen',
@@ -125,8 +125,8 @@
'mwe-embedplayer-ogg-player-aacNative' => 'name of AAC player in 
configuration screen',
'mwe-embedplayer-ogg-player-cortado' => '{{optional}}',
'mwe-embedplayer-ogg-player-selected' => '{{Identical|Selected}}',
-   'mwe-embedplayer-for_best_experience' => 'Parameters:
-* $1 - URL',
+   'mwe-embedplayer-for_best_experience' => 'Shown when user\'s browser 
doesn\'t support playing videos. Parameters:
+* $1 - An empty  tag. Don\'t use this parameter.',
'mwe-embedplayer-download-warn' => 'Parameters:
 * $1 - URL',
'mwe-embedplayer-do_not_warn_again' => 'Standard message for disabling

-- 
To view, visit https://gerrit.wikimedia.org/r/108639
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic98cb213082b431177b9d5ad40fbe7861e50f00d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix java fallback support on browsers that don't natively do... - change (mediawiki...TimedMediaHandler)

2014-01-20 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/108646


Change subject: Fix java fallback support on browsers that don't natively do 
ogg.
..

Fix java fallback support on browsers that don't natively do ogg.

TMH was comparing the mime type 'video/ogg; codec="theora, vorbis"'
to 'video/ogg; codec="theora,vorbis"' when checking if cortado
could play the video. The mime checking code is not very robust
and doing string equality comparisions. As a result in the different
spacing, TMH determined that the java cortado applet could not
play theora videos.

This should significantly improve the number of desktop MSIE
and Safari users who can play our videos.

A future todo would be to make TMH more robust about how it
checks mime types.

Bug: 60259
Change-Id: I4072ebc592f791be9c3ed898ebb46217e6351cb9
---
M MwEmbedModules/EmbedPlayer/resources/mw.EmbedTypes.js
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/46/108646/1

diff --git a/MwEmbedModules/EmbedPlayer/resources/mw.EmbedTypes.js 
b/MwEmbedModules/EmbedPlayer/resources/mw.EmbedTypes.js
index 5f1a6fc..80960a4 100644
--- a/MwEmbedModules/EmbedPlayer/resources/mw.EmbedTypes.js
+++ b/MwEmbedModules/EmbedPlayer/resources/mw.EmbedTypes.js
@@ -25,7 +25,7 @@
 var cortadoPlayer = new mw.MediaPlayer( 'cortado', [
'video/ogg',
'video/ogg; codecs="theora"',
-   'video/ogg; codecs="theora,vorbis"',
+   'video/ogg; codecs="theora, vorbis"',
'audio/ogg',
'audio/ogg; codecs="vorbis"',
'application/ogg'
@@ -230,7 +230,7 @@
}
 
// Test for ogg
-   if ( dummyvid.canPlayType( 'video/ogg; 
codecs="theora,vorbis"' ) ) {
+   if ( dummyvid.canPlayType( 'video/ogg; 
codecs="theora, vorbis"' ) ) {
this.mediaPlayers.addPlayer( 
oggNativePlayer );
// older versions of safari do not 
support canPlayType,
// but xiph qt registers mimetype via 
quicktime plugin

-- 
To view, visit https://gerrit.wikimedia.org/r/108646
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4072ebc592f791be9c3ed898ebb46217e6351cb9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add Special:RandomInCategory. - change (mediawiki/core)

2013-07-04 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/71997


Change subject: Add Special:RandomInCategory.
..

Add Special:RandomInCategory.

This is meant mostly to spur discussion. The method used is quite
biased, but I believe its the best possible without a schema change
and still being efficient.

The question at hand - is this method acceptable. The method used
is to chose a random timestamp and look at cl_timestamp. This method
will give good results if the timestamps are uniformly distributed
(which probably is not usually true). I think it may give acceptable
results in general, especially given most people are not interested
in true randomness, but more in "give me a result I haven't seen before".
(For example, to pick a random entry in a maintenance category to clean
up).

It also fudges the result a little bit using offset to stop really
biased results from happening.

Bug: 25931
Change-Id: I0c48e4a236b50fb627af94f0df47fef8372ea14d
---
M RELEASE-NOTES-1.22
M includes/AutoLoader.php
M includes/SpecialPageFactory.php
A includes/specials/SpecialRandomInCategory.php
M languages/messages/MessagesEn.php
M languages/messages/MessagesQqq.php
M maintenance/language/messages.inc
7 files changed, 291 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/97/71997/1

diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index 45a6f01..0d06ff2 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -137,6 +137,7 @@
   also granting the ability to protect and unprotect.
 * (bug 48256) Make brackets in section edit links accessible to CSS.
   They are now wrapped in .
+* (bug 25931) Add Special:RandomInCategory.
 
 === Bug fixes in 1.22 ===
 * Disable Special:PasswordReset when $wgEnableEmail is false. Previously one
diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php
index 6f8cd4b..09d5f90 100644
--- a/includes/AutoLoader.php
+++ b/includes/AutoLoader.php
@@ -932,6 +932,7 @@
'ProtectedPagesPager' => 'includes/specials/SpecialProtectedpages.php',
'ProtectedTitlesPager' => 
'includes/specials/SpecialProtectedtitles.php',
'RandomPage' => 'includes/specials/SpecialRandompage.php',
+   'RandomInCategory' => 'includes/specials/SpecialRandomInCategory.php',
'ShortPagesPage' => 'includes/specials/SpecialShortpages.php',
'SpecialActiveUsers' => 'includes/specials/SpecialActiveusers.php',
'SpecialAllmessages' => 'includes/specials/SpecialAllmessages.php',
diff --git a/includes/SpecialPageFactory.php b/includes/SpecialPageFactory.php
index 4d63553..c4b3dd0 100644
--- a/includes/SpecialPageFactory.php
+++ b/includes/SpecialPageFactory.php
@@ -130,6 +130,7 @@
// Redirecting special pages
'LinkSearch'=> 'LinkSearchPage',
'Randompage'=> 'Randompage',
+   'RandomInCategory'  => 'RandomInCategory',
'Randomredirect'=> 'SpecialRandomredirect',
 
// High use pages
diff --git a/includes/specials/SpecialRandomInCategory.php 
b/includes/specials/SpecialRandomInCategory.php
new file mode 100644
index 000..3b2f964
--- /dev/null
+++ b/includes/specials/SpecialRandomInCategory.php
@@ -0,0 +1,264 @@
+http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup SpecialPage
+ * @author Brian Wolff
+ */
+
+/**
+ * Special page to direct the user to a random page
+ *
+ * @note The method used here is rather biased. It is assumed that
+ * the use of this page will be people wanting to get a random page
+ * out of a maintenance category, to fix it up. The method used by
+ * this page should return different pages in an unpredictable fashion
+ * which is hoped to be sufficient, even if some pages are selected
+ * more often than others.
+ *
+ * A more unbiased method could be achieved by adding a cl_random field
+ * to the categorylinks table.
+ *
+ * The method used here is as follows:
+ *  * Find the smallest and largest timestamp in the category
+ *  * Pick a random timestamp in between
+ *  * Pick an offset between 0 and 30
+ *  * Get the offset'ed page that is newer than the timestamp selected
+ * The offset is meant to counter the fact the timestamps aren't usually
+ * uniformly distributed, so if things are very non-uniform at least we
+ * won't have the same page selected 99% of the time.
+ *
+ * @ingroup SpecialPage
+ */
+class RandomInCategory extends SpecialPage {
+   protected $extra = array(); // Extra SQL statements
+   protected $category = false; // Title object of category
+   protected $maxOffset = 30; // Max amount to fudge randomness by.
+   private $maxTimestamp = null;
+   private $minTimestamp = null;
+
+   public function __construct( $name = 'RandomInCategory' ) {
+   parent::__construct( $name );
+   }
+
+   /**
+ 

[MediaWiki-commits] [Gerrit] Have Chunked upload jobs bail if cannot associate with session. - change (mediawiki/core)

2013-07-07 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/72473


Change subject: Have Chunked upload jobs bail if cannot associate with session.
..

Have Chunked upload jobs bail if cannot associate with session.

Also add docs about how suhosin.session.encrypt tends to break
this (I was thinking about throwing an exception if the setting was
on in RequestContext::importScopedSession, but the docs seem to
indicate that you can tweak how the session is encrypted, so it
sounds like somebody could set up their php so everything worked).

Bug: 48371
Change-Id: I5a471c1f941fce046451fbb9abce1c830185cabb
---
M includes/DefaultSettings.php
M includes/context/RequestContext.php
M includes/job/jobs/AssembleUploadChunksJob.php
M includes/job/jobs/PublishStashedFileJob.php
4 files changed, 25 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/73/72473/1

diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index f9d280f..6447316 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -323,6 +323,9 @@
  * Enable deferred upload tasks that use the job queue.
  * Only enable this if job runners are set up for both the
  * 'AssembleUploadChunks' and 'PublishStashedFile' job types.
+ *
+ * @note If you use suhosin, this setting is incompatible with
+ *   suhosin.session.encrypt.
  */
 $wgEnableAsyncUploads = false;
 
diff --git a/includes/context/RequestContext.php 
b/includes/context/RequestContext.php
index cb26dcf..b9dbe77 100644
--- a/includes/context/RequestContext.php
+++ b/includes/context/RequestContext.php
@@ -417,7 +417,9 @@
 * This will setup the session from the given ID. This is useful when
 * background scripts inherit context when acting on behalf of a user.
 *
-* $param array $params Result of RequestContext::exportSession()
+* @note suhosin.session.encrypt may interfere with this method.
+*
+* @param array $params Result of RequestContext::exportSession()
 * @return ScopedCallback
 * @throws MWException
 * @since 1.21
diff --git a/includes/job/jobs/AssembleUploadChunksJob.php 
b/includes/job/jobs/AssembleUploadChunksJob.php
index 4fe1753..4edc75f 100644
--- a/includes/job/jobs/AssembleUploadChunksJob.php
+++ b/includes/job/jobs/AssembleUploadChunksJob.php
@@ -42,6 +42,15 @@
return false;
}
 
+   if ( count( $_SESSION ) === 0 ) {
+   // Empty session probably indicates that we 
didn't associate
+   // with the session correctly. Note that being 
able to load
+   // the user does not neccesarily mean the 
session was loaded.
+   // Most likely cause by suhosin.session.encrypt 
= On.
+   $this->setLastError( "Error associating with 
user session. Try setting suhosin.session.encrypt = Off" );
+   return false;
+   }
+
UploadBase::setSessionStatus(
$this->params['filekey'],
array( 'result' => 'Poll', 'stage' => 
'assembling', 'status' => Status::newGood() )
diff --git a/includes/job/jobs/PublishStashedFileJob.php 
b/includes/job/jobs/PublishStashedFileJob.php
index 5114dc0..c4b76df 100644
--- a/includes/job/jobs/PublishStashedFileJob.php
+++ b/includes/job/jobs/PublishStashedFileJob.php
@@ -42,6 +42,16 @@
return false;
}
 
+   if ( count( $_SESSION ) === 0 ) {
+   // Empty session probably indicates that we 
didn't associate
+   // with the session correctly. Note that being 
able to load
+   // the user does not neccesarily mean the 
session was loaded.
+   // Most likely cause by suhosin.session.encrypt 
= On.
+   $this->setLastError( "Error associating with 
user session. Try setting suhosin.session.encrypt = Off" );
+   return false;
+   }
+
+
UploadBase::setSessionStatus(
$this->params['filekey'],
array( 'result' => 'Poll', 'stage' => 
'publish', 'status' => Status::newGood() )

-- 
To view, visit https://gerrit.wikimedia.org/r/72473
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a471c1f941fce046451fbb9abce1c830185cabb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits ma

[MediaWiki-commits] [Gerrit] Fix undefined std_class::fa_deleted_timestamp warning during... - change (mediawiki/core)

2013-07-09 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/72743


Change subject: Fix undefined std_class::fa_deleted_timestamp warning during 
undelete.
..

Fix undefined std_class::fa_deleted_timestamp warning during undelete.

Change-Id: I243d6c408941cfbdef2ec2d24596a3e638e1b4cd
---
M includes/filerepo/file/ArchivedFile.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/43/72743/1

diff --git a/includes/filerepo/file/ArchivedFile.php 
b/includes/filerepo/file/ArchivedFile.php
index 6c4bf8a..749f11a 100644
--- a/includes/filerepo/file/ArchivedFile.php
+++ b/includes/filerepo/file/ArchivedFile.php
@@ -196,6 +196,7 @@
'fa_user_text',
'fa_timestamp',
'fa_deleted',
+   'fa_deleted_timestamp', /* Used by 
LocalFileRestoreBatch */
'fa_sha1',
);
}

-- 
To view, visit https://gerrit.wikimedia.org/r/72743
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I243d6c408941cfbdef2ec2d24596a3e638e1b4cd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Don't purge thumbs for old versions of an image during ?acti... - change (mediawiki/core)

2013-07-09 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/72769


Change subject: Don't purge thumbs for old versions of an image during 
?action=purge
..

Don't purge thumbs for old versions of an image during ?action=purge

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 targetting 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 unrevdel it.

It should be noted that this extra purging was added
for bug 30192, however since then most of the places
it was needed added other calls to do the purge.

There's no real bug for this, but I kind of hijacked
bug 49362

Try purging
[[commons:File:Bearbeitungsstand_Denkmale_Österreichs_nach_Gemeinden_Bilder.svg]]
for an example of the performance issue this aims to fix.

Change-Id: Ib399132cabe79fd2b4b23bad5708bfa50b282074
---
M includes/filerepo/file/LocalFile.php
M includes/revisiondelete/RevisionDelete.php
2 files changed, 13 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/69/72769/1

diff --git a/includes/filerepo/file/LocalFile.php 
b/includes/filerepo/file/LocalFile.php
index 3be66d3..6e0769e 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -798,7 +798,9 @@
}
 
/**
-* Purge the shared history (OldLocalFile) cache
+* Purge the shared history (OldLocalFile) cache.
+*
+* @note This used to purge old thumbnails as well.
 */
function purgeHistory() {
global $wgMemc;
@@ -806,20 +808,20 @@
$hashedName = md5( $this->getName() );
$oldKey = $this->repo->getSharedCacheKey( 'oldfile', 
$hashedName );
 
-   // Must purge thumbnails for old versions too! bug 30192
-   foreach ( $this->getHistory() as $oldFile ) {
-   $oldFile->purgeThumbnails();
-   }
-
if ( $oldKey ) {
$wgMemc->delete( $oldKey );
}
}
 
/**
-* Delete all previously generated thumbnails, refresh metadata in 
memcached and purge the squid
+* Delete all previously generated thumbnails, refresh metadata in 
memcached and purge the squid.
+*
+* @param Array $options An array potentially with the key 
forThumbRefresh.
+*
+* @note This used to purge old thumbnails by default as well, but 
doesn't anymore.
 */
function purgeCache( $options = array() ) {
+   wfProfileIn( __METHOD__ );
// Refresh metadata cache
$this->purgeMetadataCache();
 
@@ -828,6 +830,7 @@
 
// Purge squid cache for this file
SquidUpdate::purge( array( $this->getURL() ) );
+   wfProfileOut( __METHOD__ );
}
 
/**
diff --git a/includes/revisiondelete/RevisionDelete.php 
b/includes/revisiondelete/RevisionDelete.php
index ac72276..135e31f 100644
--- a/includes/revisiondelete/RevisionDelete.php
+++ b/includes/revisiondelete/RevisionDelete.php
@@ -501,6 +501,9 @@
$file = wfLocalFile( $this->title );
$file->purgeCache();
$file->purgeDescription();
+   foreach ( $this->ids as $timestamp ) {
+   $file->purgeOldThumbnails( $timestamp . '!' . 
$this->title->getDBkey() );
+   }
return Status::newGood();
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/72769
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib399132cabe79fd2b4b23bad5708bfa50b282074
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Have Special:VipsTest recognize things with File: prefix - change (mediawiki...VipsScaler)

2013-07-11 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/73183


Change subject: Have Special:VipsTest recognize things with File: prefix
..

Have Special:VipsTest recognize things with File: prefix

Note, I don't have vips set up locally, so didn't actually
test, but its a simple one line change, and definitely
should work.

Bug: 51149
Change-Id: Icf2fafe3bb2d9fe7af51dbc46d5ea86d68c12e5e
---
M SpecialVipsTest.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VipsScaler 
refs/changes/83/73183/1

diff --git a/SpecialVipsTest.php b/SpecialVipsTest.php
index 66326d3..4c928a2 100644
--- a/SpecialVipsTest.php
+++ b/SpecialVipsTest.php
@@ -55,7 +55,7 @@
$request = $this->getRequest();
 
# Check if valid file was provided
-   $title = Title::makeTitleSafe( NS_FILE, $request->getText( 
'file' ) );
+   $title = Title::newFromText( $request->getText( 'file' ), 
NS_FILE );
if ( is_null( $title ) ) {
$this->getOutput()->addWikiMsg( 
'vipsscaler-invalid-file' );
return;

-- 
To view, visit https://gerrit.wikimedia.org/r/73183
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf2fafe3bb2d9fe7af51dbc46d5ea86d68c12e5e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VipsScaler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Make {{#time:...}} expire parser cache after 12 hours. - change (mediawiki...ParserFunctions)

2013-07-11 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/73188


Change subject: Make {{#time:...}} expire parser cache after 12 hours.
..

Make {{#time:...}} expire parser cache after 12 hours.

We do this with {{CURRENTHOUR}} et al. 12 hours might be a bit
on the conservitive side perhaps, as {{CURRENTDAY}} expires after
a single hour.

Bug: 49803
Change-Id: I7972a2aea2494fdab3c122078694206d0c879aaf
---
M ParserFunctions_body.php
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ParserFunctions 
refs/changes/88/73188/1

diff --git a/ParserFunctions_body.php b/ParserFunctions_body.php
index 967e833..6a1e932 100644
--- a/ParserFunctions_body.php
+++ b/ParserFunctions_body.php
@@ -412,6 +412,11 @@
public static function time( $parser, $format = '', $date = '', 
$language = '', $local = false ) {
global $wgLocaltimezone;
self::registerClearHook();
+
+   // Since this function varries with time, reduce the parser 
cache time
+   // to 12 hours.
+   $parser->getOutput()->updateCacheExpiry( 60*60*12 );
+
if ( $date === '' ) {
$cacheKey = $parser->getOptions()->getTimestamp();
$timestamp = new MWTimestamp( $cacheKey );

-- 
To view, visit https://gerrit.wikimedia.org/r/73188
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7972a2aea2494fdab3c122078694206d0c879aaf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ParserFunctions
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Make AssembleUploadChunksJob give a status update when it st... - change (mediawiki/core)

2013-07-13 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/73605


Change subject: Make AssembleUploadChunksJob give a status update when it 
starts.
..

Make AssembleUploadChunksJob give a status update when it starts.

Previously it changed the stage from "queued" to "assembling"
when it started to assemble things, however session variables
aren't saved until after $scope falls out of scope, which meant
after the job was done, which defeats the point of having
a status update to say that assembling has started.

Change-Id: I2ddbf98296aeb41ec5dfd6478128ede77827190d
---
M includes/job/jobs/AssembleUploadChunksJob.php
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/05/73605/1

diff --git a/includes/job/jobs/AssembleUploadChunksJob.php 
b/includes/job/jobs/AssembleUploadChunksJob.php
index 4fe1753..04d8ba2 100644
--- a/includes/job/jobs/AssembleUploadChunksJob.php
+++ b/includes/job/jobs/AssembleUploadChunksJob.php
@@ -47,6 +47,12 @@
array( 'result' => 'Poll', 'stage' => 
'assembling', 'status' => Status::newGood() )
);
 
+   // Save that we are now "assembling" the file, back to 
session.
+   // No point making this sort of status update if the 
session isn't
+   // updated until after the job finished.
+   unset( $scope );
+   $scope = RequestContext::importScopedSession( 
$this->params['session'] );
+
$upload = new UploadFromChunks( $user );
$upload->continueChunks(
$this->params['filename'],

-- 
To view, visit https://gerrit.wikimedia.org/r/73605
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ddbf98296aeb41ec5dfd6478128ede77827190d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add audio stats to [[Special:TimedMediaHandler]]. - change (mediawiki...TimedMediaHandler)

2013-11-27 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/97998


Change subject: Add audio stats to [[Special:TimedMediaHandler]].
..

Add audio stats to [[Special:TimedMediaHandler]].

Note this doesn't include audio/midi, since that format is
not handled by Special:TimedMediaHandler.

Bug: 49654
Change-Id: I0b386b607020b2ee697fac1ff8e38d9f9332c8d0
---
M SpecialTimedMediaHandler.php
M TimedMediaHandler.i18n.php
2 files changed, 39 insertions(+), 13 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/98/97998/1

diff --git a/SpecialTimedMediaHandler.php b/SpecialTimedMediaHandler.php
index 700fe96..a1805d1 100644
--- a/SpecialTimedMediaHandler.php
+++ b/SpecialTimedMediaHandler.php
@@ -19,6 +19,11 @@
'ogg' => 'img_major_mime="application" AND img_minor_mime = 
"ogg"',
'webm' => 'img_major_mime="video" AND img_minor_mime = "webm"',
);
+   private $audioFormats = array(
+   'ogg' => 'img_major_mime="application" AND img_minor_mime = 
"ogg"',
+   'flac' => 'img_major_mime="audio" AND img_minor_mime="x-flac"',
+   'wav' => 'img_major_mime="audio" AND img_minor_mime="wav"',
+   );
 
public function __construct( $request = null, $par = null ) {
parent::__construct( 'TimedMediaHandler', 'transcode-status' );
@@ -32,18 +37,22 @@
 
$stats = $this->getStats();
 
-   $out->addHTML(
-   ""
-   . $this->msg( 'timedmedia-videos' )->numParams( 
$stats['videos']['total'] )->escaped()
-   . ""
-   );
-   // Give grep a chance to find the usages: 
timedmedia-ogg-videos, timedmedia-webm-videos
-   foreach ( $this->formats as $format => $condition ) {
-   if ( $stats[ 'videos' ][ $format ] ) {
-   $out->addHTML(
-   $this->msg( "timedmedia-$format-videos" 
)->numParams( $stats[ 'videos' ][ $format ] )->escaped()
-   . ""
-   );
+   foreach( array( 'audios', 'videos' ) as $type ) {
+   // for grep timedmedia-audios, timedmedia-videos
+   $out->addHTML(
+   ""
+   . $this->msg( 'timedmedia-' . $type 
)->numParams( $stats[$type]['total'] )->escaped()
+   . ""
+   );
+   // Give grep a chance to find the usages: 
timedmedia-ogg-videos, timedmedia-webm-videos,
+   // timedmedia-ogg-audios, timedmedia-flac-audios, 
timedmedia-wav-audios
+   foreach ( $this->formats as $format => $condition ) {
+   if ( $stats[ $type ][ $format ] ) {
+   $out->addHTML(
+   $this->msg( 
"timedmedia-$format-$type" )->numParams( $stats[ $type ][ $format ] )->escaped()
+   . ""
+   );
+   }
}
}
 
@@ -152,7 +161,16 @@
);
$stats[ 'videos' ][ 'total' ] += $stats[ 
'videos' ][ $format ];
}
-   $wgMemc->add( $memcKey, $stats, 3600 );
+   $stats[ 'audios' ] = array( 'total' => 0 );
+   foreach( $this->formats as $format => $condition ) {
+   $stats[ 'audios' ][ $format ] = 
(int)$dbr->selectField(
+   'image',
+   'COUNT(*)',
+   'img_media_type = "AUDIO" AND (' . 
$condition . ')',
+   __METHOD__
+   );
+   $stats[ 'audios' ][ 'total' ] += $stats[ 
'audios' ][ $format ];
+   }
}
return $stats;
}
diff --git a/TimedMediaHandler.i18n.php b/TimedMediaHandler.i18n.php
index d4eb44f..6505122 100755
--- a/TimedMediaHandler.i18n.php
+++ b/TimedMediaHandler.i18n.php
@@ -139,6 +139,10 @@
'timedmedia-derivative-state-queued' => '{{PLURAL:$1|$1 queued 
transcode|$1 queued transcodes}}',
'timedmedia-derivative-state-failed' => '{{PLURAL:$1|$1 failed 
transcode|$1 failed transcodes}}',
'timedmedia-file' => 'File',
+   'timedmedia-audios' => '{{PLURAL:$1|$1 audio file|$1 audio files}}',
+   'timedmedia-ogg-audios' => '{{PLURAL:$1|$1 Ogg audio|$1 Ogg audio 
files}}',
+   'timedmedia-flac-audios' => '{{PLURAL:$1|$1 FLAC aud

[MediaWiki-commits] [Gerrit] Do language formatting on numbers in [[Special:TimedMediaHan... - change (mediawiki...TimedMediaHandler)

2013-11-27 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/97999


Change subject: Do language formatting on numbers in 
[[Special:TimedMediaHandler]]
..

Do language formatting on numbers in [[Special:TimedMediaHandler]]

At some future point, this should maybe have i18n done as a
parameter to message, instead of just outputting the number,
but that's kind of a separate issue.

Change-Id: I42a711f100f28be5e3914f6ab5d52fa9f1b3f0b9
---
M SpecialTimedMediaHandler.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/99/97999/1

diff --git a/SpecialTimedMediaHandler.php b/SpecialTimedMediaHandler.php
index 700fe96..7b33d07 100644
--- a/SpecialTimedMediaHandler.php
+++ b/SpecialTimedMediaHandler.php
@@ -69,13 +69,13 @@
// timedmedia-derivative-state-queued, 
timedmedia-derivative-state-failed
$out->addHTML(
""
-   . $this->msg( 'timedmedia-derivative-state-' . 
$state, $states[ $state ]['total'] )->escaped()
+   . $this->msg( 'timedmedia-derivative-state-' . 
$state )->numParams( $states[ $state ]['total'] )->escaped()
. ""
);
foreach( $allTranscodes as $key ) {
if ( $states[ $state ][ $key ] ) {
$out->addHTML(
-   $states[ $state ][ $key ]
+   htmlspecialchars( 
$this->getLanguage()->formatNum( $states[ $state ][ $key ] ) )
. ' '
. $this->msg( 
'timedmedia-derivative-desc-' . $key )->escaped()
. "" );

-- 
To view, visit https://gerrit.wikimedia.org/r/97999
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I42a711f100f28be5e3914f6ab5d52fa9f1b3f0b9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] (bug 40588) LinkSearch cannot search with a port in the url - change (mediawiki/core)

2013-12-01 Thread Brian Wolff (Code Review)
Brian Wolff has submitted this change and it was merged.

Change subject: (bug 40588) LinkSearch cannot search with a port in the url
..


(bug 40588) LinkSearch cannot search with a port in the url

Special:LinkSearch doesn't handle urls with a port correctly.

The detection of the protocol to search for (in LinkSearchPage::execute()) cant 
handle
the extra colon a port introduces in the url. Fixed by making 
LinkSearchPage::execute
use wfParseUrl() to detect the protocol.

LinkFilter::makeLikeArray didn't handle the port correctly too, putting it in 
the
domain part of the url. Fixed by rewriting makeLikeArray to make use of 
wfParseUrl().
This also fixes the problem of makeLikeArray not removing username and pass from
the search pattern.

Allow queries like 'ftp://*' or 'mailto:*' to find all links with specific 
protocols

Bug: 40588
Change-Id: Id3dd31993456bf6cbba4cf17962cf0083b612bed
---
M includes/LinkFilter.php
M includes/specials/SpecialLinkSearch.php
A tests/phpunit/includes/LinkFilterTest.php
3 files changed, 366 insertions(+), 67 deletions(-)

Approvals:
  Brian Wolff: Looks good to me, approved



diff --git a/includes/LinkFilter.php b/includes/LinkFilter.php
index d552c69..97834fe 100644
--- a/includes/LinkFilter.php
+++ b/includes/LinkFilter.php
@@ -84,16 +84,28 @@
 *
 * Asterisks in any other location are considered invalid.
 *
-* @param string $filterEntry domainparts
-* @param $protString: protocol
+* This function does the same as wfMakeUrlIndexes(), except it also 
takes care
+* of adding wildcards
+*
+* @param String $filterEntry domainparts
+* @param String $protocol protocol (default http://)
 * @return Array to be passed to DatabaseBase::buildLike() or false on 
error
 */
-   public static function makeLikeArray( $filterEntry, $prot = 'http://' ) 
{
+   public static function makeLikeArray( $filterEntry, $protocol = 
'http://' ) {
$db = wfGetDB( DB_MASTER );
-   if ( substr( $filterEntry, 0, 2 ) == '*.' ) {
+
+   $target = $protocol . $filterEntry;
+   $bits = wfParseUrl( $target );
+
+   if ( $bits == false ) {
+   // Unknown protocol?
+   return false;
+   }
+
+   if ( substr( $bits['host'], 0, 2 ) == '*.' ) {
$subdomains = true;
-   $filterEntry = substr( $filterEntry, 2 );
-   if ( $filterEntry == '' ) {
+   $bits['host'] = substr( $bits['host'], 2 );
+   if ( $bits['host'] == '' ) {
// We don't want to make a clause that will 
match everything,
// that could be dangerous
return false;
@@ -101,52 +113,63 @@
} else {
$subdomains = false;
}
-   // No stray asterisks, that could cause confusion
-   // It's not simple or efficient to handle it properly so we 
don't
-   // handle it at all.
-   if ( strpos( $filterEntry, '*' ) !== false ) {
-   return false;
-   }
-   $slash = strpos( $filterEntry, '/' );
-   if ( $slash !== false ) {
-   $path = substr( $filterEntry, $slash );
-   $host = substr( $filterEntry, 0, $slash );
-   } else {
-   $path = '/';
-   $host = $filterEntry;
-   }
+
// Reverse the labels in the hostname, convert to lower case
// For emails reverse domainpart only
-   if ( $prot == 'mailto:' && strpos( $host, '@' ) ) {
+   if ( $bits['scheme'] === 'mailto' && strpos( $bits['host'], '@' 
) ) {
// complete email address
-   $mailparts = explode( '@', $host );
+   $mailparts = explode( '@', $bits['host'] );
$domainpart = strtolower( implode( '.', array_reverse( 
explode( '.', $mailparts[1] ) ) ) );
-   $host = $domainpart . '@' . $mailparts[0];
-   $like = array( "$prot$host", $db->anyString() );
-   } elseif ( $prot == 'mailto:' ) {
-   // domainpart of email address only. do not add '.'
-   $host = strtolower( implode( '.', array_reverse( 
explode( '.', $host ) ) ) );
-   $like = array( "$prot$host", $db->anyString() );
+   $bits['host'] = $domainpart . '@' . $mailparts[0];
+   } elseif ( $bits['scheme'] === 'mailto' ) {
+   // domainpart of email address only, do not add '.'
+   $bits[

[MediaWiki-commits] [Gerrit] Update type hints in TraditionalImageGallery - change (mediawiki/core)

2013-12-02 Thread Brian Wolff (Code Review)
Brian Wolff has submitted this change and it was merged.

Change subject: Update type hints in TraditionalImageGallery
..


Update type hints in TraditionalImageGallery

Change-Id: I09c7d15c8717277c0a84c63f1ebdbffb066d8910
---
M includes/gallery/TraditionalImageGallery.php
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Brian Wolff: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/gallery/TraditionalImageGallery.php 
b/includes/gallery/TraditionalImageGallery.php
index 79a7015..cfedac7 100644
--- a/includes/gallery/TraditionalImageGallery.php
+++ b/includes/gallery/TraditionalImageGallery.php
@@ -60,6 +60,7 @@
$lang = $this->getRenderLang();
# Output each image...
foreach ( $this->mImages as $pair ) {
+   /** @var Title $nt */
$nt = $pair[0];
$text = $pair[1]; # "text" means "caption" here
$alt = $pair[2];
@@ -114,6 +115,7 @@
. ( $this->getThumbPadding() + 
$this->mHeights ) . 'px;">'
. htmlspecialchars( 
$img->getLastError() ) . '';
} else {
+   /** @var MediaTransformOutput $thumb */
$vpad = $this->getVPad( $this->mHeights, 
$thumb->getHeight() );
 
$imageParameters = array(
@@ -143,8 +145,10 @@
. $thumb->toHtml( $imageParameters ) . 
'';
 
// Call parser transform hook
-   if ( $this->mParser && $img->getHandler() ) {
-   
$img->getHandler()->parserTransformHook( $this->mParser, $img );
+   /** @var MediaHandler $handler */
+   $handler = $img->getHandler();
+   if ( $this->mParser && $handler ) {
+   $handler->parserTransformHook( 
$this->mParser, $img );
}
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/97477
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I09c7d15c8717277c0a84c63f1ebdbffb066d8910
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Siebrand 
Gerrit-Reviewer: Brian Wolff 
Gerrit-Reviewer: Chad 
Gerrit-Reviewer: Siebrand 
Gerrit-Reviewer: Umherirrender 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Use canonical class name for SvgHandler and rename the test ... - change (mediawiki/core)

2013-12-02 Thread Brian Wolff (Code Review)
Brian Wolff has submitted this change and it was merged.

Change subject: Use canonical class name for SvgHandler and rename the test for 
consistency.
..


Use canonical class name for SvgHandler and rename the test for consistency.

Change-Id: I2f7582a73968687b92f5f45b2026aa27e043281f
---
M tests/phpunit/includes/media/SVGTest.php
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Brian Wolff: Looks good to me, approved



diff --git a/tests/phpunit/includes/media/SVGTest.php 
b/tests/phpunit/includes/media/SVGTest.php
index b28ee56..e0fae71 100644
--- a/tests/phpunit/includes/media/SVGTest.php
+++ b/tests/phpunit/includes/media/SVGTest.php
@@ -1,5 +1,6 @@
  $this->backend
) );
 
-   $this->handler = new SVGHandler;
+   $this->handler = new SvgHandler;
}
 
/**

-- 
To view, visit https://gerrit.wikimedia.org/r/97316
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2f7582a73968687b92f5f45b2026aa27e043281f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Platonides 
Gerrit-Reviewer: Brian Wolff 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add missing subjectspace pages to watchlist on update. - change (mediawiki/core)

2013-12-02 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/98563


Change subject: Add missing subjectspace pages to watchlist on update.
..

Add missing subjectspace pages to watchlist on update.

Previously this only fixed the other direction, if a talk page
was missing, but it still complaining for a missing subject page.

Discovered by Joergi on irc

Change-Id: I439eb0c4a74260157f9542470f01f189fe9081c5
---
M includes/installer/MysqlUpdater.php
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/63/98563/1

diff --git a/includes/installer/MysqlUpdater.php 
b/includes/installer/MysqlUpdater.php
index cc5313a..ffa4900 100644
--- a/includes/installer/MysqlUpdater.php
+++ b/includes/installer/MysqlUpdater.php
@@ -390,6 +390,16 @@
'wl_notificationtimestamp' => 
'wl_notificationtimestamp'
), array( 'NOT (wl_namespace & 1)' ), __METHOD__, 
'IGNORE' );
$this->output( "done.\n" );
+
+   $this->output( "Adding missing watchlist subject page rows... " 
);
+   $this->db->insertSelect( 'watchlist', 'watchlist',
+   array(
+   'wl_user' => 'wl_user',
+   'wl_namespace' => 'wl_namespace & ~1',
+   'wl_title' => 'wl_title',
+   'wl_notificationtimestamp' => 
'wl_notificationtimestamp'
+   ), array( 'wl_namespace & 1' ), __METHOD__, 'IGNORE' );
+   $this->output( "done.\n" );
}
 
function doSchemaRestructuring() {

-- 
To view, visit https://gerrit.wikimedia.org/r/98563
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I439eb0c4a74260157f9542470f01f189fe9081c5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] (minor) Make ApiFeedContributions respect $wgFeedLimit - change (mediawiki/core)

2013-12-02 Thread Brian Wolff (Code Review)
Brian Wolff has submitted this change and it was merged.

Change subject: (minor) Make ApiFeedContributions respect $wgFeedLimit
..


(minor) Make ApiFeedContributions respect $wgFeedLimit

Change-Id: I67e6e30d9fa9b4998de720a2a444c7846003266e
---
M includes/Pager.php
M includes/api/ApiFeedContributions.php
2 files changed, 14 insertions(+), 1 deletion(-)

Approvals:
  Brian Wolff: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Pager.php b/includes/Pager.php
index 4a14c7e..28d2839 100644
--- a/includes/Pager.php
+++ b/includes/Pager.php
@@ -268,6 +268,15 @@
}
 
/**
+* Get the current limit
+*
+* @return int
+*/
+   function getLimit() {
+   return $this->mLimit;
+   }
+
+   /**
 * Set whether a row matching exactly the offset should be also included
 * in the result or not. By default this is not the case, but when the
 * offset is user-supplied this might be wanted.
diff --git a/includes/api/ApiFeedContributions.php 
b/includes/api/ApiFeedContributions.php
index 27037cb..bf69410 100644
--- a/includes/api/ApiFeedContributions.php
+++ b/includes/api/ApiFeedContributions.php
@@ -41,7 +41,7 @@
public function execute() {
$params = $this->extractRequestParams();
 
-   global $wgFeed, $wgFeedClasses, $wgSitename, $wgLanguageCode;
+   global $wgFeed, $wgFeedClasses, $wgFeedLimit, $wgSitename, 
$wgLanguageCode;
 
if ( !$wgFeed ) {
$this->dieUsage( 'Syndication feeds are not available', 
'feed-unavailable' );
@@ -81,6 +81,10 @@
'showSizeDiff' => $params['showsizediff'],
) );
 
+   if ( $pager->getLimit() > $wgFeedLimit ) {
+   $pager->setLimit( $wgFeedLimit );
+   }
+
$feedItems = array();
if ( $pager->getNumRows() > 0 ) {
foreach ( $pager->mResult as $row ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/39840
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I67e6e30d9fa9b4998de720a2a444c7846003266e
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MrBlueSky 
Gerrit-Reviewer: Anomie 
Gerrit-Reviewer: Brian Wolff 
Gerrit-Reviewer: Catrope 
Gerrit-Reviewer: Lwelling 
Gerrit-Reviewer: Yurik 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Make DjVu metadata be stored as serialized PHP array. - change (mediawiki/core)

2013-12-05 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/99544


Change subject: Make DjVu metadata be stored as serialized PHP array.
..

Make DjVu metadata be stored as serialized PHP array.

Previously metadata was stored as a string of XML. Some of the
code in File expects the metadata to be an array serialized using
PHP's serialization format. In particular, this fixes the api
query=imageinfo module, and by extension instantCommons.

This supersedes Icaa16eeb

Bug: 37764
Change-Id: I5c1d2d2434f70b57137837bade797d4133c47b70
---
M includes/media/DjVu.php
1 file changed, 27 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/44/99544/1

diff --git a/includes/media/DjVu.php b/includes/media/DjVu.php
index fe3313a..9cd06e4 100644
--- a/includes/media/DjVu.php
+++ b/includes/media/DjVu.php
@@ -229,6 +229,30 @@
}
 
/**
+* Get metadata, unserializing it if neccessary.
+*
+* @param File $file The DjVu file in question
+* @return String XML metadata as a string.
+*/
+   private function getUnserializedMetadata( File $file ) {
+   $metadata = $file->getMetadata();
+   if ( substr( $metadata, 0, 3 ) === 'dejaMetaTree;
}
 
-   $metadata = $image->getMetadata();
+   $metadata = $this->getUnserializedMetadata( $image );
if ( !$this->isMetadataValid( $image, $metadata ) ) {
wfDebug( "DjVu XML metadata is invalid or missing, 
should have been fixed in upgradeRow\n" );
 
@@ -294,7 +318,8 @@
function getMetadata( $image, $path ) {
wfDebug( "Getting DjVu metadata for $path\n" );
 
-   return $this->getDjVuImage( $image, $path )->retrieveMetaData();
+   $xml = $this->getDjVuImage( $image, $path )->retrieveMetaData();
+   return serialize( array( 'xml' => $xml ) );
}
 
function getMetadataType( $image ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/99544
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5c1d2d2434f70b57137837bade797d4133c47b70
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Url encode page title for add subtitles link. - change (mediawiki...TimedMediaHandler)

2014-02-14 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/113489

Change subject: Url encode page title for add subtitles link.
..

Url encode page title for add subtitles link.

Was breaking on pages with '&' in title.

Bug: 61336
Change-Id: I683acc29693d0deea579d39152e974158f9bc21c
---
M resources/mw.MediaWikiPlayerSupport.js
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/89/113489/1

diff --git a/resources/mw.MediaWikiPlayerSupport.js 
b/resources/mw.MediaWikiPlayerSupport.js
index c901462..baab3fd 100644
--- a/resources/mw.MediaWikiPlayerSupport.js
+++ b/resources/mw.MediaWikiPlayerSupport.js
@@ -293,10 +293,12 @@
// add text link already present
return ;
}
-   
+
+   var pageTitle = 'TimedText:' +
+   decodeURIComponent( 
embedPlayer.apiTitleKey ).replace(/^File:|^Image:/, '');
var addTextPage =  mw.getApiProviderURL( 
apiProvider )

.replace( 'api.php', 'index.php') +
-   
'?title=TimedText:' + unescape( embedPlayer.apiTitleKey 
).replace(/^File:|^Image:/, '');
+   
'?title=' + encodeURIComponent( pageTitle );
 
var $li = $.getLineItem( mw.msg( 
'mwe-timedtext-upload-timed-text'), 'script', function() {
window.location = addTextPage;

-- 
To view, visit https://gerrit.wikimedia.org/r/113489
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I683acc29693d0deea579d39152e974158f9bc21c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Decode html entities before comparing strings in #ifeq: and ... - change (mediawiki...ParserFunctions)

2014-02-14 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/113518

Change subject: Decode html entities before comparing strings in #ifeq: and 
#switch
..

Decode html entities before comparing strings in #ifeq: and #switch

This makes foo's equal to foo's. This is particularly important
since {{PAGENAME}} and friends html encode certain characters.

This change should be communicated to users before it hits wikis.
I don't think anyone is relying on the current behaviour, but
you never know.

Bug: 35628
Change-Id: I0035ac541d22491fcf15f55f2589aaab394ed0ed
---
M ParserFunctions_body.php
1 file changed, 20 insertions(+), 5 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ParserFunctions 
refs/changes/18/113518/1

diff --git a/ParserFunctions_body.php b/ParserFunctions_body.php
index 3567cc5..970729e 100644
--- a/ParserFunctions_body.php
+++ b/ParserFunctions_body.php
@@ -147,8 +147,8 @@
 * @return string
 */
public static function ifeqObj( $parser, $frame, $args ) {
-   $left = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) 
: '';
-   $right = isset( $args[1] ) ? trim( $frame->expand( $args[1] ) ) 
: '';
+   $left = isset( $args[0] ) ? self::decodeTrimExpand( $args[0], 
$frame ) : '';
+   $right = isset( $args[1] ) ? self::decodeTrimExpand( $args[1], 
$frame ) : '';
if ( $left == $right ) {
return isset( $args[2] ) ? trim( $frame->expand( 
$args[2] ) ) : '';
} else {
@@ -201,7 +201,7 @@
if ( count( $args ) == 0 ) {
return '';
}
-   $primary = trim( $frame->expand( array_shift( $args ) ) );
+   $primary = self::decodeTrimExpand( array_shift( $args ), $frame 
);
$found = $defaultFound = false;
$default = null;
$lastItemHadNoEquals = false;
@@ -219,7 +219,7 @@
# Multiple input match
return trim( $frame->expand( $valueNode 
) );
} else {
-   $test = trim( $frame->expand( $nameNode 
) );
+   $test = self::decodeTrimExpand( 
$nameNode, $frame );
if ( $test == $primary ) {
# Found a match, return now
return trim( $frame->expand( 
$valueNode ) );
@@ -231,8 +231,10 @@
# Multiple input, single output
# If the value matches, set a flag and continue
$lastItemHadNoEquals = true;
-   $test = trim( $frame->expand( $valueNode ) );
+   $test = self::decodeTrimExpand( $valueNode, 
$frame );
if ( $test == $primary ) {
+   // Don't want to decode entities, if 
potentially output.
+   $test = trim( $frame->expand( 
$valueNode ) );
$found = true;
} elseif ( $mwDefault->matchStartAndRemove( 
$test ) ) {
$defaultFound = true;
@@ -844,4 +846,17 @@
wfProfileOut( __METHOD__ );
return $result;
}
+
+   /**
+* Take a PPNode (-ish thing), expand it, remove entities, and trim.
+*
+* For use when doing string comparisions, where user expects entities
+* to be equal for what they stand for (e.g. comparisions with 
{{PAGENAME}})
+*
+* @param $obj PPNode|string Thing to expand
+* @param $frame PPFrame
+*/
+   private static function decodeTrimExpand( $obj, $frame ) {
+   return trim( Sanitizer::decodeCharReferences( $frame->expand( 
$obj ) ) );
+   }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/113518
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0035ac541d22491fcf15f55f2589aaab394ed0ed
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ParserFunctions
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Revert "Transclude translation for preference edit section t... - change (mediawiki/core)

2014-02-17 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/113902

Change subject: Revert "Transclude translation for preference edit section to 
ensure consistency of translation"
..

Revert "Transclude translation for preference edit section to ensure 
consistency of translation"

{{int:foo}} replacements do not appear to work in Javascript.

This reverts commit 64886d140e6ab315298e34626e30531d0ca97794.

Bug: 61472
Change-Id: I47b617bf64800820a6a621de2b017ad1ee7c5f67
---
M languages/messages/MessagesEn.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/02/113902/1

diff --git a/languages/messages/MessagesEn.php 
b/languages/messages/MessagesEn.php
index bead13f..7b442ac 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -1580,7 +1580,7 @@
 'invalid-content-data' => 'Invalid content data',
 'content-not-allowed-here' => '"$1" content is not allowed on page 
[[$2]]',
 'editwarning-warning'  => 'Leaving this page may cause you to lose 
any changes you have made.
-If you are logged in, you can disable this warning in the 
"{{int:prefs-editing}}" section of your preferences.',
+If you are logged in, you can disable this warning in the "Editing" section of 
your preferences.',
 'editpage-notsupportedcontentformat-title'=> 'Content format not supported',
 'editpage-notsupportedcontentformat-text' => 'The content format $1 is not 
supported by the content model $2.',
 

-- 
To view, visit https://gerrit.wikimedia.org/r/113902
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I47b617bf64800820a6a621de2b017ad1ee7c5f67
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Unbreak this extension by killing $wgCategoryTreeDynamicTag - change (mediawiki...CategoryTree)

2014-02-19 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/114142

Change subject: Unbreak this extension by killing $wgCategoryTreeDynamicTag
..

Unbreak this extension by killing $wgCategoryTreeDynamicTag

Somewhere along the line this extension's JS was refactored,
except for part which was left as is, and was calling functions
since renamed, and still assuming top loaded...

Just kill $wgCategoryTreeDynamicTag, since it doesn't work, it
hasn't worked for a while, and it looks like a bit of work to
make it work properly. Also change the cache disabling defaults
of this extension to be 6 hours so it doesn't cause explosions.

If someone wants the feature represented by $wgCategoryTreeDynamicTag
they can of course re-introduce it in a subsequent commit. In the
mean time, lets not have broken code.

Bug: 59798
Change-Id: I01e0bd264e2a007cd9de017d10667bb2809d70a9
---
M CategoryTree.php
M CategoryTreeFunctions.php
2 files changed, 18 insertions(+), 36 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CategoryTree 
refs/changes/42/114142/1

diff --git a/CategoryTree.php b/CategoryTree.php
index 5d0bbdf..bcc5e01 100644
--- a/CategoryTree.php
+++ b/CategoryTree.php
@@ -38,9 +38,8 @@
  *
  * $wgCategoryTreeMaxChildren - maximum number of children shown in a tree 
node. Default is 200
  * $wgCategoryTreeAllowTag - enable  tag. Default is true.
- * $wgCategoryTreeDynamicTag - loads the first level of the tree in a 
 dynamically.
- * This way, the cache does not need to be 
disabled. Default is false.
- * $wgCategoryTreeDisableCache - disabled the parser cache for pages with a 
 tag. Default is true.
+ * $wgCategoryTreeDisableCache - disable the parser cache for pages with a 
 tag or provide
+ *  max cache time in seconds. Default is 6 hours.
  * $wgCategoryTreeUseCache - enable HTTP cache for anon users. Default is 
false.
  * $wgCategoryTreeMaxDepth - maximum value for depth argument; An array that 
maps mode values to
  *   the maximum depth acceptable for the depth option.
@@ -53,8 +52,7 @@
 
 $wgCategoryTreeMaxChildren = 200;
 $wgCategoryTreeAllowTag = true;
-$wgCategoryTreeDisableCache = true;
-$wgCategoryTreeDynamicTag = false;
+$wgCategoryTreeDisableCache = 6*60*60;
 $wgCategoryTreeHTTPCache = false;
 # $wgCategoryTreeUnifiedView = true;
 $wgCategoryTreeMaxDepth = array( CT_MODE_PAGES => 1, CT_MODE_ALL => 1, 
CT_MODE_CATEGORIES => 2 );
diff --git a/CategoryTreeFunctions.php b/CategoryTreeFunctions.php
index a84ba3d..b216dfe 100644
--- a/CategoryTreeFunctions.php
+++ b/CategoryTreeFunctions.php
@@ -395,16 +395,19 @@
 * @return bool|string
 */
function getTag( $parser, $category, $hideroot = false, $attr, $depth = 
1, $allowMissing = false ) {
-   global $wgCategoryTreeDisableCache, $wgCategoryTreeDynamicTag;
-   static $uniq = 0;
+   global $wgCategoryTreeDisableCache;
 
$category = trim( $category );
if ( $category === '' ) {
return false;
}
 
-   if ( $parser && $wgCategoryTreeDisableCache && 
!$wgCategoryTreeDynamicTag ) {
-   $parser->disableCache();
+   if ( $parser ) {
+   if ( $wgCategoryTreeDisableCache === true ) {
+   $parser->disableCache();
+   } elseif ( is_int( $wgCategoryTreeDisableCache ) ) {
+   $parser->getOutput()->updateCacheExpiry( 
$wgCategoryTreeDisableCache );
+   }
}
 
$title = self::makeTitle( $category );
@@ -436,18 +439,9 @@
}
else {
if ( !$hideroot ) {
-   $html .= $this->renderNode( $title, $depth, 
$wgCategoryTreeDynamicTag );
-   } elseif ( !$wgCategoryTreeDynamicTag ) {
-   $html .= $this->renderChildren( $title, $depth 
);
+   $html .= $this->renderNode( $title, $depth, 
false );
} else {
-   $uniq += 1;
-   $load = 'ct-' . $uniq . '-' . mt_rand( 1, 
10 );
-
-   $html .= Xml::openElement( 'script', array( 
'type' => 'text/javascript', 'id' => $load ) );
-   $html .= 'categoryTreeLoadChildren("' . 
Xml::escapeJsString( $title->getDBkey() ) . '", '
-   . 
$this->getOptionsAsJsStructure( $depth )
-   . ', document.getElementById("' 
. $load . '").parentNode);';
-   $html .= Xml::closeElement( 'script' );
+   $html .= 

[MediaWiki-commits] [Gerrit] Don't insert timestamp if parsing time failed - change (mediawiki...Popups)

2014-02-21 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/114710

Change subject: Don't insert timestamp if parsing time failed
..

Don't insert timestamp if parsing time failed

Makes things fail more gracefully on firefox 3.5 (which I use)

This is untested.

Change-Id: I488a51c4b9420e128236de1e20ba3351015bc61d
---
M resources/ext.popups.core.js
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Popups 
refs/changes/10/114710/1

diff --git a/resources/ext.popups.core.js b/resources/ext.popups.core.js
index f794778..ee44507 100644
--- a/resources/ext.popups.core.js
+++ b/resources/ext.popups.core.js
@@ -396,6 +396,11 @@
}
], curDuration = ms;
 
+   if ( isNaN( curDuration ) ) {
+   // Some older browsers don't support iso 8601 dates 
properly (ff 3.5).
+   return;
+   }
+
for ( i = 0; i <= timeSegments.length; i++ ) {
ts = timeSegments[ i ];
curDuration = Math.floor( curDuration / ts.factor );

-- 
To view, visit https://gerrit.wikimedia.org/r/114710
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I488a51c4b9420e128236de1e20ba3351015bc61d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] set url used in createaccount-text to main page canonical url - change (mediawiki/core)

2013-11-15 Thread Brian Wolff (Code Review)
Brian Wolff has submitted this change and it was merged.

Change subject: set url used in createaccount-text to main page canonical url
..


set url used in createaccount-text to main page canonical url

$wgScript (index.php) appended to the site url
(e.g. https://en.wikipedia.org/w/index.php) seems pointless
in the context of these email messages.

Change-Id: I1ae1ef164aa2db66e9370640e1e7dbddbed811c2
---
M includes/specials/SpecialUserlogin.php
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Brian Wolff: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialUserlogin.php 
b/includes/specials/SpecialUserlogin.php
index 5ac3e65..db77399 100644
--- a/includes/specials/SpecialUserlogin.php
+++ b/includes/specials/SpecialUserlogin.php
@@ -865,7 +865,7 @@
 * @return Status object
 */
function mailPasswordInternal( $u, $throttle = true, $emailTitle = 
'passwordremindertitle', $emailText = 'passwordremindertext' ) {
-   global $wgCanonicalServer, $wgScript, $wgNewPasswordExpiry;
+   global $wgNewPasswordExpiry;
 
if ( $u->getEmail() == '' ) {
return Status::newFatal( 'noemail', $u->getName() );
@@ -882,7 +882,11 @@
$u->setNewpassword( $np, $throttle );
$u->saveSettings();
$userLanguage = $u->getOption( 'language' );
-   $m = $this->msg( $emailText, $ip, $u->getName(), $np, '<' . 
$wgCanonicalServer . $wgScript . '>',
+
+   $mainPage = Title::newMainPage();
+   $mainPageUrl = $mainPage->getCanonicalURL();
+
+   $m = $this->msg( $emailText, $ip, $u->getName(), $np, '<' . 
$mainPageUrl . '>',
round( $wgNewPasswordExpiry / 86400 ) )->inLanguage( 
$userLanguage )->text();
$result = $u->sendMail( $this->msg( $emailTitle )->inLanguage( 
$userLanguage )->text(), $m );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/92251
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1ae1ef164aa2db66e9370640e1e7dbddbed811c2
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aude 
Gerrit-Reviewer: Aude 
Gerrit-Reviewer: Bartosz Dziewoński 
Gerrit-Reviewer: Brian Wolff 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add UI to discover translated SVG files. - change (mediawiki/core)

2013-11-15 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/95746


Change subject: Add UI to discover translated SVG files.
..

Add UI to discover translated SVG files.

Currently we support rendering SVGs in multiple languages,
but there is no mechanism for users to discover what languages
a file is available in. Show this information on the image page.

At the moment, if unspecified we always default the language to
english (I believe to avoid mass cache splitting, especially
if most languages wouldn't have a translation of the file in
their language). This code was written in such a way so that
this assumption should be changable in the future if we so
desire.

Long term, Jarry has a super cool svg translation extension
which would take over some of this. However I still believe
we should have an interface for this in core, since we do
support the different language renderings in core.

Change-Id: I84506436514e09d71200aa2db3932aa001b55c71
---
M includes/ImagePage.php
M includes/filerepo/file/File.php
M includes/media/MediaHandler.php
M includes/media/SVG.php
M languages/messages/MessagesEn.php
M languages/messages/MessagesQqq.php
M maintenance/language/messageTypes.inc
M maintenance/language/messages.inc
8 files changed, 196 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/46/95746/1

diff --git a/includes/ImagePage.php b/includes/ImagePage.php
index 7ea06b0..51fa6e4 100644
--- a/includes/ImagePage.php
+++ b/includes/ImagePage.php
@@ -505,6 +505,16 @@
);
}
 
+   $renderLangOptions = 
$this->displayImg->getAvailableLanguages();
+   if ( count( $renderLangOptions ) >= 1 ) {
+   $currentLanguage = $renderLang;
+   $defaultLang = 
$this->displayImg->getDefaultRenderLanguage();
+   if ( is_null( $currentLanguage ) ) {
+   $currentLanguage = $defaultLang;
+   }
+   $out->addHtml( $this->doRenderLangOpt( 
$renderLangOptions, $currentLanguage, $defaultLang ) );
+   }
+
// Add cannot animate thumbnail warning
if ( !$this->displayImg->canAnimateThumbIfAppropriate() 
) {
// Include the extension so wiki admins can
@@ -927,6 +937,72 @@
? $wgImageLimits[$option]
: array( 800, 600 ); // if nothing is set, fallback to 
a hardcoded default
}
+
+   /**
+* Output a drop-down box for language options for the file
+*
+* @param Array $langChoices Array of string language codes
+* @param String $curLang Language code file is being viewed in.
+* @param String $defaultLang Language code that image is rendered in 
by default
+* @return String HTML to insert underneath image.
+*/
+   protected function doRenderLangOpt( array $langChoices, $curLang, 
$defaultLang ) {
+   global $wgScript;
+   sort( $langChoices );
+   $curLang = wfBCP47( $curLang );
+   $defaultLang = wfBCP47( $defaultLang );
+   $opts = '';
+   $haveCurrentLang = false;
+   $haveDefaultLang = false;
+
+   // We make a list of all the language choices in the file.
+   // Additionally if the default language to render this file
+   // is not included as being in this file (for example, in svgs
+   // usually the fallback content is the english content) also
+   // include a choice for that. Last of all, if we're viewing
+   // the file in a language not on the list, add it as a choice.
+   foreach ( $langChoices as $lang ) {
+   $code = wfBCP47( $lang );
+   $name = Language::fetchLanguageName( $code, 
$this->getContext()->getLanguage()->getCode() );
+   if ( $name !== '' ) {
+   $display = wfMessage( 'img-lang-opt', $code, 
$name )->text();
+   } else {
+   $display = $code;
+   }
+   $opts .= "\n" . XML::Option( $display, $code, $curLang 
=== $code );
+   if ( $curLang === $code ) {
+   $haveCurrentLang = true;
+   }
+   if ( $defaultLang === $code ) {
+   $haveDefaultLang = true;
+   }
+   }
+   if ( !$haveDefaultLang ) {
+   // Its hard to know if the content is really in the 
default language, or
+

[MediaWiki-commits] [Gerrit] Call method with the same name it's defined with - change (mediawiki/core)

2013-11-15 Thread Brian Wolff (Code Review)
Brian Wolff has submitted this change and it was merged.

Change subject: Call method with the same name it's defined with
..


Call method with the same name it's defined with

Stupid case-insensitivity.

Change-Id: I4b4fc97e4670708a9cfc2ff0f4618fd0cc560251
---
M includes/specials/SpecialUserlogin.php
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Brian Wolff: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialUserlogin.php 
b/includes/specials/SpecialUserlogin.php
index f40966c..75b4a92 100644
--- a/includes/specials/SpecialUserlogin.php
+++ b/includes/specials/SpecialUserlogin.php
@@ -219,7 +219,7 @@
return;
}
 
-   $status = $this->addNewaccountInternal();
+   $status = $this->addNewAccountInternal();
if ( !$status->isGood() ) {
$error = $status->getMessage();
$this->mainLoginForm( $error->toString() );

-- 
To view, visit https://gerrit.wikimedia.org/r/95737
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4b4fc97e4670708a9cfc2ff0f4618fd0cc560251
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński 
Gerrit-Reviewer: Brian Wolff 
Gerrit-Reviewer: Chad 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix signature of ApiQueryVideoInfo::getPropertyDescriptions() - change (mediawiki...TimedMediaHandler)

2013-11-15 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/95753


Change subject: Fix signature of ApiQueryVideoInfo::getPropertyDescriptions()
..

Fix signature of ApiQueryVideoInfo::getPropertyDescriptions()

Declaration of ApiQueryVideoInfo::getPropertyDescriptions() should be 
compatible with that of ApiQueryImageInfo::getPropertyDescriptions()

Change-Id: I5d382d1eaf006db6b58c1d7a33d80be57b98f87b
---
M ApiQueryVideoInfo.php
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/53/95753/1

diff --git a/ApiQueryVideoInfo.php b/ApiQueryVideoInfo.php
index 08715da..7bcd409 100644
--- a/ApiQueryVideoInfo.php
+++ b/ApiQueryVideoInfo.php
@@ -41,8 +41,8 @@
return $prop;
}
 
-   public static function getPropertyDescriptions( $filter = array() ) {
-   $s = parent::getPropertyDescriptions();
+   public static function getPropertyDescriptions( $filter = array(), 
$modulePrefix = '' ) {
+   $s = parent::getPropertyDescriptions( $filter, $modulePrefix );
$s[] = ' derivatives-Adds an array of video source 
derivatives';
return $s;
}
@@ -235,4 +235,4 @@
return __CLASS__ . ': $Id$';
}
 
-}
\ No newline at end of file
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/95753
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5d382d1eaf006db6b58c1d7a33d80be57b98f87b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Avoid empty batch in ListredirectsPage::preprocessResults - change (mediawiki/core)

2013-11-16 Thread Brian Wolff (Code Review)
Brian Wolff has submitted this change and it was merged.

Change subject: Avoid empty batch in ListredirectsPage::preprocessResults
..


Avoid empty batch in ListredirectsPage::preprocessResults

Change-Id: Iaf371cdb1c0628a42996537d966165a0d7f92ad7
---
M includes/specials/SpecialListredirects.php
1 file changed, 5 insertions(+), 6 deletions(-)

Approvals:
  Brian Wolff: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialListredirects.php 
b/includes/specials/SpecialListredirects.php
index 2c8792f..de05be4 100644
--- a/includes/specials/SpecialListredirects.php
+++ b/includes/specials/SpecialListredirects.php
@@ -76,20 +76,19 @@
 * @param ResultWrapper $res
 */
function preprocessResults( $db, $res ) {
-   $batch = new LinkBatch;
+   if ( !$res->numRows() ) {
+   return;
+   }
 
+   $batch = new LinkBatch;
foreach ( $res as $row ) {
$batch->add( $row->namespace, $row->title );
$batch->addObj( $this->getRedirectTarget( $row ) );
}
-
$batch->execute();
 
// Back to start for display
-   if ( $res->numRows() > 0 ) {
-   // If there are no rows we get an error seeking.
-   $db->dataSeek( $res, 0 );
-   }
+   $res->seek( 0 );
}
 
protected function getRedirectTarget( $row ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/95791
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaf371cdb1c0628a42996537d966165a0d7f92ad7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 
Gerrit-Reviewer: Brian Wolff 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add continue editing link also to js and css pages - change (mediawiki/core)

2013-11-16 Thread Brian Wolff (Code Review)
Brian Wolff has submitted this change and it was merged.

Change subject: Add continue editing link also to js and css pages
..


Add continue editing link also to js and css pages

Wrap link in a span with class

Change-Id: I3cbbf9c2ae23672c0939261f2675273f5923e5f9
---
M includes/EditPage.php
1 file changed, 8 insertions(+), 3 deletions(-)

Approvals:
  Brian Wolff: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/EditPage.php b/includes/EditPage.php
index 68691c5..9a68ab3 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -3155,6 +3155,10 @@
return $previewHTML;
}
 
+   # provide a anchor link to the editform
+   $continueEditing = '' 
.
+   '[[#' . self::EDITFORM_ID . '|' . 
$wgLang->getArrow() . ' ' .
+   wfMessage( 'continue-editing' )->text() . 
']]';
if ( $this->mTriedSave && !$this->mTokenOk ) {
if ( $this->mTokenOkExceptSuffix ) {
$note = wfMessage( 
'token_suffix_mismatch' )->plain();
@@ -3165,8 +3169,7 @@
} elseif ( $this->incompleteForm ) {
$note = wfMessage( 'edit_form_incomplete' 
)->plain();
} else {
-   $note = wfMessage( 'previewnote' )->plain() .
-   ' [[#' . self::EDITFORM_ID . '|' . 
$wgLang->getArrow() . ' ' . wfMessage( 'continue-editing' )->text() . ']]';
+   $note = wfMessage( 'previewnote' )->plain() . ' 
' . $continueEditing;
}
 
$parserOptions = $this->mArticle->makeParserOptions( 
$this->mArticle->getContext() );
@@ -3195,7 +3198,9 @@
# Used messages to make sure grep find them:
# Messages: usercsspreview, userjspreview, 
sitecsspreview, sitejspreview
if ( $level && $format ) {
-   $note = "" . wfMessage( "{$level}{$format}preview" 
)->text() . "";
+   $note = "" .
+   wfMessage( 
"{$level}{$format}preview" )->text() .
+   ' ' . $continueEditing . 
"";
}
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/85232
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3cbbf9c2ae23672c0939261f2675273f5923e5f9
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 
Gerrit-Reviewer: Brian Wolff 
Gerrit-Reviewer: Raimond Spekking 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Call setRelevantTitle during revision delete - change (mediawiki/core)

2013-11-16 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/95800


Change subject: Call setRelevantTitle during revision delete
..

Call setRelevantTitle during revision delete

This will make the header tabs be for the page being deleted,
like it is for Special:MovePage and friends.

Change-Id: I52d848ef0763f6691cec9192794e8e7e9d933ed2
---
M includes/specials/SpecialRevisiondelete.php
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/00/95800/1

diff --git a/includes/specials/SpecialRevisiondelete.php 
b/includes/specials/SpecialRevisiondelete.php
index 825be6c..87705a8 100644
--- a/includes/specials/SpecialRevisiondelete.php
+++ b/includes/specials/SpecialRevisiondelete.php
@@ -194,6 +194,9 @@
protected function showConvenienceLinks() {
# Give a link to the logs/hist for this page
if ( $this->targetObj ) {
+   // Also set header tabs to be for the target.
+   $this->getSkin()->setRelevantTitle( $this->targetObj );
+
$links = array();
$links[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'Log' ),

-- 
To view, visit https://gerrit.wikimedia.org/r/95800
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I52d848ef0763f6691cec9192794e8e7e9d933ed2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Show correct link color on cached result of Special:DeadendP... - change (mediawiki/core)

2013-11-16 Thread Brian Wolff (Code Review)
Brian Wolff has submitted this change and it was merged.

Change subject: Show correct link color on cached result of Special:DeadendPages
..


Show correct link color on cached result of Special:DeadendPages

Reaching this by doing a LinkBatch and than using
Linker::link instead of Linker::linkKnown.
This adds also the stub color to the link.

Bug: 56912
Change-Id: I516f95302546ccdf8d0fdc7101c2ff72daa5f2fb
---
M RELEASE-NOTES-1.23
M includes/PageQueryPage.php
2 files changed, 24 insertions(+), 1 deletion(-)

Approvals:
  Brian Wolff: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23
index d7c252a..c5791ba 100644
--- a/RELEASE-NOTES-1.23
+++ b/RELEASE-NOTES-1.23
@@ -51,6 +51,7 @@
   behavior of several other features where (bogus) section edit links will
   disappear, such as file description pages loaded via $wgUseInstantCommons or
   pages transcluded cross-wiki via $wgEnableScaryTranscluding.
+* (bug 56912) Show correct link color on cached result of Special:DeadendPages.
 
 === API changes in 1.23 ===
 * (bug 54884) action=parse&prop=categories now indicates hidden and missing
diff --git a/includes/PageQueryPage.php b/includes/PageQueryPage.php
index 61a535d..02a883a 100644
--- a/includes/PageQueryPage.php
+++ b/includes/PageQueryPage.php
@@ -28,6 +28,28 @@
  */
 abstract class PageQueryPage extends QueryPage {
/**
+* Run a LinkBatch to pre-cache LinkCache information,
+* like page existence and information for stub color and redirect 
hints.
+* This should be done for live data and cached data.
+*
+* @param $db DatabaseBase connection
+* @param ResultWrapper $res
+*/
+   public function preprocessResults( $db, $res ) {
+   if ( !$res->numRows() ) {
+   return;
+   }
+
+   $batch = new LinkBatch();
+   foreach ( $res as $row ) {
+   $batch->add( $row->namespace, $row->title );
+   }
+   $batch->execute();
+
+   $res->seek( 0 );
+   }
+
+   /**
 * Format the result as a simple link to the page
 *
 * @param Skin $skin
@@ -41,7 +63,7 @@
 
if ( $title instanceof Title ) {
$text = $wgContLang->convert( $title->getPrefixedText() 
);
-   return Linker::linkKnown( $title, htmlspecialchars( 
$text ) );
+   return Linker::link( $title, htmlspecialchars( $text ) 
);
} else {
return Html::element( 'span', array( 'class' => 
'mw-invalidtitle' ),
Linker::getInvalidTitleDescription( 
$this->getContext(), $row->namespace, $row->title ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/95790
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I516f95302546ccdf8d0fdc7101c2ff72daa5f2fb
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender 
Gerrit-Reviewer: Brian Wolff 
Gerrit-Reviewer: IAlex 
Gerrit-Reviewer: Umherirrender 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Use master db for showing log extract on RevDel success page - change (mediawiki/core)

2013-11-16 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/95828


Change subject: Use master db for showing log extract on RevDel success page
..

Use master db for showing log extract on RevDel success page

On revision delete success, we show an excerpt from the log,
it is very confusing when that excerpt doesn't include the
action that you just did.

Bug: 57033
Change-Id: Ica79bf76243f7ab7a2a0fb40689c34bd2ffc0297
---
M includes/logging/LogEventsList.php
M includes/specials/SpecialRevisiondelete.php
2 files changed, 23 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/28/95828/1

diff --git a/includes/logging/LogEventsList.php 
b/includes/logging/LogEventsList.php
index c27b57a..cbc3a5a 100644
--- a/includes/logging/LogEventsList.php
+++ b/includes/logging/LogEventsList.php
@@ -466,6 +466,7 @@
 * - wrap String Wrap the message in html (usually something like "$1").
 * - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS)
 * - useRequestParams boolean Set true to use Pager-related parameters 
in the WebRequest
+* - useMaster boolean Use master DB
 * @return Integer Number of total log items (not limited by $lim)
 */
public static function showLogExtract(
@@ -479,6 +480,7 @@
'wrap' => "$1",
'flags' => 0,
'useRequestParams' => false,
+   'useMaster' => false,
);
# The + operator appends elements of remaining keys from the 
right
# handed array to the left handed, whereas duplicated keys are 
NOT overwritten.
@@ -511,6 +513,9 @@
$pager->mOffset = "";
$pager->mIsBackwards = false;
}
+   if ( $param['useMaster'] ) {
+   $pager->mDb = wfGetDB( DB_MASTER );
+   }
if ( isset( $param['offset'] ) ) { # Tell pager to ignore 
WebRequest offset
$pager->setOffset( $param['offset'] );
}
diff --git a/includes/specials/SpecialRevisiondelete.php 
b/includes/specials/SpecialRevisiondelete.php
index 87705a8..294735c 100644
--- a/includes/specials/SpecialRevisiondelete.php
+++ b/includes/specials/SpecialRevisiondelete.php
@@ -55,6 +55,9 @@
/** The RevDel_List object, storing the list of items to be 
deleted/undeleted */
var $list;
 
+   /** Was the DB modified in this request */
+   protected $wasSaved = false;
+
/**
 * UI labels for each type.
 */
@@ -177,14 +180,24 @@
# Show relevant lines from the deletion log
$deleteLogPage = new LogPage( 'delete' );
$output->addHTML( "" . $deleteLogPage->getName()->escaped() 
. "\n" );
-   LogEventsList::showLogExtract( $output, 'delete',
-   $this->targetObj, '', array( 'lim' => 25, 'conds' => 
$qc ) );
+   LogEventsList::showLogExtract(
+   $output,
+   'delete',
+   $this->targetObj,
+   '', /* user */
+   array( 'lim' => 25, 'conds' => $qc, 'useMaster' => 
$this->wasSaved )
+   );
# Show relevant lines from the suppression log
if ( $user->isAllowed( 'suppressionlog' ) ) {
$suppressLogPage = new LogPage( 'suppress' );
$output->addHTML( "" . 
$suppressLogPage->getName()->escaped() . "\n" );
-   LogEventsList::showLogExtract( $output, 'suppress',
-   $this->targetObj, '', array( 'lim' => 25, 
'conds' => $qc ) );
+   LogEventsList::showLogExtract(
+   $output,
+   'suppress',
+   $this->targetObj,
+   '',
+   array( 'lim' => 25, 'conds' => $qc, 'useMaster' 
=> $this->wasSaved )
+   );
}
}
 
@@ -523,6 +536,7 @@
protected function success() {
$this->getOutput()->setPageTitle( $this->msg( 'actioncomplete' 
) );
$this->getOutput()->wrapWikiMsg( "\n$1\n", $this->typeLabels['success'] );
+   $this->wasSaved = true;
$this->list->reloadFromMaster();
$this->showForm();
}

-- 
To view, visit https://gerrit.wikimedia.org/r/95828
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica79bf76243f7ab7a2a0fb40689c34bd2ffc0297
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___

[MediaWiki-commits] [Gerrit] Don't use API to fetch alternate poster sizes - change (mediawiki...TimedMediaHandler)

2013-11-21 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/96932


Change subject: Don't use API to fetch alternate poster sizes
..

Don't use API to fetch alternate poster sizes

Kind of weird to fetch it so indirectly.
Also appearently causes problems with certain maintenance
scripts when running on private wikis.

Note: TimedText still accesses the API internally. I do not
know if that would affect maintenance scripts.

Bug: 54394
Change-Id: I32b933035d76d44854c2839d727061ae41c5dc30
---
M TimedMediaTransformOutput.php
1 file changed, 16 insertions(+), 25 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/32/96932/1

diff --git a/TimedMediaTransformOutput.php b/TimedMediaTransformOutput.php
index a82772e..ad96801 100644
--- a/TimedMediaTransformOutput.php
+++ b/TimedMediaTransformOutput.php
@@ -55,7 +55,7 @@
// Update the $posterUrl to $sizeOverride ( if not an 
old file )
if( !$this->file->isOld() && $sizeOverride &&
$sizeOverride[0] && intval( $sizeOverride[0] ) 
!= intval( $this->width ) ){
-   $apiUrl = $this->getPosterFromApi( 
$sizeOverride[0] );
+   $apiUrl = $this->getPoster( $sizeOverride[0] );
if( $apiUrl ){
$url = $apiUrl;
}
@@ -265,32 +265,23 @@
}
 
/**
-* Get a poster image from the api
-* @param $width Number, the width of the requested image
-* @return bool
+* Get poster.
+* @param $width Integer width of poster. Should not equal $this->width.
+* @throws MWException If $width is same as $this->width.
+* @return String|bool url for poster or false
 */
-   function getPosterFromApi ( $width ){
-   // The media system is ~kind of~ strange. ( how do we get an 
alternate sized thumb url? )
-   // without going into some crazy object cloning or handler 
lookups path of least resistance,
-   // seems to just do an inline FauxRequest:
-   $params = new FauxRequest( array(
-   'action' => 'query',
-   'prop' => 'imageinfo',
-   'iiprop' => 'url',
-   'iiurlwidth' => intval( $width ),
-   'titles' => $this->file->getTitle()->getPrefixedDBkey()
-   ) );
-   $api = new ApiMain( $params );
-   $api->execute();
-   $data = $api->getResultData();
-   if( isset( $data['query'] ) && isset( $data['query']['pages'] ) 
){
-   $page = current( $data['query']['pages'] );
-   if( isset( $page['imageinfo'] ) && isset( 
$page['imageinfo'][0]['thumburl'] ) ){
-   return $page['imageinfo'][0]['thumburl'];
-   }
+   function getPoster ( $width ) {
+   if ( intval( $width ) === intval( $this->width ) ) {
+   // Prevent potential loop
+   throw new MWException( "Asked for poster in current 
size. Potential loop." );
}
-   return false;
-   // no posterUrl found ( but its oky we still have the poster 
form $this->getUrl() )
+   $params = array( "width" => intval( $this->width ) );
+   $mto = $this->file->transform( $params );
+   if ( $mto ) {
+   return $mto->getUrl();
+   } else {
+   return false;
+   }
}
 
/**

-- 
To view, visit https://gerrit.wikimedia.org/r/96932
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I32b933035d76d44854c2839d727061ae41c5dc30
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Remove some of the permissions so they can be configured per... - change (mediawiki...GWToolset)

2013-12-17 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/102343


Change subject: Remove some of the permissions so they can be configured 
per-wiki
..

Remove some of the permissions so they can be configured per-wiki

Previously this auto-added 'gwtoolset' right to admins, and made
it so admins could add/remove the gwtoolset group.

Instead, only make the gwtoolset group. Let the configuration for
if additional groups get the right, and which groups can add that
right must be specified in the individual wikis config.

After this change is merged, the configuration on commons will
have to be changed.

Change-Id: I4d9097e59dd91a104f1e3ac4c1dd543d3a37c9f9
---
M GWToolset.php
1 file changed, 0 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GWToolset 
refs/changes/43/102343/1

diff --git a/GWToolset.php b/GWToolset.php
index 330a842..f3875be 100644
--- a/GWToolset.php
+++ b/GWToolset.php
@@ -48,11 +48,6 @@
 // add user permissions
 $wgGroupPermissions["gwtoolset"]["gwtoolset"] = true;
 $wgGroupPermissions["gwtoolset"]["upload_by_url"] = true;
-$wgGroupPermissions['sysop']['gwtoolset'] = true;
-
-// make sure sysop can add/remove gwtoolset group
-$wgAddGroups['sysop'][] = 'gwtoolset';
-$wgRemoveGroups['sysop'][] = 'gwtoolset';
 
 // add autoloader classes
 $wgAutoloadClasses = $wgAutoloadClasses + array(

-- 
To view, visit https://gerrit.wikimedia.org/r/102343
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d9097e59dd91a104f1e3ac4c1dd543d3a37c9f9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GWToolset
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Have gwtoolset assignable by crats - change (operations/mediawiki-config)

2013-12-17 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/102347


Change subject: Have gwtoolset assignable by crats
..

Have gwtoolset assignable by crats

Change-Id: I33c68abb10517cb871956b25603920c3785f8762
Follow-up: 102343
Bug: 58607
---
M wmf-config/CommonSettings.php
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/47/102347/1

diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php
index 76823ea..c9c44c3 100644
--- a/wmf-config/CommonSettings.php
+++ b/wmf-config/CommonSettings.php
@@ -1807,6 +1807,9 @@
$wgJobTypesExcludedFromDefaultQueue[] = 'gwtoolsetUploadMediafileJob';
$wgJobTypesExcludedFromDefaultQueue[] = 
'gwtoolsetGWTFileBackendCleanupJob';
$wgJobTypeConf['gwtoolsetUploadMetadataJob'] = array( 'checkDelay' => 
true ) + $wgJobTypeConf['default'];
+
+   $wgAddGroups['bureaucrat'][] = 'gwtoolset';
+   $wgRemoveGroups['bureaucrat'][] = 'gwtoolset';
 }
 
 if ( $wmgUseMultimediaViewer ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/102347
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I33c68abb10517cb871956b25603920c3785f8762
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Don't require midi output in raw mode if not linking to it - change (mediawiki...Score)

2013-12-17 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/102367


Change subject: Don't require midi output in raw mode if not linking to it
..

Don't require midi output in raw mode if not linking to it

This lets people make 's without midi blocks in raw mode
if we're not using the audio file.

Change-Id: I6a0a239b6feb82e36c2049c35ce8973eb78c152b
---
M Score.body.php
1 file changed, 39 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Score 
refs/changes/67/102367/1

diff --git a/Score.body.php b/Score.body.php
index 473db9e..13d8241 100644
--- a/Score.body.php
+++ b/Score.body.php
@@ -286,21 +286,6 @@
// Raw rendering?
$options['raw'] = array_key_exists( 'raw', $args );
 
-   // Input for cache key
-   $cacheOptions = array(
-   'code' => $code,
-   'lang' => $options['lang'],
-   'raw'  => $options['raw'],
-   );
-
-   /* image file path and URL prefixes */
-   $imageCacheName = wfBaseConvert( sha1( serialize( 
$cacheOptions ) ), 16, 36, 31 );
-   $imagePrefixEnd = "{$imageCacheName[0]}/" .
-   "{$imageCacheName[1]}/$imageCacheName";
-   $options['dest_storage_path'] = 
"$baseStoragePath/$imagePrefixEnd";
-   $options['dest_url'] = "$baseUrl/$imagePrefixEnd";
-   $options['file_name_prefix'] = substr( $imageCacheName, 
0, 8 );
-
/* Midi linking? */
if ( array_key_exists( 'midi', $args ) ) {
$options['link_midi'] = $args['midi'];
@@ -339,6 +324,27 @@
if ( $options['generate_ogg'] && ( 
$options['override_ogg'] !== false ) ) {
throw new ScoreException( wfMessage( 
'score-vorbisoverrideogg' ) );
}
+
+   // Input for cache key
+   $cacheOptions = array(
+   'code' => $code,
+   'lang' => $options['lang'],
+   'raw'  => $options['raw'],
+   );
+   // Doing this separately to not invalidate too many 
existing keys.
+   if ( $options['raw'] && ( $options['generate_ogg']
+   || ( $options['link_midi'] && 
!$options['override_midi'] )
+   ) ) {
+   $cacheOptions['rawAndMidi'] = true;
+   }
+
+   /* image file path and URL prefixes */
+   $imageCacheName = wfBaseConvert( sha1( serialize( 
$cacheOptions ) ), 16, 36, 31 );
+   $imagePrefixEnd = "{$imageCacheName[0]}/" .
+   "{$imageCacheName[1]}/$imageCacheName";
+   $options['dest_storage_path'] = 
"$baseStoragePath/$imagePrefixEnd";
+   $options['dest_url'] = "$baseUrl/$imagePrefixEnd";
+   $options['file_name_prefix'] = substr( $imageCacheName, 
0, 8 );
 
$html = self::generateHTML( $parser, $code, $options );
} catch ( ScoreException $e ) {
@@ -628,8 +634,14 @@
$output .= "\nexited with status: " . $rc2;
self::throwCallException( wfMessage( 
'score-compilererr' ), $output, $options['factory_directory'] );
}
-   if ( !file_exists( $factoryMidi ) ) {
-   throw new ScoreException( wfMessage( 'score-nomidi' ) );
+   $needMidi = false;
+   if ( !$options['raw'] ||
+   ( $options['generate_ogg'] || ( $options['link_midi'] 
&& !$options['override_midi'] ) )
+   ) {
+   $needMidi = true;
+   if ( !file_exists( $factoryMidi ) ) {
+   throw new ScoreException( wfMessage( 
'score-nomidi' ) );
+   }
}
 
/* trim output images if wanted */
@@ -660,14 +672,16 @@
// Backend operation batch
$ops = array();
 
-   // Add the MIDI file to the batch
-   $ops[] = array(
-   'op' => 'store',
-   'src' => $factoryMidi,
-   'dst' => 
"{$options['dest_storage_path']}/{$options['file_name_prefix']}.midi" );
-   $newFiles["{$options['file_name_prefix']}.midi"] = true;
-   if ( !$status->isOK() ) {
-   throw new ScoreException( wfMessage( 
'score-backend-error', $status->getW

[MediaWiki-commits] [Gerrit] Change location of period in img-lang-info - change (mediawiki/core)

2013-12-18 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/102556


Change subject: Change location of period in img-lang-info
..

Change location of period in img-lang-info

Per 
https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Img-lang-info/cy/reply_(3)

Change-Id: I81441e10083a610464380a009fa467bdd5c40cc0
---
M languages/messages/MessagesEn.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/56/102556/1

diff --git a/languages/messages/MessagesEn.php 
b/languages/messages/MessagesEn.php
index 23b989a..a4c2056 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -4623,7 +4623,7 @@
 
 'img-lang-opt' => '$2 ($1)',
 'img-lang-default' => '(default language)',
-'img-lang-info' => 'Render this image in $1 $2.',
+'img-lang-info' => 'Render this image in $1. $2',
 'img-lang-go' => 'Go',
 
 # Table pager

-- 
To view, visit https://gerrit.wikimedia.org/r/102556
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I81441e10083a610464380a009fa467bdd5c40cc0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Make the warning from TextContent::__construct show caller. - change (mediawiki/core)

2013-12-19 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/102885


Change subject: Make the warning from TextContent::__construct show caller.
..

Make the warning from TextContent::__construct show caller.

Having the warning point to itself isn't very useful.

Bug: 44898
Change-Id: Ia3e73477d323d17c9e97c2dd863255cc2e191f7f
---
M includes/content/TextContent.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/85/102885/1

diff --git a/includes/content/TextContent.php b/includes/content/TextContent.php
index ffb5cf2..068b150 100644
--- a/includes/content/TextContent.php
+++ b/includes/content/TextContent.php
@@ -38,7 +38,7 @@
 
if ( $text === null || $text === false ) {
wfWarn( "TextContent constructed with \$text = " . 
var_export( $text, true ) . "! "
-   . "This may indicate an error in the caller's 
scope." );
+   . "This may indicate an error in the caller's 
scope.", 2 );
 
$text = '';
}

-- 
To view, visit https://gerrit.wikimedia.org/r/102885
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia3e73477d323d17c9e97c2dd863255cc2e191f7f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Clear Squid/Varnish cache on transcode delete and creation. - change (mediawiki...TimedMediaHandler)

2013-12-20 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/103084


Change subject: Clear Squid/Varnish cache on transcode delete and creation.
..

Clear Squid/Varnish cache on transcode delete and creation.

Bug: 58733
Change-Id: I5dc854ee48ba6eb694f4d1eeaace7bbb18af84b0
---
M WebVideoTranscode/WebVideoTranscode.php
M WebVideoTranscode/WebVideoTranscodeJob.php
2 files changed, 7 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/84/103084/1

diff --git a/WebVideoTranscode/WebVideoTranscode.php 
b/WebVideoTranscode/WebVideoTranscode.php
index 7eb1eef..a1a6d86 100644
--- a/WebVideoTranscode/WebVideoTranscode.php
+++ b/WebVideoTranscode/WebVideoTranscode.php
@@ -617,7 +617,9 @@
}
 
// Remove files by key:
-   foreach( $removeKeys as $tKey){
+   $urlsToPurge = array();
+   foreach ( $removeKeys as $tKey ) {
+   $urlsToPurge[] = $file->getTranscodedUrl( 
$file->getName() . '.' . $tKey );
$filePath = self::getDerivativeFilePath( $file, $tKey );
if( $file->repo->fileExists( $filePath ) ){
wfSuppressWarnings();
@@ -629,6 +631,8 @@
}
}
 
+   SquidUpdate::purge( $urlsToPurge );
+
// Build the sql query:
$dbw = wfGetDB( DB_MASTER );
$deleteWhere = array( 'transcode_image_name' => 
$file->getName() );
diff --git a/WebVideoTranscode/WebVideoTranscodeJob.php 
b/WebVideoTranscode/WebVideoTranscodeJob.php
index 19e63c4..49251c0 100644
--- a/WebVideoTranscode/WebVideoTranscodeJob.php
+++ b/WebVideoTranscode/WebVideoTranscodeJob.php
@@ -278,6 +278,8 @@
// Clear the webVideoTranscode cache ( so we don't keep out 
dated table cache around )
WebVideoTranscode::clearTranscodeCache( 
$this->title->getDBkey() );
 
+   SquidUpdate::purge( array( $file->getTranscodedUrl( 
$file->getName() . '.' . $transcodeKey ) ) );
+
if ($status !== true) {
$this->setLastError( $status );
}

-- 
To view, visit https://gerrit.wikimedia.org/r/103084
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5dc854ee48ba6eb694f4d1eeaace7bbb18af84b0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Make Language::fetchLanguageName lowercase its first argument. - change (mediawiki/core)

2013-12-21 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/103189


Change subject: Make Language::fetchLanguageName lowercase its first argument.
..

Make Language::fetchLanguageName lowercase its first argument.

Currently Language::fetchLanguageName( 'en-GB' ) returns false as
it expects 'en-gb'. Given that technically speaking, 'en-GB'
is the canonical form, I don't think this is a good thing.

Changed function to lowercase its argument. There's no
Language object handy, so I just used strtolower (since language
codes are always ascii, that shouldn't matter)

Change-Id: Iba1f581bf2d6d2b26a14f9f80699d8eeb5d724d6
---
M languages/Language.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/89/103189/1

diff --git a/languages/Language.php b/languages/Language.php
index 0026fdf..23506e9 100644
--- a/languages/Language.php
+++ b/languages/Language.php
@@ -929,6 +929,7 @@
 * @since 1.20
 */
public static function fetchLanguageName( $code, $inLanguage = null, 
$include = 'all' ) {
+   $code = strtolower( $code );
$array = self::fetchLanguageNames( $inLanguage, $include );
return !array_key_exists( $code, $array ) ? '' : $array[$code];
}

-- 
To view, visit https://gerrit.wikimedia.org/r/103189
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba1f581bf2d6d2b26a14f9f80699d8eeb5d724d6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] getDescription must return a string, not a message object. - change (mediawiki...TwoFactorAuthentication)

2013-12-23 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/103527


Change subject: getDescription must return a string, not a message object.
..

getDescription must return a string, not a message object.

Probably causing issue described at:
https://www.mediawiki.org/wiki/Thread:Project:Support_desk/Special:SpecialPages_error

Change-Id: Ic1e6e537b0a1ce50ad1729d4ef93cf68aa2586b5
---
M SpecialTwoFactorAuth.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TwoFactorAuthentication 
refs/changes/27/103527/1

diff --git a/SpecialTwoFactorAuth.php b/SpecialTwoFactorAuth.php
index ba88f88..2035b20 100644
--- a/SpecialTwoFactorAuth.php
+++ b/SpecialTwoFactorAuth.php
@@ -78,10 +78,10 @@
/**
 * Get the description for this page. Depends on the action.
 *
-* @return Message
+* @return String
 */
function getDescription() {
-   return $this->msg( "twofactorauth-title-{$this->action}" );
+   return $this->msg( "twofactorauth-title-{$this->action}" 
)->text();
}
 
/**

-- 
To view, visit https://gerrit.wikimedia.org/r/103527
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic1e6e537b0a1ce50ad1729d4ef93cf68aa2586b5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TwoFactorAuthentication
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Clarify comment on SpecialPage::getDescription - change (mediawiki/core)

2013-12-23 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/103528


Change subject: Clarify comment on SpecialPage::getDescription
..

Clarify comment on SpecialPage::getDescription

* Remove mention of dynamically adding messages at runtime
(Not supported anymore)
* Mention that things break if this returns a Message object
(Specificly Special:SpecialPages. See Ic1e6e537b0)

Change-Id: I82500a6b12ffd1087211930ca62f6020caea32f7
---
M includes/specialpage/SpecialPage.php
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/28/103528/1

diff --git a/includes/specialpage/SpecialPage.php 
b/includes/specialpage/SpecialPage.php
index e874b3e..df3e29b 100644
--- a/includes/specialpage/SpecialPage.php
+++ b/includes/specialpage/SpecialPage.php
@@ -755,8 +755,10 @@
 * also the name that will be listed in Special:Specialpages
 *
 * Derived classes can override this, but usually it is easier to keep 
the
-* default behavior. Messages can be added at run-time, see
-* MessageCache.php.
+* default behavior. New messages can be added via an i18n file
+* using $wgExtensionMessagesFiles.
+*
+* @note Must return a string, not a Message object, or things break.
 *
 * @return String
 */

-- 
To view, visit https://gerrit.wikimedia.org/r/103528
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I82500a6b12ffd1087211930ca62f6020caea32f7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Don't include empty categories in Special:Mostlinkedcategories - change (mediawiki/core)

2013-12-26 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/103856


Change subject: Don't include empty categories in Special:Mostlinkedcategories
..

Don't include empty categories in Special:Mostlinkedcategories

We never delete things from the category table, so there are
entries in it with 0 members, which really shouldn't show up
on the special page.

Bug: 58967
Change-Id: I6bdf5a5196724f7970fb79497ef912cf8268ec3e
---
M includes/specials/SpecialMostlinkedcategories.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/56/103856/1

diff --git a/includes/specials/SpecialMostlinkedcategories.php 
b/includes/specials/SpecialMostlinkedcategories.php
index 0d4641b..f61a115 100644
--- a/includes/specials/SpecialMostlinkedcategories.php
+++ b/includes/specials/SpecialMostlinkedcategories.php
@@ -44,6 +44,7 @@
'fields' => array( 'title' => 'cat_title',
'namespace' => NS_CATEGORY,
'value' => 'cat_pages' ),
+   'conds' => array( 'cat_pages > 0' ),
);
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/103856
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6bdf5a5196724f7970fb79497ef912cf8268ec3e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] generalize BitmapHandler::logErrorForExternalProcess - change (mediawiki/core)

2013-12-06 Thread Brian Wolff (Code Review)
Brian Wolff has submitted this change and it was merged.

Change subject: generalize BitmapHandler::logErrorForExternalProcess
..


generalize BitmapHandler::logErrorForExternalProcess

BitmapHandler::logErrorForExternalProcess is a wrapper around
wfDebugLog( 'thumbnail' ). It got copy pasted from some other class at
one point.

This patch move the method up to general class MediaHandler and makes
other child class uses it.  The method will thus be available to
extensions such as TimedMediaHandler.

The reason I am doing that is that trim($err) generates a copy of $err
which causes a memory allocation fatal error whenever $err is larger
than the remaining memory allocatable.  The patch will let us fix the
bug by only altering one part of the code.

bug: 57985
Change-Id: I5657f07d6e2cca05d53f2a5c30ec23622c171343
---
M includes/media/Bitmap.php
M includes/media/DjVu.php
M includes/media/MediaHandler.php
M includes/media/SVG.php
4 files changed, 19 insertions(+), 20 deletions(-)

Approvals:
  Brian Wolff: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/media/Bitmap.php b/includes/media/Bitmap.php
index 6f7130d..804393a 100644
--- a/includes/media/Bitmap.php
+++ b/includes/media/Bitmap.php
@@ -496,19 +496,6 @@
}
 
/**
-* Log an error that occurred in an external process
-*
-* @param $retval int
-* @param $err int
-* @param $cmd string
-*/
-   protected function logErrorForExternalProcess( $retval, $err, $cmd ) {
-   wfDebugLog( 'thumbnail',
-   sprintf( 'thumbnail failed on %s: error %d "%s" from 
"%s"',
-   wfHostname(), $retval, trim( $err ), $cmd ) );
-   }
-
-   /**
 * Get a MediaTransformError with error 'thumbnail_error'
 *
 * @param array $params Parameter array as passed to the transform* 
functions
diff --git a/includes/media/DjVu.php b/includes/media/DjVu.php
index fe3313a..ae46b2e 100644
--- a/includes/media/DjVu.php
+++ b/includes/media/DjVu.php
@@ -195,10 +195,7 @@
 
$removed = $this->removeBadFile( $dstPath, $retval );
if ( $retval != 0 || $removed ) {
-   wfDebugLog( 'thumbnail',
-   sprintf( 'thumbnail failed on %s: error %d "%s" 
from "%s"',
-   wfHostname(), $retval, trim( $err ), 
$cmd ) );
-
+   $this->logErrorForExternalProcess( $retval, $err, $cmd 
);
return new MediaTransformError( 'thumbnail_error', 
$width, $height, $err );
} else {
$params = array(
diff --git a/includes/media/MediaHandler.php b/includes/media/MediaHandler.php
index f55e508..562de13 100644
--- a/includes/media/MediaHandler.php
+++ b/includes/media/MediaHandler.php
@@ -703,4 +703,21 @@
public function getRotation( $file ) {
return 0;
}
+
+   /**
+* Log an error that occurred in an external process
+*
+* Moved from BitmapHandler to MediaHandler with MediaWiki 1.23
+*
+* @since 1.23
+* @param $retval int
+* @param $err int
+* @param $cmd string
+*/
+   protected function logErrorForExternalProcess( $retval, $err, $cmd ) {
+   wfDebugLog( 'thumbnail',
+   sprintf( 'thumbnail failed on %s: error %d "%s" from 
"%s"',
+   wfHostname(), $retval, trim( $err ), 
$cmd ) );
+   }
+
 }
diff --git a/includes/media/SVG.php b/includes/media/SVG.php
index d06acd8..fef67f8 100644
--- a/includes/media/SVG.php
+++ b/includes/media/SVG.php
@@ -208,9 +208,7 @@
}
$removed = $this->removeBadFile( $dstPath, $retval );
if ( $retval != 0 || $removed ) {
-   wfDebugLog( 'thumbnail', sprintf( 'thumbnail failed on 
%s: error %d "%s" from "%s"',
-   wfHostname(), $retval, trim( $err ), $cmd ) );
-
+   $this->logErrorForExternalProcess( $retval, $err, $cmd 
);
return new MediaTransformError( 'thumbnail_error', 
$width, $height, $err );
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/99142
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5657f07d6e2cca05d53f2a5c30ec23622c171343
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Hashar 
Gerrit-Reviewer: Aaron Schulz 
Gerrit-Reviewer: Bartosz Dziewoński 
Gerrit-Reviewer: Brian Wolff 
Gerrit-Reviewer: Gergő Tisza 
Gerrit-Reviewer: Hashar 
Gerrit-Reviewer: J 
Gerrit-Reviewer: Tpt 
Gerrit-Reviewer: Umherirrender 
Gerrit-Reviewer: btongminh 
Gerrit-Reviewer: jenkins-bot

___
MediaWik

[MediaWiki-commits] [Gerrit] Fix text extraction on DjVu so that it works beyond first call. - change (mediawiki/core)

2013-12-06 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/99696


Change subject: Fix text extraction on DjVu so that it works beyond first call.
..

Fix text extraction on DjVu so that it works beyond first call.

This was caching the metadata tree in-process, but it was
returning this cache even for calls for things other then this
item.

As a result, if you did $file->getHandler()->getPageText( $file, 2 )
twice in a single request, the second time it would return false.

Change-Id: I6ee4dce3177c0898e98210d7471cfadc1108ca52
---
M includes/media/DjVu.php
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/96/99696/1

diff --git a/includes/media/DjVu.php b/includes/media/DjVu.php
index ae46b2e..cbb3ec2 100644
--- a/includes/media/DjVu.php
+++ b/includes/media/DjVu.php
@@ -232,7 +232,10 @@
 * @return bool
 */
function getMetaTree( $image, $gettext = false ) {
-   if ( isset( $image->dejaMetaTree ) ) {
+   if ( $gettext && isset( $image->djvuTextTree ) ) {
+   return $image->djvuTextTree;
+   }
+   if ( !$gettext && isset( $image->dejaMetaTree ) ) {
return $image->dejaMetaTree;
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/99696
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ee4dce3177c0898e98210d7471cfadc1108ca52
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Normalize newlines in DjVu text-layer metadata. - change (mediawiki/core)

2013-12-06 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/99710


Change subject: Normalize newlines in DjVu text-layer metadata.
..

Normalize newlines in DjVu text-layer metadata.

Currently, newlines in DjVu text layer are stored as the literal
string '\n'. Its up to the consumer to unescape that into
a real newline. Other formats like pdfs return newlines
as an actual \n character when getPageText() is called.
I think getPageText() should not require callers to do this.

Change-Id: Ie1a438bbce5444c53ff6b7b3aaf2b5267ba3c8b4
---
M includes/media/DjVuImage.php
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/10/99710/1

diff --git a/includes/media/DjVuImage.php b/includes/media/DjVuImage.php
index 9bfc378..458be95 100644
--- a/includes/media/DjVuImage.php
+++ b/includes/media/DjVuImage.php
@@ -306,7 +306,8 @@
 
function pageTextCallback( $matches ) {
# Get rid of invalid UTF-8, strip control characters
-   return '';
+   $val = htmlspecialchars( UtfNormal::cleanUp( $matches[1] ) );
+   return '';
}
 
/**

-- 
To view, visit https://gerrit.wikimedia.org/r/99710
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie1a438bbce5444c53ff6b7b3aaf2b5267ba3c8b4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add method to get entire text layer. This could be useful fo... - change (mediawiki/core)

2013-12-06 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/99715


Change subject: Add method to get entire text layer. This could be useful for 
search
..

Add method to get entire text layer. This could be useful for search

Change-Id: I22f5fc47aef3cf362cdf630980deea48fe531d45
---
M includes/media/MediaHandler.php
1 file changed, 25 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/15/99715/1

diff --git a/includes/media/MediaHandler.php b/includes/media/MediaHandler.php
index 562de13..85f7976 100644
--- a/includes/media/MediaHandler.php
+++ b/includes/media/MediaHandler.php
@@ -402,13 +402,37 @@
/**
 * Generic getter for text layer.
 * Currently overloaded by PDF and DjVu handlers
-* @return bool
+* @return bool|string false if unsupported
 */
function getPageText( $image, $page ) {
return false;
}
 
/**
+* Get the text of the entire document.
+* @param File $file
+* @return bool|string The text of the document or false
+*/
+   public function getEntireText( File $file ) {
+   $numPages = $file->pageCount();
+   if ( !$numPages ) {
+   // Not a multipage document
+   return $this->getPageText( $file, 1 );
+   }
+   $document = '';
+   for( $i = 1; $i <= $numPages; $i++ ) {
+   $curPage = $this->getPageText( $file, $i );
+   if ( is_string( $curPage ) ) {
+   $document .= $curPage . "\n";
+   }
+   }
+   if ( $document !== '' ) {
+   return $document;
+   }
+   return false;
+   }
+
+   /**
 * Get an array structure that looks like this:
 *
 * array(

-- 
To view, visit https://gerrit.wikimedia.org/r/99715
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I22f5fc47aef3cf362cdf630980deea48fe531d45
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix SvgHandler::getScriptParams to not give warnings. - change (mediawiki/core)

2013-12-06 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/99769


Change subject: Fix SvgHandler::getScriptParams to not give warnings.
..

Fix SvgHandler::getScriptParams to not give warnings.

Change-Id: I664e4667bdcff89c1c5ee01a11b723a36212a57f
---
M includes/media/SVG.php
1 file changed, 6 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/69/99769/1

diff --git a/includes/media/SVG.php b/includes/media/SVG.php
index 6864de4..1a7d141 100644
--- a/includes/media/SVG.php
+++ b/includes/media/SVG.php
@@ -445,10 +445,12 @@
 * @return array
 */
function getScriptParams( $params ) {
-   return array(
-   'width' => $params['width'],
-   'lang' => $params['lang'],
-   );
+   $scriptParams = array( 'width' => $params['width'] );
+   if ( isset( $params['lang'] ) ) {
+   $scriptParams['lang'] = $params['lang'];
+   }
+
+   return $scriptParams;
}
 
public function getCommonMetaArray( File $file ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/99769
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I664e4667bdcff89c1c5ee01a11b723a36212a57f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add $context to the ArticleFromTitle hook - change (mediawiki/core)

2013-12-11 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/100906


Change subject: Add $context to the ArticleFromTitle hook
..

Add $context to the ArticleFromTitle hook

Most of the time people wouldn't need this - this hook is mostly
used to inject a custom Article subclass for a specific
namespace to do fancy things, but lets give users the most
flexibility.

Asked for by leaves on irc.

Change-Id: I3386ff4abe0e5b3eb783604ae222b7703428db44
---
M docs/hooks.txt
M includes/Article.php
2 files changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/06/100906/1

diff --git a/docs/hooks.txt b/docs/hooks.txt
index e3387b5..56c244d 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -526,6 +526,7 @@
 Wiki::articleFromTitle().
 $title: Title (object) used to create the article object
 $article: Article (object) that will be returned
+$context: IContextSource (object)
 
 'ArticleInsertComplete': After a new article is created. DEPRECATED, use
 PageContentInsertComplete.
diff --git a/includes/Article.php b/includes/Article.php
index 821c32e..b7cb5d6 100644
--- a/includes/Article.php
+++ b/includes/Article.php
@@ -158,7 +158,7 @@
}
 
$page = null;
-   wfRunHooks( 'ArticleFromTitle', array( &$title, &$page ) );
+   wfRunHooks( 'ArticleFromTitle', array( &$title, &$page, 
$context ) );
if ( !$page ) {
switch ( $title->getNamespace() ) {
case NS_FILE:

-- 
To view, visit https://gerrit.wikimedia.org/r/100906
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3386ff4abe0e5b3eb783604ae222b7703428db44
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Always give sane output for Title::getUserCaseDBkey() - change (mediawiki/core)

2013-12-11 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/100917


Change subject: Always give sane output for Title::getUserCaseDBkey()
..

Always give sane output for Title::getUserCaseDBkey()

Sometimes (e.g. via Title::makeTitle), the usercase db key is
not set. If that happens we should fallback to the normal db key.

This fixes file redirects on repos where initialCapital is set
to false.

Change-Id: I38bc4ebeb41b06f5c718cf5f64da158e6c1a9f49
---
M includes/Title.php
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/17/100917/1

diff --git a/includes/Title.php b/includes/Title.php
index a949ac3..924027e 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -769,7 +769,12 @@
 * @return String DB key
 */
function getUserCaseDBKey() {
-   return $this->mUserCaseDBKey;
+   if ( !is_null( $this->mUserCaseDBKey ) ) {
+   return $this->mUserCaseDBKey;
+   } else {
+   // If created via makeTitle(), $this->mUserCaseDBKey is 
not set.
+   return $this->mDbkeyform;
+   }
}
 
/**

-- 
To view, visit https://gerrit.wikimedia.org/r/100917
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I38bc4ebeb41b06f5c718cf5f64da158e6c1a9f49
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [WIP] Make API follow file redirects like normal redirects - change (mediawiki/core)

2013-12-11 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/100921


Change subject: [WIP] Make API follow file redirects like normal redirects
..

[WIP] Make API follow file redirects like normal redirects

Still have to optimize this so it doesn't request each
redirect individually, and just generally fix redirect
handling in ForeignAPIRepo.

Bug: 45930
Change-Id: I9eb0fe4e1ba43ab52e80c774df33e5d16dff604f
---
M includes/api/ApiPageSet.php
M includes/api/ApiQueryImageInfo.php
M includes/filerepo/FileRepo.php
M includes/filerepo/RepoGroup.php
4 files changed, 106 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/21/100921/1

diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php
index e95e680..18d2c09 100644
--- a/includes/api/ApiPageSet.php
+++ b/includes/api/ApiPageSet.php
@@ -63,6 +63,7 @@
private $mNormalizedTitles = array();
private $mInterwikiTitles = array();
private $mPendingRedirectIDs = array();
+   private $mPendingForeignFileRedirectIDs = array();
private $mConvertedTitles = array();
private $mGoodRevIDs = array();
private $mMissingRevIDs = array();
@@ -742,7 +743,11 @@
foreach ( array_keys( $dbkeys ) as 
$dbkey ) {
$title = Title::makeTitle( $ns, 
$dbkey );
$this->mAllPages[$ns][$dbkey] = 
$this->mFakePageId;
-   
$this->mMissingTitles[$this->mFakePageId] = $title;
+   if ( $this->mResolveRedirects 
&& $ns === NS_FILE ) {
+   
$this->mPendingForeignFileRedirectIDs[$this->mFakePageId] = $title;
+   } else {
+   
$this->mMissingTitles[$this->mFakePageId] = $title;
+   }
$this->mFakePageId--;
$this->mTitles[] = $title;
 
@@ -820,10 +825,11 @@
 
// Repeat until all redirects have been resolved
// The infinite loop is prevented by keeping all known 
pages in $this->mAllPages
-   while ( $this->mPendingRedirectIDs ) {
+   while ( $this->mPendingRedirectIDs || 
$this->mPendingForeignFileRedirectIDs ) {
// Resolve redirects by querying the pagelinks 
table, and repeat the process
// Create a new linkBatch object for the next 
pass
$linkBatch = $this->getRedirectTargets();
+   $this->getForeignFileRedirects( $linkBatch );
 
if ( $linkBatch->isEmpty() ) {
break;
@@ -855,6 +861,10 @@
private function getRedirectTargets() {
$lb = new LinkBatch();
$db = $this->getDB();
+
+   if ( !$this->mPendingRedirectIDs ) {
+   return $lb;
+   }
 
$this->profileDBIn();
$res = $db->select(
@@ -905,6 +915,38 @@
}
 
/**
+* Retrieve foreign file redirects.
+*
+* Only pages that do not exist locally and in NS_FILE are considered.
+*
+* @param LinkBatch $lb
+* @return LinkBatch
+*/
+   private function getForeignFileRedirects( LinkBatch &$lb ) {
+   $lb = new LinkBatch();
+   $repo = RepoGroup::singleton();
+   $redirectsToCheck = array_values( 
$this->mPendingForeignFileRedirectIDs );
+
+   $redirectResults = $repo->checkRedirects( $redirectsToCheck );
+
+   foreach( $this->mPendingForeignFileRedirectIDs as $fakeId => 
$title ) {
+   $target = $redirectResults[$title->getDBKey()];
+   if ( $target ) {
+   if ( !isset( 
$this->mAllPages[$target->getNamespace()][$target->getDBKey()] ) ) {
+   $lb->add( $target->getNamespace(), 
$target->getDBKey() );
+   }
+   
$this->mRedirectTitles[$title->getPrefixedText()] = $target;
+   unset( 
$this->mPendingForeignFileRedirectIDs[$fakeId] );
+   } else {
+   $this->mMissingTitles[$fakeId] = $title;
+   unset( 
$this->mPendingForeignFileRedirectIDs[$fakeId] );
+   }
+   }
+
+   return $lb;
+   }
+
+   /**
 * Get the cache mode for

[MediaWiki-commits] [Gerrit] Avoid calling protected File field - change (mediawiki/core)

2013-12-12 Thread Brian Wolff (Code Review)
Brian Wolff has submitted this change and it was merged.

Change subject: Avoid calling protected File field
..


Avoid calling protected File field

bug: 58333
Change-Id: I0bd4a5fe9687c4261ca0f57e30f723e8bf2589ac
---
M includes/revisiondelete/RevisionDelete.php
1 file changed, 4 insertions(+), 3 deletions(-)

Approvals:
  Brian Wolff: Looks good to me, approved



diff --git a/includes/revisiondelete/RevisionDelete.php 
b/includes/revisiondelete/RevisionDelete.php
index 7185087..0c887e4 100644
--- a/includes/revisiondelete/RevisionDelete.php
+++ b/includes/revisiondelete/RevisionDelete.php
@@ -669,8 +669,9 @@
 */
protected function getUserTools() {
if ( $this->file->userCan( Revision::DELETED_USER, 
$this->list->getUser() ) ) {
-   $link = Linker::userLink( $this->file->user, 
$this->file->user_text ) .
-   Linker::userToolLinks( $this->file->user, 
$this->file->user_text );
+   $uid = $this->file->getUser( 'id' );
+   $name = $this->file->getUser( 'text' );
+   $link = Linker::userLink( $uid, $name ) . 
Linker::userToolLinks( $uid, $name );
} else {
$link = $this->list->msg( 'rev-deleted-user' 
)->escaped();
}
@@ -688,7 +689,7 @@
 */
protected function getComment() {
if ( $this->file->userCan( File::DELETED_COMMENT, 
$this->list->getUser() ) ) {
-   $block = Linker::commentBlock( $this->file->description 
);
+   $block = Linker::commentBlock( 
$this->file->getDescription() );
} else {
$block = ' ' . $this->list->msg( 'rev-deleted-comment' 
)->escaped();
}

-- 
To view, visit https://gerrit.wikimedia.org/r/100825
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0bd4a5fe9687c4261ca0f57e30f723e8bf2589ac
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Brian Wolff 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix inconsistency in ArchivedFile::getUser - change (mediawiki/core)

2013-12-12 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/101038


Change subject: Fix inconsistency in ArchivedFile::getUser
..

Fix inconsistency in ArchivedFile::getUser

It was returning user id, where the interface is to take an
argument, and by default return the user text.

This caused weird errors in certain places.

Change-Id: Icae281de67cfaafe52f1fb1fa4c7556aff7cd306
Follow-up: 8bd386e3680808d1ae1166140ef6917f0498ef3a
---
M includes/filerepo/file/ArchivedFile.php
1 file changed, 10 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/38/101038/1

diff --git a/includes/filerepo/file/ArchivedFile.php 
b/includes/filerepo/file/ArchivedFile.php
index 0d86c70..1454b05 100644
--- a/includes/filerepo/file/ArchivedFile.php
+++ b/includes/filerepo/file/ArchivedFile.php
@@ -451,25 +451,31 @@
}
 
/**
-* Return the user ID of the uploader.
+* Returns ID or name of user who uploaded the file
 *
-* @return int
+* @note Prior to MediaWiki 1.23, this method always
+*   returned the user id, and was inconsistent with
+*   the rest of the file classes.
+* @param string $type 'text' or 'id'
+* @return int|string
 */
-   public function getUser() {
+   public function getUser( $type = 'text' ) {
$this->load();
if ( $this->isDeleted( File::DELETED_USER ) ) {
return 0;
} else {
-   return $this->user;
+   return parent::getUser( $type );
}
}
 
/**
 * Return the user name of the uploader.
 *
+* @deprecated 1.23 Use getUser( 'text' ) instead.
 * @return string
 */
public function getUserText() {
+   wfDeprecated( __METHOD__, '1.23' );
$this->load();
if ( $this->isDeleted( File::DELETED_USER ) ) {
return 0;

-- 
To view, visit https://gerrit.wikimedia.org/r/101038
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icae281de67cfaafe52f1fb1fa4c7556aff7cd306
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix error handling in File::createThumb. - change (mediawiki/core)

2013-12-13 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/101179


Change subject: Fix error handling in File::createThumb.
..

Fix error handling in File::createThumb.

Was checking for null, but transform always returns either
false or an object.

createThumb isn't used in core, but some extensions use it.

Bug: 58436
Change-Id: Icaf5088a193dc1d9b9c365f92722bef1f9c1dba6
---
M includes/filerepo/file/File.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/79/101179/1

diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php
index 1c9d8aa..dc35016 100644
--- a/includes/filerepo/file/File.php
+++ b/includes/filerepo/file/File.php
@@ -904,7 +904,7 @@
$params['height'] = $height;
}
$thumb = $this->transform( $params );
-   if ( is_null( $thumb ) || $thumb->isError() ) {
+   if ( !$thumb || $thumb->isError() ) {
return '';
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/101179
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icaf5088a193dc1d9b9c365f92722bef1f9c1dba6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix getLongDesc if tif file is invalid or has invalid metadata - change (mediawiki...PagedTiffHandler)

2013-12-13 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/101180


Change subject: Fix getLongDesc if tif file is invalid or has invalid metadata
..

Fix getLongDesc if tif file is invalid or has invalid metadata

Previously it was displaying as (1) i.e. the value true cast to
a string surounded by parenthesis, which was rather odd. Most
sane thing to do (imho) is just use the generic getLongDesc
from the parent class.

Change-Id: I8c7c8874c1caa6637d51907c4053dc9c4ecf10e3
---
M PagedTiffHandler_body.php
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PagedTiffHandler 
refs/changes/80/101180/1

diff --git a/PagedTiffHandler_body.php b/PagedTiffHandler_body.php
index c8a5eec..8b8734e 100644
--- a/PagedTiffHandler_body.php
+++ b/PagedTiffHandler_body.php
@@ -543,9 +543,11 @@
->params( $params['size'], $params['mime'] )
->numParams( $params['page_count'] )
->parse();
+   } else {
+   // If we have no metadata, we have no idea how many 
pages we
+   // have, so just fallback to the parent class.
+   return parent::getLongDesc( $image );
}
-
-   return true;
}
 
/**

-- 
To view, visit https://gerrit.wikimedia.org/r/101180
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8c7c8874c1caa6637d51907c4053dc9c4ecf10e3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/PagedTiffHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Use canonical casing for Xml::option (no code changes) - change (mediawiki/core)

2013-12-13 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/101464


Change subject: Use canonical casing for Xml::option (no code changes)
..

Use canonical casing for Xml::option (no code changes)

Per Umherirrender.

Change-Id: I520d71cc9969fe823122565faea9e725f96972f4
Follow-up: d0c0bad56d8ff3fe
---
M includes/ImagePage.php
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/64/101464/1

diff --git a/includes/ImagePage.php b/includes/ImagePage.php
index 93cef53..6e5f869 100644
--- a/includes/ImagePage.php
+++ b/includes/ImagePage.php
@@ -989,7 +989,7 @@
} else {
$display = $code;
}
-   $opts .= "\n" . XML::Option( $display, $code, $curLang 
=== $code );
+   $opts .= "\n" . Xml::option( $display, $code, $curLang 
=== $code );
if ( $curLang === $code ) {
$haveCurrentLang = true;
}
@@ -1000,7 +1000,7 @@
if ( !$haveDefaultLang ) {
// Its hard to know if the content is really in the 
default language, or
// if its just unmarked content that could be in any 
language.
-   $opts = XML::Option( wfMessage( 'img-lang-default' 
)->text(), '', $defaultLang === $curLang ) . $opts;
+   $opts = Xml::option( wfMessage( 'img-lang-default' 
)->text(), '', $defaultLang === $curLang ) . $opts;
}
if ( !$haveCurrentLang && $defaultLang !== $curLang ) {
$name = Language::fetchLanguageName( $curLang, 
$this->getContext()->getLanguage()->getCode() );
@@ -1009,7 +1009,7 @@
} else {
$display = $curLang;
}
-   $opts = XML::Option( $display, $curLang, true ) . $opts;
+   $opts = Xml::option( $display, $curLang, true ) . $opts;
}
 
$select = Html::rawElement( 'select', array( 'id' => 
'mw-imglangselector', 'name' => 'lang' ), $opts );

-- 
To view, visit https://gerrit.wikimedia.org/r/101464
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I520d71cc9969fe823122565faea9e725f96972f4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Removed excess title validity check - change (mediawiki/core)

2013-12-13 Thread Brian Wolff (Code Review)
Brian Wolff has submitted this change and it was merged.

Change subject: Removed excess title validity check
..


Removed excess title validity check

* The queue classes throw away such jobs already

Change-Id: Id10f51952c5b87bbee3ccd1bbeacf05767e920b2
---
M includes/job/jobs/RefreshLinksJob.php
1 file changed, 0 insertions(+), 5 deletions(-)

Approvals:
  BryanDavis: Looks good to me, but someone else must approve
  Brian Wolff: Looks good to me, approved



diff --git a/includes/job/jobs/RefreshLinksJob.php 
b/includes/job/jobs/RefreshLinksJob.php
index cc35cf1..717c041 100644
--- a/includes/job/jobs/RefreshLinksJob.php
+++ b/includes/job/jobs/RefreshLinksJob.php
@@ -59,11 +59,6 @@
function run() {
global $wgUpdateRowsPerJob;
 
-   if ( is_null( $this->title ) ) {
-   $this->setLastError( "Invalid page title" );
-   return false;
-   }
-
// Job to update all (or a range of) backlink pages for a page
if ( isset( $this->params['recursive'] ) ) {
// Carry over information for de-duplication

-- 
To view, visit https://gerrit.wikimedia.org/r/99598
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id10f51952c5b87bbee3ccd1bbeacf05767e920b2
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz 
Gerrit-Reviewer: Brian Wolff 
Gerrit-Reviewer: BryanDavis 
Gerrit-Reviewer: Chad 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Mark ParserOutput of MessageContent as varying by userlanguage - change (mediawiki/core)

2013-12-13 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/101479


Change subject: Mark ParserOutput of MessageContent as varying by userlanguage
..

Mark ParserOutput of MessageContent as varying by userlanguage

Hopefully this will stop cache pollution when a MessageContent
ends up in parser cache. MessageContent objects just do
wfMessage()->parse(), which uses user language.

Bug: 41065
Change-Id: I75e8256a61b828cb9fc93227eb517a34ac6b9d15
---
M includes/content/MessageContent.php
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/79/101479/1

diff --git a/includes/content/MessageContent.php 
b/includes/content/MessageContent.php
index e780846..45f5171 100644
--- a/includes/content/MessageContent.php
+++ b/includes/content/MessageContent.php
@@ -157,6 +157,8 @@
}
 
$po = new ParserOutput( $html );
+   // Message objects are in the user language.
+   $po->recordOption( 'userlang' );
 
return $po;
}

-- 
To view, visit https://gerrit.wikimedia.org/r/101479
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I75e8256a61b828cb9fc93227eb517a34ac6b9d15
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Make SVG language selector use default lang better - change (mediawiki/core)

2013-12-14 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/101493


Change subject: Make SVG language selector use default lang better
..

Make SVG language selector use default lang better

Also have ImagePage check that the given language is actually
valid, before trying to transform with that language.

Be great if this could be backported to wmf7 before that
gets deployed to commons.

Change-Id: I62b8035b70f5cb3388f4c2a844f3bc1c7c92d01e
---
M includes/ImagePage.php
M includes/media/SVG.php
2 files changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/93/101493/1

diff --git a/includes/ImagePage.php b/includes/ImagePage.php
index c73d72c..997a948 100644
--- a/includes/ImagePage.php
+++ b/includes/ImagePage.php
@@ -316,7 +316,12 @@
 
$renderLang = $request->getVal( 'lang' );
if ( !is_null( $renderLang ) ) {
-   $params['lang'] = $renderLang;
+   $handler = $this->displayImg->getHandler();
+   if ( $handler && $handler->validateParam( 
'lang', $renderLang ) ) {
+   $params['lang'] = $renderLang;
+   } else {
+   $renderLang = null;
+   }
}
 
$width_orig = $this->displayImg->getWidth( $page );
@@ -1002,7 +1007,7 @@
if ( !$haveDefaultLang ) {
// Its hard to know if the content is really in the 
default language, or
// if its just unmarked content that could be in any 
language.
-   $opts = Xml::option( wfMessage( 'img-lang-default' 
)->text(), '', $defaultLang === $curLang ) . $opts;
+   $opts = Xml::option( wfMessage( 'img-lang-default' 
)->text(), $defaultLang, $defaultLang === $curLang ) . $opts;
}
if ( !$haveCurrentLang && $defaultLang !== $curLang ) {
$name = Language::fetchLanguageName( $curLang, 
$this->getContext()->getLanguage()->getCode() );
diff --git a/includes/media/SVG.php b/includes/media/SVG.php
index ecc4ef8..ce7fcbb 100644
--- a/includes/media/SVG.php
+++ b/includes/media/SVG.php
@@ -432,7 +432,7 @@
return ( $value > 0 );
} elseif ( $name == 'lang' ) {
// Validate $code
-   if ( !Language::isValidBuiltinCode( $value ) ) {
+   if ( $value === '' || !Language::isValidBuiltinCode( 
$value ) ) {
wfDebug( "Invalid user language code\n" );
 
return false;

-- 
To view, visit https://gerrit.wikimedia.org/r/101493
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I62b8035b70f5cb3388f4c2a844f3bc1c7c92d01e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fixed spacing - change (mediawiki/core)

2013-12-15 Thread Brian Wolff (Code Review)
Brian Wolff has submitted this change and it was merged.

Change subject: Fixed spacing
..


Fixed spacing

- Removed double spaces in arrays
- Added space after for
- Added spaces around string concat

Change-Id: Ifbcaf35f9bfef1f97226a38b5bd74c237f61c99e
---
M includes/DefaultSettings.php
M includes/HttpFunctions.php
M includes/Title.php
M includes/media/MediaHandler.php
M languages/classes/LanguageIu.php
M languages/classes/LanguageSr.php
M tests/phpunit/includes/StatusTest.php
M tests/phpunit/includes/media/DjVuTest.php
8 files changed, 65 insertions(+), 64 deletions(-)

Approvals:
  Brian Wolff: Looks good to me, approved



diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index a79bc41..b1265c1 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -937,8 +937,8 @@
'ImageMagick' => '$path/convert -background white -thumbnail 
$widthx$height\! $input PNG:$output',
'sodipodi' => '$path/sodipodi -z -w $width -f $input -e $output',
'inkscape' => '$path/inkscape -z -w $width -f $input -e $output',
-   'batik' => 'java -Djava.awt.headless=true -jar 
$path/batik-rasterizer.jar -w $width -d '.
-   '$output $input',
+   'batik' => 'java -Djava.awt.headless=true -jar 
$path/batik-rasterizer.jar -w $width -d '
+   . '$output $input',
'rsvg' => '$path/rsvg -w $width -h $height $input $output',
'imgserv' => '$path/imgserv-wrapper -i svg -o png -w$width $input 
$output',
'ImagickExt' => array( 'SvgHandler::rasterizeImagickExt' ),
diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php
index f2e69b8..9093c83 100644
--- a/includes/HttpFunctions.php
+++ b/includes/HttpFunctions.php
@@ -295,10 +295,11 @@
return new CurlHttpRequest( $url, $options );
case 'php':
if ( !wfIniGetBool( 'allow_url_fopen' ) ) {
-   throw new MWException( __METHOD__ . ': 
allow_url_fopen '.
-   'needs to be enabled for pure 
PHP http requests to '.
-   'work. If possible, curl should 
be used instead. See '.
-   'http://php.net/curl.' );
+   throw new MWException( __METHOD__ . ': 
allow_url_fopen ' .
+   'needs to be enabled for pure 
PHP http requests to ' .
+   'work. If possible, curl should 
be used instead. See ' .
+   'http://php.net/curl.'
+   );
}
return new PhpHttpRequest( $url, $options );
default:
diff --git a/includes/Title.php b/includes/Title.php
index 924027e..1d13f4b 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -79,8 +79,8 @@
var $mTitleProtection;///< Cached value for 
getTitleProtection (create protection)
# Don't change the following default, NS_MAIN is hardcoded in several
# places.  See bug 696.
+   # Zero except in {{transclusion}} tags
var $mDefaultNamespace = NS_MAIN; // /< Namespace index when there is 
no namespace
- # 
Zero except in {{transclusion}} tags
var $mWatched = null; // /< Is $wgUser watching this page? 
null if unfilled, accessed through userIsWatching()
var $mLength = -1;// /< The page length, 0 for special 
pages
var $mRedirect = null;// /< Is the article at this title a 
redirect?
diff --git a/includes/media/MediaHandler.php b/includes/media/MediaHandler.php
index 8ad593b..ee11599 100644
--- a/includes/media/MediaHandler.php
+++ b/includes/media/MediaHandler.php
@@ -445,7 +445,7 @@
return $this->getPageText( $file, 1 );
}
$document = '';
-   for( $i = 1; $i <= $numPages; $i++ ) {
+   for ( $i = 1; $i <= $numPages; $i++ ) {
$curPage = $this->getPageText( $file, $i );
if ( is_string( $curPage ) ) {
$document .= $curPage . "\n";
diff --git a/languages/classes/LanguageIu.php b/languages/classes/LanguageIu.php
index abd2e7c..a46eafb 100644
--- a/languages/classes/LanguageIu.php
+++ b/languages/classes/LanguageIu.php
@@ -39,23 +39,23 @@
 
protected $mDoContentConvert;
public $mToLatin = array(
-   'ᐦ' => 'h',   'ᐃ' => 'i','ᐄ' => 'ii','ᐅ' => 'u','ᐆ' 
=> 'uu','ᐊ' => 'a','ᐋ' => 'aa',
-   'ᑉ' => 'p',   'ᐱ' => 'pi',   'ᐲ' => 'pii',   'ᐳ' => 'pu',   'ᐴ' 
=> 'puu',   'ᐸ

[MediaWiki-commits] [Gerrit] Do not use OutputPage to output exceptions in Installer - change (mediawiki/core)

2014-02-08 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/112243

Change subject: Do not use OutputPage to output exceptions in Installer
..

Do not use OutputPage to output exceptions in Installer

Things don't seem entirely set up correctly with $wgOut's
title object, causing fatals. Seems easier just to output
the exceptions raw.

Bug: 61092
Change-Id: Ifbbe18accdd6abd93365ac041a7f708067d0cf02
---
M includes/Exception.php
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/43/112243/1

diff --git a/includes/Exception.php b/includes/Exception.php
index 45b314d..e91a178 100644
--- a/includes/Exception.php
+++ b/includes/Exception.php
@@ -38,7 +38,8 @@
function useOutputPage() {
return $this->useMessageCache() &&
!empty( $GLOBALS['wgFullyInitialised'] ) &&
-   !empty( $GLOBALS['wgOut'] );
+   !empty( $GLOBALS['wgOut'] ) &&
+   !defined( 'MEDIAWIKI_INSTALL' );
}
 
/**

-- 
To view, visit https://gerrit.wikimedia.org/r/112243
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbbe18accdd6abd93365ac041a7f708067d0cf02
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Make Special:MIMESearch a non-expensive special page. - change (mediawiki/core)

2013-06-07 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/67468


Change subject: Make Special:MIMESearch a non-expensive special page.
..

Make Special:MIMESearch a non-expensive special page.

This tries to use the index on (img_media_type, img_major_mime, img_minor_mime).
This is not the ideal index for this purpose (due to starting with
img_media_type, and not having an img_name at the end). However it
seems workable. It does a couple extra queries (at worst 9, one
for each media type defined. However the common case of a bitmap
image, it doesn't need any extra queries. These extra queries should
be cheap indexed 0 result queries). Additionally, even though the
index doesn't have img_name on the end, mysql seems to return
results in img_name ASC order, which is nice (Even if it didn't,
I still think this change would be worth it).

I've does DESCRIBE on all the queries, and they look good to me.
The only potentially problematic thing I see is that it uses
LIMIT X,Y for the offsets (due to being a query page) which can
be expensive on big offsets. If that's an issue, we could limit
the number of results to be at most $wgQueryCacheLimit or something.

Note: There's some discussion on the bug rather negative to this
special page in general. While I agree with much of the criticism,
I still think this special page can be useful, and if it can be
made efficient without needing to modify the indicies, we might
as well.

Bug: 13438
Change-Id: I88826ae7bff0812374157e596f86a19b248220e1
---
M RELEASE-NOTES-1.22
M includes/QueryPage.php
M includes/specials/SpecialMIMEsearch.php
3 files changed, 62 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/68/67468/1

diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index 07763d9..327684c 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -132,6 +132,7 @@
 * (bug 48294) API: Fix chunk upload async mode.
 * (bug 46749) Broken files tracking category removed from pages if an image
   with that name is uploaded.
+* (bug 13438) Special:MIMESearch no longer an expensive special page.
 
 === API changes in 1.22 ===
 * (bug 46626) xmldoublequote parameter was removed. Because of a bug, the
diff --git a/includes/QueryPage.php b/includes/QueryPage.php
index a93639a..e96c7bd 100644
--- a/includes/QueryPage.php
+++ b/includes/QueryPage.php
@@ -588,7 +588,7 @@
 
# $res might contain the whole 1,000 rows, so we read 
up to
# $num [should update this to use a Pager]
-   for ( $i = 0; $i < $num && $row = $dbr->fetchObject( 
$res ); $i++ ) {
+   for ( $i = 0; $i < $num && $row = $res->fetchObject(); 
$i++ ) {
$line = $this->formatResult( $skin, $row );
if ( $line ) {
$attr = ( isset( $row->usepatrol ) && 
$row->usepatrol && $row->patrolled == 0 )
diff --git a/includes/specials/SpecialMIMEsearch.php 
b/includes/specials/SpecialMIMEsearch.php
index 7ff5d7b..4a4a4e1 100644
--- a/includes/specials/SpecialMIMEsearch.php
+++ b/includes/specials/SpecialMIMEsearch.php
@@ -28,14 +28,14 @@
  * @ingroup SpecialPage
  */
 class MIMEsearchPage extends QueryPage {
-   protected $major, $minor;
+   protected $major, $minor, $mediaType = false;
 
function __construct( $name = 'MIMEsearch' ) {
parent::__construct( $name );
}
 
function isExpensive() {
-   return true;
+   return false;
}
 
function isSyndicated() {
@@ -51,12 +51,14 @@
}
 
public function getQueryInfo() {
-   return array(
+   $qi = array(
'tables' => array( 'image' ),
'fields' => array(
'namespace' => NS_FILE,
'title' => 'img_name',
-   'value' => 'img_major_mime',
+   // Still have a value field just in case,
+   // but it isn't actually used for sorting.
+   'value' => 'img_name',
'img_size',
'img_width',
'img_height',
@@ -68,6 +70,60 @@
'img_minor_mime' => $this->minor
)
);
+   if ( $this->mediaType ) {
+   $qi['conds']['img_media_type'] = $this->mediaType;
+   }
+   return $qi;
+   }
+
+   /**
+* The index is on (img_media_type, img_major_mime, img_minor_mime)
+* which unfortunately doesn't have img_name at the end for sorting.
+* So tell db to sort it however it wishes (Its not super import

[MediaWiki-commits] [Gerrit] (DO NOT MERGE; needs I49b7d8a05) Add an lua interface to get... - change (mediawiki...Scribunto)

2013-06-07 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/67588


Change subject: (DO NOT MERGE; needs I49b7d8a05) Add an lua interface to 
getting file metadata
..

(DO NOT MERGE; needs I49b7d8a05) Add an lua interface to getting file metadata

This allows people to make fancy templates using the EXIF/XMP/IPTC metadata
from files.

Note, this didn't add any hooks to the formatting code, I figure that
if someone wants to manipulate it with lua, they're looking for the
raw data. Anyhow, see my comments on the bug.

p.s. First attempt touching anything lua related, so let me know
if I did something horribly horribly wrong.

Bug: 41498
Change-Id: Ie749b30703b1994e80986478fc5d3fce8f3d25a6
---
M engines/LuaCommon/TitleLibrary.php
M engines/LuaCommon/lualib/mw.title.lua
2 files changed, 64 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto 
refs/changes/88/67588/1

diff --git a/engines/LuaCommon/TitleLibrary.php 
b/engines/LuaCommon/TitleLibrary.php
index 5125920..0399fc7 100644
--- a/engines/LuaCommon/TitleLibrary.php
+++ b/engines/LuaCommon/TitleLibrary.php
@@ -15,6 +15,7 @@
'getUrl' => array( $this, 'getUrl' ),
'getContent' => array( $this, 'getContent' ),
'fileExists' => array( $this, 'fileExists' ),
+   'getFileMetadata' => array( $this, 'getFileMetadata' ),
);
$this->getEngine()->registerInterface( 'mw.title.lua', $lib, 
array(
'thisTitle' => $this->returnTitleToLua( 
$this->getTitle() ),
@@ -254,4 +255,57 @@
);
return array( (bool)$file->exists() );
}
+
+   function getFileMetadata( $text ) {
+   $this->checkType( 'getFileMetadata', 1, $text, 'string' );
+   $title = Title::newFromText( $text );
+   if ( !$title ) {
+   return array( false );
+   }
+   $ns = $title->getNamespace();
+   if ( $ns !== NS_FILE && $ns !== NS_MEDIA ) {
+   return array( false );
+   }
+
+   $this->incrementExpensiveFunctionCount();
+   $file = wfFindFile( $title );
+   if ( !$file ) {
+   return array( false );
+   }
+   $this->getParser()->getOutput()->addImage(
+   $file->getName(), $file->getTimestamp(), 
$file->getSha1()
+   );
+
+   $metadata = $file->getStandardMetaArray();
+   if ( $metadata === false ) {
+   return array( false );
+   }
+   return $this->normalizeMetadataForLua( $metadata );
+   }
+
+   /**
+* Change indicies to be 1 based, and make the array more
+* uniformly consistent.
+*/
+   private function normalizeMetadataForLua( $metadata ) {
+   foreach( $metadata as &$entry ) {
+   // Don't let anything be a simple value,
+   // let everything be an array with potentially only
+   // 1 element, so it is more consistent to the user.
+   if ( is_string( $entry ) ) {
+   $entry = array( $entry );
+   }
+
+   if ( isset( $entry[0] ) ) {
+   for ( $i = 1, $cur = $entry[0]; isset( 
$entry[$i] ); $i++ ) {
+   $next = $entry[$i]; 
+   $entry[$i] = $cur;
+   $cur = $next;
+   }
+   $entry[$i] = $cur;
+   unset( $entry[0] );
+   }
+   }
+   return array( $metadata );
+   }
 }
diff --git a/engines/LuaCommon/lualib/mw.title.lua 
b/engines/LuaCommon/lualib/mw.title.lua
index 03184ef..456df99 100644
--- a/engines/LuaCommon/lualib/mw.title.lua
+++ b/engines/LuaCommon/lualib/mw.title.lua
@@ -154,6 +154,16 @@
return content
end
 
+   function data:getFileMetadata()
+   checkSelf( self, 'getFileMetadata' )
+   local metadata = php.getFileMetadata( self.fullText )
+   data.getFileMetadata = function ( self )
+   checkSelf( self, 'getFileMetadata' )
+   return metadata
+   end
+   return metadata
+   end
+
-- Known fields, both those defined above and any dynamically handled in
-- __index, mapped to whether they are read-only.
local readOnlyFields = {

-- 
To view, visit https://gerrit.wikimedia.org/r/67588
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType

[MediaWiki-commits] [Gerrit] Followup If21705c2, Shorten remaining urls to the whatwg HTM... - change (mediawiki/core)

2013-06-08 Thread Brian Wolff (Code Review)
Brian Wolff has submitted this change and it was merged.

Change subject: Followup If21705c2, Shorten remaining urls to the whatwg HTML 
spec.
..


Followup If21705c2, Shorten remaining urls to the whatwg HTML spec.

Finish up with the /specs/web-apps/current-work/multipage/ urls that
haven't been updated to /html/.

Change-Id: I4dbee0477eea440b0e8f113b1d393c6e0c739c4c
---
M includes/Html.php
M includes/OutputPage.php
M includes/Sanitizer.php
3 files changed, 4 insertions(+), 4 deletions(-)

Approvals:
  MaxSem: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Html.php b/includes/Html.php
index a8432f8..1d45e6a 100644
--- a/includes/Html.php
+++ b/includes/Html.php
@@ -842,7 +842,7 @@
 * @return Boolean
 */
public static function isXmlMimeType( $mimetype ) {
-   # 
http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#xml-mime-type
+   # http://www.whatwg.org/html/infrastructure.html#xml-mime-type
# * text/xml
# * application/xml
# * Any mimetype with a subtype ending in +xml (this implicitly 
includes application/xhtml+xml)
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 0849afd..978fddc 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -2528,8 +2528,8 @@
// The spec recommends defining XHTML5's charset using 
the XML declaration
// instead of meta.
// Our XML declaration is output by Html::htmlHeader.
-   // 
http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#attr-meta-http-equiv-content-type
-   // 
http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#charset
+   // 
http://www.whatwg.org/html/semantics.html#attr-meta-http-equiv-content-type
+   // http://www.whatwg.org/html/semantics.html#charset
$ret .= Html::element( 'meta', array( 'charset' => 
'UTF-8' ) );
}
 
diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php
index 8a0522b..7400a5a 100644
--- a/includes/Sanitizer.php
+++ b/includes/Sanitizer.php
@@ -1606,7 +1606,7 @@
'hr' => array_merge( $common, array( 'noshade', 
'size', 'width' ) ),
 
# HTML Ruby annotation text module, simple ruby only.
-   # 
http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-ruby-element
+   # 
http://www.whatwg.org/html/text-level-semantics.html#the-ruby-element
'ruby'   => $common,
# rbc
# rtc

-- 
To view, visit https://gerrit.wikimedia.org/r/67604
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4dbee0477eea440b0e8f113b1d393c6e0c739c4c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Daniel Friesen 
Gerrit-Reviewer: Brian Wolff 
Gerrit-Reviewer: MaxSem 
Gerrit-Reviewer: Peachey88 
Gerrit-Reviewer: Reedy 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] code cosmetics: extension now uses Html class - change (mediawiki...AJAXPoll)

2013-06-13 Thread Brian Wolff (Code Review)
Brian Wolff has submitted this change and it was merged.

Change subject: code cosmetics: extension now uses Html class
..


code cosmetics: extension now uses Html class

Change-Id: I62a0c1fa0bcc541a533432a0a742b06894ad2c00
---
M AJAXPoll.php
M AJAXPoll_body.php
2 files changed, 188 insertions(+), 58 deletions(-)

Approvals:
  Wikinaut: Checked; Looks good to me, but someone else must approve
  Brian Wolff: Verified; Looks good to me, approved



diff --git a/AJAXPoll.php b/AJAXPoll.php
index 89e9362..7c7c017 100644
--- a/AJAXPoll.php
+++ b/AJAXPoll.php
@@ -5,12 +5,28 @@
  * Licensed under the GFDL.
  *
  * 
- * [Option]
  * Question
  * Answer 1
  * Answer 2
  * Answer ...
  * Answer n
+ * 
+ *
+ * to allow the viewing of the poll results even without having voted
+ * 
+ * Question
+ * Answer 1
+ * Answer 2
+ * Answer ...
+ * Answer n
+ * 
+ *
+ * If the first line after  is "STATS",
+ * then some statistics about the wiki and its polls will be displayed.
+ * These statistics are not localizable and this whole feature will probably be
+ * removed (or at least refactored, but probably removed) in the future.
+ * 
+ * STATS
  * 
  *
  * @file
@@ -19,7 +35,7 @@
  * @author Jack Phoenix 
  * @author Thomas Gries
  * @maintainer Thomas Gries
- * @version 1.80
+ * @version 1.84
  * @link http://www.mediawiki.org/wiki/Extension:AJAX_Poll Documentation
  */
 
@@ -31,7 +47,7 @@
 $wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'AJAX Poll',
-   'version' => '1.83 20130605',
+   'version' => '1.84 20130605',
'author' => array( 'Dariusz Siedlecki', 'Jack Phoenix', 'Thomas Gries' 
),
'descriptionmsg' => 'ajaxpoll-desc',
'url' => 'https://www.mediawiki.org/wiki/Extension:AJAX_Poll',
diff --git a/AJAXPoll_body.php b/AJAXPoll_body.php
index 07ef53e..a6fcb45 100644
--- a/AJAXPoll_body.php
+++ b/AJAXPoll_body.php
@@ -56,13 +56,13 @@
$responseToken = "ajaxPollToken";
 
if ( isset( $_POST[$responseId] )
-   && isset( $_POST[$responseAnswer] ) 
+   && isset( $_POST[$responseAnswer] )
&& ( $_POST[$responseId] == $id )
&& isset( $_POST[$responseToken] ) ) {
self::submitVote( $id, intval( 
$_POST[$responseAnswer] ), $_POST[$responseToken] );
}
}
-   
+
$dbw = wfGetDB( DB_MASTER );
$dbw->begin( __METHOD__ );
 
@@ -114,16 +114,18 @@
 
switch( $lines[0] ) {
case 'STATS':
-   $retVal = self::buildStats( $id, $userName );
+   $ret = self::buildStats( $id, $userName );
break;
default:
-   $retVal = '
-' .
-self::buildHTML( $id, $userName, $lines ) .
-'';
+   $ret = Html::rawElement( 'div',
+   array(
+   'id' => 'ajaxpoll-container-' . 
$id
+   ),
+   self::buildHTML( $id, $userName, $lines 
)
+   );
break;
}
-   return $retVal;
+   return $ret;
}
 
private static function buildStats( $id, $userName ) {
@@ -249,7 +251,7 @@
$pollContainerText = ( $insertQuery ) ? 
'ajaxpoll-vote-add' : 'ajaxpoll-vote-error';
 
}
-   
+
} else { // revoking a vote
 
$deleteQuery = $dbw->delete(
@@ -267,6 +269,10 @@
 
return self::buildHTML( $id, $userName, '', $pollContainerText 
);
 
+   }
+
+   private static function escapeContent( $string ) {
+   return htmlspecialchars( Sanitizer::decodeCharReferences( 
$string ), ENT_QUOTES );
}
 
private static function buildHTML( $id, $userName, $lines = '', 
$extra_from_ajax = '' ) {
@@ -333,21 +339,43 @@
}
 
if ( is_object( $wgTitle ) ) {
+
if( !empty( $extra_from_ajax ) ) {
-   $attributes = ' style="display:inline-block;"';
+   $style = 'display:inline-block';
$ajaxMessage = wfMessage( $extra_from_ajax 
)->escaped();
} else {
-   $attributes = ' style="display:none;"';
+   $style = 'display:none';
$ajaxMessage = '';
}
-   // HTML output has to be on one line thanks to a 

[MediaWiki-commits] [Gerrit] Fix warnings on Special:TimedMediaHandler (undefined variabl... - change (mediawiki...TimedMediaHandler)

2013-06-14 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/68806


Change subject: Fix warnings on Special:TimedMediaHandler (undefined variable 
line 164)
..

Fix warnings on Special:TimedMediaHandler (undefined variable line 164)

You can get variable undefined warnings if you don't have a lot of
succesful transcodes registered.

Change-Id: I9cb68053cc5a02741789002da8be8e49e184921c
---
M SpecialTimedMediaHandler.php
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/06/68806/1

diff --git a/SpecialTimedMediaHandler.php b/SpecialTimedMediaHandler.php
index b59680a..8403dd9 100644
--- a/SpecialTimedMediaHandler.php
+++ b/SpecialTimedMediaHandler.php
@@ -135,6 +135,11 @@
$stats[ 'transcodes' ] = array( 'total' => 0 );
foreach ( $this->transcodeStates as $state => $condition ) {
$stats[ $state ] = array( 'total' => 0 );
+   foreach( $wgEnabledTranscodeSet as $type ) {
+   // Important to pre-initialize, as can give
+   // warnings if you don't have a lot of things 
in transcode table.
+   $stats[ $state ][ $type ] = 0;
+   }
}
foreach ( $this->transcodeStates as $state => $condition ) {
$cond = array( 'transcode_key' => 
$wgEnabledTranscodeSet );
@@ -157,7 +162,6 @@
__METHOD__,
array( 'GROUP BY' => 'transcode_key' )
);
-
foreach( $res as $row ) {
$key = $row->transcode_key;
$stats[ 'transcodes' ][ $key ] = $row->count;

-- 
To view, visit https://gerrit.wikimedia.org/r/68806
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9cb68053cc5a02741789002da8be8e49e184921c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Missing whitespace between previous message and show error l... - change (mediawiki...TimedMediaHandler)

2013-06-14 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/68814


Change subject: Missing whitespace between previous message and show error link.
..

Missing whitespace between previous message and show error link.

To be honest, I personally am not sure I like that as a separate link,
maybe it would be better to just link the whole "Error in transcode on
21:35, 14 June 2013" part and skip the "Show error" link (?)

Change-Id: I120fda14f7478866d7e5903c81cda29dc1bfd9a8
---
M TranscodeStatusTable.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/14/68814/1

diff --git a/TranscodeStatusTable.php b/TranscodeStatusTable.php
index f3722ed..55efee3 100644
--- a/TranscodeStatusTable.php
+++ b/TranscodeStatusTable.php
@@ -130,7 +130,7 @@
}
 
return wfMessage( 'timedmedia-error-on',
-   $wgContLang->timeAndDate( $state['time_error'] 
) )->escaped() .
+   $wgContLang->timeAndDate( $state['time_error'] 
) )->escaped() . ' ' .
$showErrorLink;
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/68814
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I120fda14f7478866d7e5903c81cda29dc1bfd9a8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Doc fixes for MediaHandler. No behaviour changes. - change (mediawiki/core)

2013-06-14 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/68838


Change subject: Doc fixes for MediaHandler. No behaviour changes.
..

Doc fixes for MediaHandler. No behaviour changes.

Change-Id: Icba5590e79a09257bcf9733efc53c811c4436801
---
M includes/media/MediaHandler.php
1 file changed, 33 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/38/68838/1

diff --git a/includes/media/MediaHandler.php b/includes/media/MediaHandler.php
index fd576e0..3204fd7 100644
--- a/includes/media/MediaHandler.php
+++ b/includes/media/MediaHandler.php
@@ -78,7 +78,7 @@
/**
 * Merge a parameter array into a string appropriate for inclusion in 
filenames
 *
-* @param $params array
+* @param $params array Array of parameters that have been through 
normaliseParams.
 */
abstract function makeParamString( $params );
 
@@ -220,6 +220,7 @@
 * @param string $dstPath filesystem destination path
 * @param string $dstUrl destination URL to use in output HTML
 * @param array $params arbitrary set of parameters validated by 
$this->validateParam()
+*   Note: These parameters have *not* gone through 
$this->normaliseParams()
 * @param $flags Integer: a bitfield, may contain self::TRANSFORM_LATER
 *
 * @return MediaTransformOutput
@@ -479,6 +480,8 @@
}
 
/**
+* Used instead of getLongDesc if there is no handler registered for 
file.
+*
 * @param $file File
 * @return string
 */
@@ -488,6 +491,8 @@
}
 
/**
+* Short description. Shown on Special:Search results.
+*
 * @param $file File
 * @return string
 */
@@ -498,6 +503,8 @@
}
 
/**
+* Long description. Shown under image on image description page 
surounded by ().
+*
 * @param $file File
 * @return string
 */
@@ -507,6 +514,8 @@
}
 
/**
+* Used instead of getShortDesc if there is no handler registered for 
file.
+*
 * @param $file File
 * @return string
 */
@@ -534,12 +543,25 @@
}
}
 
+   /**
+* Shown in file history box on image description page.
+*
+* @param File $file
+* @return String Dimensions
+*/
function getDimensionsString( $file ) {
return '';
}
 
/**
-* Modify the parser object post-transform
+* Modify the parser object post-transform.
+*
+* This is often used to do $parser->addOutputHook(),
+* in order to add some javascript to render a viewer.
+* See TimedMediaHandler or OggHandler for an example.
+*
+* @param Parser $parser
+* @param File $file
 */
function parserTransformHook( $parser, $file ) {}
 
@@ -587,10 +609,17 @@
}
 
/**
-* Remove files from the purge list
+* Remove files from the purge list.
+*
+* This is used by some video handlers to prevent ?action=purge
+* from removing a transcoded video, which is expensive to
+* regenerate.
+*
+* @see LocalFile::purgeThumbnails
 *
 * @param array $files
-* @param array $options
+* @param array $options Purge options. Currently will always be
+*  an array with a single key 'forThumbRefresh' set to true.
 */
public function filterThumbnailPurgeList( &$files, $options ) {
// Do nothing

-- 
To view, visit https://gerrit.wikimedia.org/r/68838
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icba5590e79a09257bcf9733efc53c811c4436801
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] (Optionally) Use {{DISPLAYTITLE:...}} whenever linking to a ... - change (mediawiki/core)

2013-06-15 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/68936


Change subject: (Optionally) Use {{DISPLAYTITLE:...}} whenever linking to a page
..

(Optionally) Use {{DISPLAYTITLE:...}} whenever linking to a page

Note: This is disabled by default via $wgAlwaysUseDisplayTitle

This makes displaytitle be used on Category pages, and pretty much
anywhere that Linker::link is used, without specifying the text
of the link. Note, this does not include [[Foo]] links being
made by the Parser. This does include links on RC (which some might
consider a bad thing. On the other hand iPad would be spelled right
in RC. The bad would come when people use make title invisible hacks).

The restrictions on normal DISPLAYTITLE are also used here.

This adds some extra db queries (quite a few). If anyone actually decides
they want this on a Wikimedia wiki, I could add code to make sure
those queries are batched.

Bug: 17212
Change-Id: Ic1f61879cf5848f4ec6e61f0b80c24019d0e8a13
---
M RELEASE-NOTES-1.22
M includes/DefaultSettings.php
M includes/Linker.php
M includes/Title.php
4 files changed, 55 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/36/68936/1

diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index 1b434d9..2d28548 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -111,6 +111,8 @@
 ** editmyuserjs controls whether a user may edit their own JS subpages.
 * Add new hook AbortTalkPageEmailNotification, this will be used to determine
   whether to send the regular talk page email notification
+* (bug 17212) Add $wgAlwaysUseDisplayTitle so that the displaytitle is used on
+  category listing, recent changes, etc.
 
 === Bug fixes in 1.22 ===
 * Disable Special:PasswordReset when $wgEnableEmail is false. Previously one
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index b560baf..0b6129f 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -3521,6 +3521,15 @@
 $wgRestrictDisplayTitle = true;
 
 /**
+ * Use DISPLAYTITLE outside of the current page.
+ * For example, Category listings. Most places that link to a page using the
+ * full page name.
+ *
+ * May increase the number of DB queries.
+ */
+$wgAlwaysUseDisplayTitle = false;
+
+/**
  * Maximum number of calls per parse to expensive parser functions such as
  * PAGESINCATEGORY.
  */
diff --git a/includes/Linker.php b/includes/Linker.php
index 3529d28..2a89501 100644
--- a/includes/Linker.php
+++ b/includes/Linker.php
@@ -168,7 +168,8 @@
 * @param $html  string The HTML contents of the  element, 
i.e.,
 *   the link text.  This is raw HTML and will not be escaped.  If null,
 *   defaults to the prefixed text of the Title; or if the Title is 
just a
-*   fragment, the contents of the fragment.
+*   fragment, the contents of the fragment. If 
$wgAlwaysUseDisplayTitle is
+*   set to true, the default will be the pages {{DEFAULTTITLE:..}} if 
set.
 * @param array $customAttribs  A key => value array of extra HTML 
attributes,
 *   such as title and class.  (href is ignored.)  Classes will be
 *   merged with the default classes, while other attributes will 
replace
@@ -380,6 +381,7 @@
 * @return string
 */
private static function linkText( $target ) {
+   global $wgAlwaysUseDisplayTitle;
// We might be passed a non-Title by make*LinkObj().  Fail 
gracefully.
if ( !$target instanceof Title ) {
return '';
@@ -390,7 +392,12 @@
if ( $target->getPrefixedText() === '' && 
$target->getFragment() !== '' ) {
return htmlspecialchars( $target->getFragment() );
}
-   return htmlspecialchars( $target->getPrefixedText() );
+   if ( $wgAlwaysUseDisplayTitle ) {
+   // Note, this returns html, that we want to output 
without escaping.
+   return $target->getDisplayTitle();
+   } else {
+   return htmlspecialchars( $target->getPrefixedText() );
+   }
}
 
/**
diff --git a/includes/Title.php b/includes/Title.php
index 9d42b2f..ffddb17 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -86,6 +86,7 @@
var $mRedirect = null;// /< Is the article at this title a 
redirect?
var $mNotificationTimestamp = array(); // /< Associative array of user 
ID -> timestamp/false
var $mHasSubpage; // /< Whether a page has any subpages
+   var $mDisplayTitle = null;// /< HTML for the page's 
{{DISPLAYTITLE:...}}
// @}
 
/**
@@ -4785,4 +4786,38 @@
}
return $notices;
}
+
+   /**
+* Returns the display title if it exis

[MediaWiki-commits] [Gerrit] Fix handling of height parameter in TMH. - change (mediawiki...TimedMediaHandler)

2013-06-16 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/68953


Change subject: Fix handling of height parameter in TMH.
..

Fix handling of height parameter in TMH.

The height parameter was being mostly ignored by TMH.
Example invocations of height parameter that this changes:
*[[File:Hindesite - Lily - Focus Stacking (by).ogv|900x150px]]
*[[File:Hindesite - Lily - Focus Stacking (by).ogv|x100px]]

Change-Id: Id37d771c4d0693980eb672f1f03f4c1a7129973d
---
M TimedMediaHandler_body.php
1 file changed, 16 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/53/68953/1

diff --git a/TimedMediaHandler_body.php b/TimedMediaHandler_body.php
index 55b7bdc..39e88a8 100644
--- a/TimedMediaHandler_body.php
+++ b/TimedMediaHandler_body.php
@@ -41,13 +41,15 @@
if ( $this->parseTimeString( $value ) === false ) {
return false;
}
-   } else if ( $name == 'disablecontrols' ) {
+   } elseif ( $name == 'disablecontrols' ) {
$values = explode( ',', $value);
foreach($values as $v) {
if ( !in_array( $v, array( 'options', 
'timedText', 'fullscreen' ) ) ) {
return false;
}
}
+   } elseif( $name === 'width' || $name === 'height' ) {
+   return $value > 0;
}
return true;
}
@@ -122,6 +124,14 @@
if( isset( $params['width'] ) && (int)$params['width'] > 
$image->getWidth() ){
$params['width'] = $image->getWidth();
}
+
+   if ( isset( $params['height'] ) && $params['height'] != -1 ) {
+   if( $params['width'] * $image->getHeight() > 
$params['height'] * $image->getWidth() ) {
+   $params['width'] = self::fitBoxWidth( 
$image->getWidth(), $image->getHeight(), $params['height'] );
+   }
+   }
+
+   $params['height'] = File::scaleHeight( $image->getWidth(), 
$image->getHeight(), $params['width'] );
 
// Make sure start time is not > than end time
if(isset($params['start']) && isset($params['end']) ){
@@ -299,6 +309,11 @@
 * @return 
bool|MediaTransformError|MediaTransformOutput|TimedMediaTransformOutput
 */
function doTransform( $file, $dstPath, $dstUrl, $params, $flags = 0 ) {
+   # Important or height handling is wrong.
+   if ( !$this->normaliseParams( $file, $params ) ) {
+   return new TransformParameterError( $params );
+   }
+
$srcWidth = $file->getWidth();
$srcHeight = $file->getHeight();
 
@@ -317,7 +332,6 @@
$targetHeight = $params['height'];
$targetWidth = round( $params['width']*  $srcWidth / 
$srcHeight );
}
-
$options = array(
'file' => $file,
'length' => $this->getLength( $file ),

-- 
To view, visit https://gerrit.wikimedia.org/r/68953
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id37d771c4d0693980eb672f1f03f4c1a7129973d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add audio transcodes to Special:TimedMediaHandler. - change (mediawiki...TimedMediaHandler)

2013-06-16 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/69023


Change subject: Add audio transcodes to Special:TimedMediaHandler.
..

Add audio transcodes to Special:TimedMediaHandler.

Future todo: Add number audio files to summary at top.

Bug: 49654
Change-Id: I99d29908f1d2a0ebdd3a44db4652a0aa4e35b034
---
M SpecialTimedMediaHandler.php
1 file changed, 8 insertions(+), 6 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/23/69023/1

diff --git a/SpecialTimedMediaHandler.php b/SpecialTimedMediaHandler.php
index 8403dd9..465cff2 100644
--- a/SpecialTimedMediaHandler.php
+++ b/SpecialTimedMediaHandler.php
@@ -64,7 +64,8 @@
 * @param bool $showTable
 */
private function renderState ( $out, $state, $stats, $showTable = true 
) {
-   global $wgEnabledTranscodeSet;
+   global $wgEnabledTranscodeSet, $wgEnabledAudioTranscodeSet;
+   $allTranscodes = array_merge( $wgEnabledTranscodeSet, 
$wgEnabledAudioTranscodeSet );
if ( $stats[ $state ][ 'total' ] ) {
// Give grep a chance to find the usages:
// timedmedia-derivative-state-transcodes, 
timedmedia-derivative-state-active,
@@ -74,7 +75,7 @@
. $this->msg( 'timedmedia-derivative-state-' . 
$state, $stats[ $state ]['total'] )->escaped()
. ""
);
-   foreach( $wgEnabledTranscodeSet as $key ) {
+   foreach( $allTranscodes as $key ) {
if ( $stats[ $state ][ $key ] ) {
$out->addHTML(
$stats[ $state ][ $key ]
@@ -129,20 +130,21 @@
}
 
private function getStats() {
-   global $wgEnabledTranscodeSet;
+   global $wgEnabledTranscodeSet, $wgEnabledAudioTranscodeSet;
+   $allTranscodes = array_merge( $wgEnabledTranscodeSet, 
$wgEnabledAudioTranscodeSet );
$stats = array();
$dbr = wfGetDB( DB_SLAVE );
$stats[ 'transcodes' ] = array( 'total' => 0 );
foreach ( $this->transcodeStates as $state => $condition ) {
$stats[ $state ] = array( 'total' => 0 );
-   foreach( $wgEnabledTranscodeSet as $type ) {
+   foreach( $allTranscodes as $type ) {
// Important to pre-initialize, as can give
// warnings if you don't have a lot of things 
in transcode table.
$stats[ $state ][ $type ] = 0;
}
}
foreach ( $this->transcodeStates as $state => $condition ) {
-   $cond = array( 'transcode_key' => 
$wgEnabledTranscodeSet );
+   $cond = array( 'transcode_key' => $allTranscodes );
$cond[] = $condition;
$res = $dbr->select( 'transcode',
array('COUNT(*) as count', 'transcode_key'),
@@ -158,7 +160,7 @@
}
$res = $dbr->select( 'transcode',
array( 'COUNT(*) as count', 'transcode_key' ),
-   array( 'transcode_key' => $wgEnabledTranscodeSet ),
+   array( 'transcode_key' => $allTranscodes ),
__METHOD__,
array( 'GROUP BY' => 'transcode_key' )
);

-- 
To view, visit https://gerrit.wikimedia.org/r/69023
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99d29908f1d2a0ebdd3a44db4652a0aa4e35b034
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] thumb_handler.php doesn't seem to extract path_info correctly - change (mediawiki/core)

2013-06-16 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/69025


Change subject: thumb_handler.php doesn't seem to extract path_info correctly
..

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
---
M thumb.php
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/25/69025/1

diff --git a/thumb.php b/thumb.php
index 4a0c9fb..b9826a7 100644
--- a/thumb.php
+++ b/thumb.php
@@ -62,9 +62,15 @@
 
# Set action base paths so that WebRequest::getPathInfo()
# recognizes the "X" as the 'title' in ../thumb_handler.php/X urls.
-   $wgArticlePath = false; # Don't let a "/*" article path clober our 
action path
+   # Note: If Custom per-extension repo paths are set, this may break.
+   $repo = RepoGroup::singleton()->getLocalRepo();
+   $oldArticlePath = $wgArticlePath;
+   $wgArticlePath = $repo->getZoneUrl( 'thumb' ) . '/$1';
 
$matches = WebRequest::getPathInfo();
+
+   $wgArticlePath = $oldArticlePath;
+
if ( !isset( $matches['title'] ) ) {
wfThumbError( 404, 'Could not determine the name of the 
requested thumbnail.' );
return;

-- 
To view, visit https://gerrit.wikimedia.org/r/69025
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I35b4ab73e1d84dad10503d3a098ee154e8d58d8a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 
Gerrit-Reviewer: Aaron Schulz 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Make thumb_handler.php use MediaHandler::parseParamString - change (mediawiki/core)

2013-06-16 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/69027


Change subject: Make thumb_handler.php use MediaHandler::parseParamString
..

Make thumb_handler.php use MediaHandler::parseParamString

Use MediaHandler::parseParamString to parse the parameter string
of a thumbnail. This seems to make much more sense given the
design of the Handler class. Also mark ExtractThumbParameters hook
as deprecated.

This should be reviewed by someone familar with the 404 thumbnailing
infrastructure. I'm unclear if there was a reason that this file
was constructed this way.

Bug: 49629
Change-Id: I43a0e7d6f0e45536e4e24b72140157791f5f027f
---
M RELEASE-NOTES-1.22
M docs/hooks.txt
M includes/media/MediaHandler.php
M thumb.php
4 files changed, 77 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/27/69027/1

diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index 1b434d9..907bb89 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -235,6 +235,8 @@
   will no longer be output and OutputPage::addKeyword no longer exists.
 * Methods Title::userCanEditCssSubpage and Title::userCanEditJsSubpage,
   deprecated since 1.19, have been removed.
+* (bug 49629) The hook ExtractThumbParamaters has been deprecated in favour
+  of media handler overriding MediaHandler::parseParamString.
 
 == Compatibility ==
 
diff --git a/docs/hooks.txt b/docs/hooks.txt
index ff0a864..bebc5d1 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -1071,6 +1071,7 @@
 
 'ExtractThumbParameters': Called when extracting thumbnail parameters from a
 thumbnail file name.
+DEPRECATED: Media handler should override MediaHandler::parseParamString 
instead.
 $thumbname: the base name of the thumbnail file
 &$params: the currently extracted params (has source name, temp or archived 
zone)
 
diff --git a/includes/media/MediaHandler.php b/includes/media/MediaHandler.php
index fd576e0..3a23968 100644
--- a/includes/media/MediaHandler.php
+++ b/includes/media/MediaHandler.php
@@ -79,13 +79,15 @@
 * Merge a parameter array into a string appropriate for inclusion in 
filenames
 *
 * @param $params array
+* @return String
 */
abstract function makeParamString( $params );
 
/**
 * Parse a param string made with makeParamString back into an array
 *
-* @param $str string
+* @param $str string The parameter string without file name (e.g. 
122px)
+* @return Array|Boolean Array of parameters or false on failure.
 */
abstract function parseParamString( $str );
 
diff --git a/thumb.php b/thumb.php
index 4a0c9fb..6dab01d 100644
--- a/thumb.php
+++ b/thumb.php
@@ -62,7 +62,7 @@
 
# Set action base paths so that WebRequest::getPathInfo()
# recognizes the "X" as the 'title' in ../thumb_handler.php/X urls.
-   $wgArticlePath = false; # Don't let a "/*" article path clober our 
action path
+   $wgArticlePath = ''; # Don't let a "/*" article path clober our action 
path
 
$matches = WebRequest::getPathInfo();
if ( !isset( $matches['title'] ) ) {
@@ -93,17 +93,6 @@
$headers = array(); // HTTP headers to send
 
$fileName = isset( $params['f'] ) ? $params['f'] : '';
-   unset( $params['f'] );
-
-   // Backwards compatibility parameters
-   if ( isset( $params['w'] ) ) {
-   $params['width'] = $params['w'];
-   unset( $params['w'] );
-   }
-   if ( isset( $params['p'] ) ) {
-   $params['page'] = $params['p'];
-   }
-   unset( $params['r'] ); // ignore 'r' because we unconditionally pass 
File::RENDER
 
// Is this a thumb of an archived file?
$isOld = ( isset( $params['archived'] ) && $params['archived'] );
@@ -190,6 +179,25 @@
return;
}
}
+
+   // Do rendering parameters extraction.
+   $params = wfConvertThumbNameToParams( $img, $params );
+   if ( $params == null ) {
+   wfThumbError( 400, 'The specified thumbnail parameters are not 
recognized.' );
+   return;
+   }
+
+   // Backwards compatibility parameters
+   if ( isset( $params['w'] ) ) {
+   $params['width'] = $params['w'];
+   unset( $params['w'] );
+   }
+   if ( isset( $params['p'] ) ) {
+   $params['page'] = $params['p'];
+   }
+   unset( $params['r'] ); // ignore 'r' because we unconditionally pass 
File::RENDER
+   unset( $params['f'] ); // We're done with 'f' parameter.
+
 
// Get the normalized thumbnail name from the parameters...
try {
@@ -287,7 +295,9 @@
 
 /**
  * Extract the required params for thumb.php from the thumbnail request URI.
- * At least 'width' and 'f' should be set if the result is an array.
+ *
+ * 'f' will be set, however transform pa

[MediaWiki-commits] [Gerrit] Follow-up 42333412 - Fix behaviour $wgVerifyMimeType = false; - change (mediawiki/core)

2013-06-17 Thread Brian Wolff (Code Review)
Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/69257


Change subject: Follow-up 42333412 - Fix behaviour $wgVerifyMimeType = false;
..

Follow-up 42333412 - Fix behaviour $wgVerifyMimeType = false;

Should probably be backported to stable.

Bug: 49717
Change-Id: If1d6e8fed575bf2816a10db066ec4e023460ee1e
---
M includes/upload/UploadBase.php
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/57/69257/1

diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php
index 2ed20c5..710a501 100644
--- a/includes/upload/UploadBase.php
+++ b/includes/upload/UploadBase.php
@@ -410,10 +410,10 @@
return $status;
}
 
-   if ( $wgVerifyMimeType ) {
-   $this->mFileProps = FSFile::getPropsFromPath( 
$this->mTempPath, $this->mFinalExtension );
-   $mime = $this->mFileProps['file-mime'];
+   $this->mFileProps = FSFile::getPropsFromPath( $this->mTempPath, 
$this->mFinalExtension );
+   $mime = $this->mFileProps['file-mime'];
 
+   if ( $wgVerifyMimeType ) {
# XXX: Missing extension will be caught by 
validateName() via getTitle()
if ( $this->mFinalExtension != '' && 
!$this->verifyExtension( $mime, $this->mFinalExtension ) ) {
wfProfileOut( __METHOD__ );

-- 
To view, visit https://gerrit.wikimedia.org/r/69257
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If1d6e8fed575bf2816a10db066ec4e023460ee1e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


  1   2   3   4   5   6   7   8   9   >