Completed
Push — master ( 1e1c6b...d3a041 )
by
unknown
18:32
created

SemanticScribunto.php ➔ wfGlobalCacheKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 9.4285
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 23 and the first side effect is on line 11.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
use SMW\Scribunto\HookRegistry;
4
5
/**
6
 * @see https://github.com/SemanticMediaWiki/SemanticScribunto/
7
 *
8
 * @defgroup SemanticScribunto Semantic Scribunto
9
 */
10
if ( !defined( 'MEDIAWIKI' ) ) {
11
	die( 'This file is part of the Semantic Scribunto extension, it is not a valid entry point.' );
12
}
13
14
if ( version_compare( $GLOBALS[ 'wgVersion' ], '1.24', 'lt' ) ) {
15
	die( '<b>Error:</b> This version of <a href="https://github.com/SemanticMediaWiki/SemanticScribunto/">Semantic Scribunto</a> is only compatible with MediaWiki 1.24 or above. You need to upgrade MediaWiki first.' );
16
}
17
18
if ( defined( 'SMW_SCRIBUNTO_VERSION' ) ) {
19
	// Do not initialize more than once.
20
	return 1;
21
}
22
23
define( 'SMW_SCRIBUNTO_VERSION', '1.0.0-alpha' );
24
25
/**
26
 * @codeCoverageIgnore
27
 */
28
call_user_func( function () {
29
30
	// Register extension info
31
	$GLOBALS['wgExtensionCredits']['semantic'][] = array(
32
		'path'           => __FILE__,
33
		'name'           => 'Semantic Scribunto',
34
		'author'         => array( 'James Hong Kong' ),
35
		'url'            => 'https://github.com/SemanticMediaWiki/SemanticScribunto/',
36
		'descriptionmsg' => 'smw-scribunto-desc',
37
		'version'        => SMW_SCRIBUNTO_VERSION,
38
		'license-name'   => 'GPL-2.0+',
39
	);
40
41
	// MW 1.26+
42
	if ( !function_exists( 'wfGlobalCacheKey' ) ) {
43
		function wfGlobalCacheKey( /*...*/ ) {
44
			$args = func_get_args();
45
			$key = 'global:' . implode( ':', $args );
46
			return strtr( $key, ' ', '_' );
47
		}
48
	}
49
50
	// Register message files
51
	$GLOBALS['wgMessagesDirs']['smw-scribunto'] = __DIR__ . '/i18n';
52
53
	// Finalize extension setup
54
	$GLOBALS['wgExtensionFunctions'][] = function() {
55
56
		$hookRegistry = new HookRegistry();
57
		$hookRegistry->register();
58
	};
59
60
} );
61