From 049b8db10b65145831428076670503a3458fef23 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Fri, 6 Nov 2009 15:38:47 +0000 Subject: [PATCH] Add new global $wgUseInstantCommons for quick && easy enabling of Commons for 3rd party sites using sane defaults --- RELEASE-NOTES | 2 ++ includes/DefaultSettings.php | 7 +++++++ includes/Setup.php | 12 ++++++++++++ 3 files changed, 21 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 116162d841..2afa482048 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -97,6 +97,8 @@ Hopefully we will remove this configuration var soon) * (bug 3340) $wgBlockCIDRLimit added (default: 16) to configure the low end of CIDR ranges for blocking * Added upload by default to $wgRestrictionTypes +* $wgUseInstantCommons added for quick and easy enabling of Commons as a remote + file repository === New features in 1.16 === diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 0b3e182d3b..9be4b5c6aa 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -256,6 +256,13 @@ $wgLocalFileRepo = false; $wgForeignFileRepos = array(); /**@}*/ +/** + * Use Commons as a remote file repository. Essentially a wrapper, when this + * is enabled $wgForeignFileRepos will point at Commons with a set of default + * settings + */ +$wgUseInstantCommons = false; + /** * Allowed title characters -- regex character class * Don't change this unless you know what you're doing diff --git a/includes/Setup.php b/includes/Setup.php index 04b9b473c6..67c52c4370 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -128,6 +128,18 @@ if ( $wgUseSharedUploads ) { ); } } +if( $wgUseInstantCommons ) { + $wgForeignFileRepos[] = array( + 'class' => 'ForeignAPIRepo', + 'name' => 'wikimediacommons', + 'apibase' => 'http://commons.wikimedia.org/w/api.php', + 'fetchDescription' => true, + 'descriptionCacheExpiry' => 43200, + 'apiThumbCacheExpiry' => 86400, + ); +} + + if ( !class_exists( 'AutoLoader' ) ) { require_once( "$IP/includes/AutoLoader.php" ); } -- 2.20.1