Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/LocalSettings.php |
— | — | @@ -1,14 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * This file store all of mwEmbed local configuration ( in a default svn check out this file is empty ) |
5 | | - * |
6 | | - * For core configuration see: includes/DefaultSettings.php |
7 | | - * |
8 | | - * Set $wgMwEmbedEnabledModules to the set of "mwEmbed modules" you want enabled. |
9 | | - * |
10 | | - * For per module configuration see modules/{moduleName}/{moduleName}.config.php |
11 | | - * Module configuration options can be set via: |
12 | | - * $wgMwEmbedModuleConfig[ {configuration name} ] = value; |
13 | | - */ |
14 | | - |
15 | | -$wgResourceLoaderDebug = false; |
\ No newline at end of file |
Property changes on: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/cache |
___________________________________________________________________ |
Modified: svn:ignore |
16 | 1 | - a |
9 |
4 |
2 |
5 |
f |
d |
17 | 2 | + a |
9 |
4 |
2 |
5 |
f |
d |
c |
e |
3 |
6 |
0 |
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/MwEmbedWebStartSetup.php |
— | — | @@ -77,13 +77,11 @@ |
78 | 78 | # LocalSettings.php is the per site customization file. If it does not exist |
79 | 79 | # error out |
80 | 80 | if( !file_exists( MW_CONFIG_FILE ) ) { |
81 | | - print "alert('your mwEmbed install is missing a localSettings.php');"; |
82 | | - die(); |
| 81 | + print "if( console && typeof console.log == 'function' ){ console.log('MwEmbed could not find LocalSettings.php ( using default configuration )');"; |
| 82 | +} else { |
| 83 | + # Load local settings |
| 84 | + require_once( "$IP/LocalSettings.php" ); |
83 | 85 | } |
84 | | - |
85 | | -# Load local settings |
86 | | -require_once( "$IP/LocalSettings.php" ); |
87 | | - |
88 | 86 | # Include utility files: |
89 | 87 | require_once( "$IP/includes/Hooks.php"); |
90 | 88 | |
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/MwEmbedMediaWikiGlobalFunctions.php |
— | — | @@ -263,7 +263,7 @@ |
264 | 264 | */ |
265 | 265 | function mweGetFromFileCache( $key ){ |
266 | 266 | global $IP; |
267 | | - $filePath = mwGetFilePathFromKey( $key ); |
| 267 | + $filePath = mweGetFilePathFromKey( $key ); |
268 | 268 | $rawResult = @file_get_contents( $filePath ); |
269 | 269 | if( $rawResult === false ){ |
270 | 270 | return null; |
— | — | @@ -277,7 +277,7 @@ |
278 | 278 | */ |
279 | 279 | function mweSaveFileToCache ( $key, $data){ |
280 | 280 | global $IP; |
281 | | - $filePath = mwGetFilePathFromKey( $key ); |
| 281 | + $filePath = mweGetFilePathFromKey( $key ); |
282 | 282 | $path = dirname( $filePath ); |
283 | 283 | if( !is_dir($path ) ){ |
284 | 284 | $ok = mkdir( $path, 0777, true ); // PHP5 <3 |
— | — | @@ -287,11 +287,34 @@ |
288 | 288 | } |
289 | 289 | return @file_put_contents( $filePath, serialize( $data ) ); |
290 | 290 | } |
291 | | -function mwGetFilePathFromKey( $key ){ |
| 291 | +function mweGetFilePathFromKey( $key ){ |
292 | 292 | global $IP; |
293 | 293 | $hash = md5( $key ); |
294 | 294 | // Pretty darn unlikely cache missmatch: |
295 | 295 | return "$IP/cache/". substr( $hash, 0, 1) . '/' . substr( $hash, 1, 1) . |
296 | 296 | '/' . substr( $key, 0, 48 ); |
297 | 297 | } |
| 298 | + |
| 299 | + |
| 300 | +/** |
| 301 | + * Expand a potentially local URL to a fully-qualified URL. Assumes $wgServer |
| 302 | + * and $wgProto are correct. |
| 303 | + * |
| 304 | + * @todo this won't work with current-path-relative URLs |
| 305 | + * like "subdir/foo.html", etc. |
| 306 | + * |
| 307 | + * @param $url String: either fully-qualified or a local path + query |
| 308 | + * @return string Fully-qualified URL |
| 309 | + */ |
| 310 | +function wfExpandUrl( $url ) { |
| 311 | + if( substr( $url, 0, 2 ) == '//' ) { |
| 312 | + global $wgProto; |
| 313 | + return $wgProto . ':' . $url; |
| 314 | + } elseif( substr( $url, 0, 1 ) == '/' ) { |
| 315 | + global $wgServer; |
| 316 | + return $wgServer . $url; |
| 317 | + } else { |
| 318 | + return $url; |
| 319 | + } |
| 320 | +} |
298 | 321 | ?> |
\ No newline at end of file |
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/MwEmbedPoorManSquidProxy.php |
— | — | @@ -1,5 +1,9 @@ |
2 | 2 | <?php |
3 | | -// quick MwEmbedPoorManSquidProxy implementation |
| 3 | +// Quick MwEmbedPoorManSquidProxy implementation |
| 4 | + |
| 5 | +// This does basic file based cache and response reverse proxy for resource loader. |
| 6 | +// This is needed in cases where you don't have the resource loader behind a reverse proxy. |
| 7 | + |
4 | 8 | class MwEmbedPoorManSquidProxy { |
5 | 9 | public static $hash = null; |
6 | 10 | public static $debug = null; |
— | — | @@ -39,12 +43,12 @@ |
40 | 44 | */ |
41 | 45 | |
42 | 46 | // Check if we have a cached file: |
43 | | - if( !is_file( mwGetFilePathFromKey( self::$hash ) ) ){ |
| 47 | + if( ! is_file( mweGetFilePathFromKey( self::$hash ) ) ){ |
44 | 48 | return ; |
45 | 49 | } |
46 | 50 | |
47 | 51 | // Check file modified time: |
48 | | - $fileTime = wfTimestamp( TS_UNIX, filemtime( mwGetFilePathFromKey( self::$hash ) ) ); |
| 52 | + $fileTime = wfTimestamp( TS_UNIX, filemtime( mweGetFilePathFromKey( self::$hash ) ) ); |
49 | 53 | if( wfTimestamp( TS_UNIX, time() ) - $fileTime > $smaxage){ |
50 | 54 | // Run the normal resource loader |
51 | 55 | return ; |
— | — | @@ -70,17 +74,18 @@ |
71 | 75 | header( 'Content-Type: text/javascript' ); |
72 | 76 | } |
73 | 77 | header( 'Last-Modified: ' . wfTimestamp( TS_RFC2822, $fileTime ) ); |
| 78 | + |
74 | 79 | // no private cache in mwEmbed resource loader land ( both smaxage ) |
75 | 80 | header( "Cache-Control: public, max-age=$smaxage, s-maxage=$smaxage" ); |
76 | 81 | header( 'Expires: ' . wfTimestamp( TS_RFC2822, $smaxage + time() ) ); |
77 | 82 | |
78 | 83 | // Gzip if possible: |
79 | | - ob_start("ob_gzhandler"); |
| 84 | + //ob_start("ob_gzhandler"); |
80 | 85 | |
81 | 86 | echo mweGetFromFileCache( self::$hash ); |
82 | 87 | |
83 | 88 | // Clear and send the buffer: |
84 | | - ob_end_flush(); |
| 89 | + //ob_end_flush(); |
85 | 90 | // exit ( don't continue resource loader handling ) |
86 | 91 | exit(1); |
87 | 92 | } |
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/includes/DefaultSettings.php |
— | — | @@ -9,12 +9,11 @@ |
10 | 10 | // The default cache directory |
11 | 11 | $wgScriptCacheDirectory = realpath( dirname( __FILE__ ) ) . '/cache'; |
12 | 12 | |
13 | | - |
14 | 13 | /** |
15 | 14 | * Guess at URL to resource loader load.php |
16 | 15 | */ |
17 | | -$protocol = ( isset( $_SERVER['HTTPS'] ) )? 'https' : 'http'; |
18 | | -$wgServer = $protocol . '://' . $_SERVER['SERVER_NAME'] . dirname( $_SERVER['SCRIPT_NAME'] ) . '/'; |
| 16 | +$wgProto = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; |
| 17 | +$wgServer = $wgProto . '://' . $_SERVER['SERVER_NAME'] . dirname( $_SERVER['SCRIPT_NAME'] ) . '/'; |
19 | 18 | |
20 | 19 | // By default set $wgScriptPath to empty |
21 | 20 | $wgScriptPath = ''; |
— | — | @@ -103,5 +102,3 @@ |
104 | 103 | require_once( $wgLocalSettingsFile ); |
105 | 104 | } |
106 | 105 | |
107 | | - |
108 | | -?> |
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/resources/MwEmbedSharedResources.php |
— | — | @@ -386,13 +386,13 @@ |
387 | 387 | ), |
388 | 388 | ), |
389 | 389 | |
390 | | - 'mediawiki.language.parser' => new MwEmbedResourceLoaderFileModule( array( |
| 390 | + /*'mediawiki.language.parser' => new MwEmbedResourceLoaderFileModule( array( |
391 | 391 | 'scripts' => 'resources/mediawiki.language/mediawiki.language.parser.js', |
392 | 392 | 'dependencies' => array( 'mediawiki.language', 'mediawiki.util' ), |
393 | 393 | 'debugScripts' => 'resources/mediawiki.language/mediawiki.language.parserTest.js', |
394 | 394 | // @@FIXME note the messages are only needed for debugScirpts |
395 | 395 | // It appears that debugScripts can only be direct resource paths not 'modules' |
396 | 396 | 'messages' => array( 'undelete_short', 'category-subcat-count' ) |
397 | | - ) ), |
| 397 | + )),*/ |
398 | 398 | |
399 | 399 | ); |
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/mwEmbedLoader.php |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Legacy entry point to resource loader |
| 5 | + */ |
| 6 | +// Set the request variables: |
| 7 | +$_REQUEST['modules'] = 'startup'; |
| 8 | +$_REQUEST['only'] = 'scripts'; |
| 9 | +include_once( 'load.php' ); |
\ No newline at end of file |
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/remotes/AddMediaWizardEditPage.js |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | 'uploadEngine' : 'uploadWizard', |
23 | 23 | |
24 | 24 | // Here we can setup the content provider overrides |
25 | | - 'enabled_providers': ['wiki_commons'], |
| 25 | + 'enabled_providers': ['commons'], |
26 | 26 | // The local wiki API URL: |
27 | 27 | 'local_wiki_apiUrl': wgServer + wgScriptPath + '/api.php' |
28 | 28 | }; |
Index: branches/MwEmbedStandAloneRL1_17/MwEmbedStandAlone/remotes/mediaWiki.js |
— | — | @@ -95,7 +95,7 @@ |
96 | 96 | if( typeof mwAddMediaConfig == 'undefined'){ |
97 | 97 | mwAddMediaConfig = {}; |
98 | 98 | } |
99 | | -mwAddMediaConfig['enabled_providers'] = [ 'wiki_commons', 'upload' ]; |
| 99 | +mwAddMediaConfig['enabled_providers'] = [ 'commons', 'upload' ]; |
100 | 100 | |
101 | 101 | |
102 | 102 | // Special embedplayer handler ( iframe ) |