http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97512
Revision: 97512
Author: reedy
Date: 2011-09-19 16:01:23 +0000 (Mon, 19 Sep 2011)
Log Message:
-----------
1.18wmf1 Merge r60970, r69199, r77266, r96827 (Some of the revisions from
r81460)
Modified Paths:
--------------
branches/wmf/1.18wmf1/includes/filerepo/RepoGroup.php
branches/wmf/1.18wmf1/languages/LanguageConverter.php
branches/wmf/1.18wmf1/thumb.php
Modified: branches/wmf/1.18wmf1/includes/filerepo/RepoGroup.php
===================================================================
--- branches/wmf/1.18wmf1/includes/filerepo/RepoGroup.php 2011-09-19
15:58:39 UTC (rev 97511)
+++ branches/wmf/1.18wmf1/includes/filerepo/RepoGroup.php 2011-09-19
16:01:23 UTC (rev 97512)
@@ -30,7 +30,7 @@
* @var RepoGroup
*/
protected static $instance;
- const MAX_CACHE_SIZE = 1000;
+ const MAX_CACHE_SIZE = 5;
/**
* Get a RepoGroup instance. At present only one instance of RepoGroup
is
Modified: branches/wmf/1.18wmf1/languages/LanguageConverter.php
===================================================================
--- branches/wmf/1.18wmf1/languages/LanguageConverter.php 2011-09-19
15:58:39 UTC (rev 97511)
+++ branches/wmf/1.18wmf1/languages/LanguageConverter.php 2011-09-19
16:01:23 UTC (rev 97512)
@@ -792,13 +792,14 @@
if ( $this->mTablesLoaded ) {
return;
}
- global $wgMemc;
+ //global $wgMemc;
wfProfileIn( __METHOD__ );
$this->mTablesLoaded = true;
$this->mTables = false;
if ( $fromCache ) {
wfProfileIn( __METHOD__ . '-cache' );
- $this->mTables = $wgMemc->get( $this->mCacheKey );
+ // $this->mTables = $wgMemc->get( $this->mCacheKey );
+ $this->mTables = apc_fetch( $this->mCacheKey );
wfProfileOut( __METHOD__ . '-cache' );
}
if ( !$this->mTables
@@ -816,7 +817,8 @@
$this->postLoadTables();
$this->mTables[self::CACHE_VERSION_KEY] = true;
- $wgMemc->set( $this->mCacheKey, $this->mTables, 43200 );
+ // $wgMemc->set($this->mCacheKey, $this->mTables,
43200);
+ apc_store( $this->mCacheKey, $this->mTables, 43200 );
wfProfileOut( __METHOD__ . '-recache' );
}
wfProfileOut( __METHOD__ );
Modified: branches/wmf/1.18wmf1/thumb.php
===================================================================
--- branches/wmf/1.18wmf1/thumb.php 2011-09-19 15:58:39 UTC (rev 97511)
+++ branches/wmf/1.18wmf1/thumb.php 2011-09-19 16:01:23 UTC (rev 97512)
@@ -51,6 +51,9 @@
$isOld = (isset( $params['archived'] ) && $params['archived']);
unset( $params['archived'] );
+ // Is this a thumb of a temp file?
+ $isTemp = ( isset( $params['temp'] ) && $params['temp'] );
+
// Some basic input validation
$fileName = strtr( $fileName, '\\/', '__' );
@@ -70,13 +73,31 @@
return;
}
$img =
RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $title, $fileName );
+ } else if ( $isTemp ) {
+ // Dirty, horrible, evil hack. We need to create a repo with
the right zone paths for this to work
+ $localRepo = RepoGroup::singleton()->getLocalRepo();
+
+ $repo = new FSRepo(
+ array( 'directory' => $localRepo->getZonePath( 'temp' ),
+ 'url' => $localRepo->getZoneUrl( 'temp' ),
+ 'thumbDir'=> $localRepo->getZonePath( 'thumb' ) .
'/temp',
+ 'thumbUrl' => $localRepo->getZoneUrl( 'thumb' ) .
'/temp'
+ )
+ );
+
+ // $fileName can be like timestamp!name , strip the timestamp!
part
+ $parts = explode( '!', $fileName, 2 );
+ $strippedName = isset( $parts[1] ) ? $parts[1] : $fileName;
+ $path = $localRepo->getZonePath( 'temp' ) . '/' .
RepoGroup::singleton()->getLocalRepo()->getHashPath( $strippedName ) .
$fileName;
+ $img = new UnregisteredLocalFile( false, $repo, $path, false );
} else {
$img = wfLocalFile( $fileName );
}
// Check permissions if there are read restrictions
if ( !in_array( 'read', User::getGroupPermissions( array( '*' ) ), true
) ) {
- if ( !$img->getTitle()->userCanRead() ) {
+ // If we have a title, check that for read access. If not
(stashed file), be paranoid and disallow
+ if ( !$img->getTitle() || !$img->getTitle()->userCanRead() ) {
wfThumbError( 403, 'Access denied. You do not have
permission to access ' .
'the source file.' );
wfProfileOut( __METHOD__ );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs