| 
                                                        @@ -24,7 +24,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    24
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    24
                                                                                                                                                                                                 | 
                                                             	 */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    25
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    25
                                                                                                                                                                                                 | 
                                                             	public static function load() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    26
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    26
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    27
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    27
                                                                                                                                                                                                 | 
                                                            +		if (is_readable(__DIR__ . '/vendor/autoload.php')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    28
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    28
                                                                                                                                                                                                 | 
                                                             			include_once __DIR__ . '/vendor/autoload.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    29
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    29
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    30
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    30
                                                                                                                                                                                                 | 
                                                             	}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -32,10 +32,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    32
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    32
                                                                                                                                                                                                 | 
                                                             	/**  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    33
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    33
                                                                                                                                                                                                 | 
                                                             	 * @since 1.1  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    34
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    34
                                                                                                                                                                                                 | 
                                                             	 */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    35
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -	public static function initExtension( $credits = [] ) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    35
                                                                                                                                                                                                 | 
                                                            +	public static function initExtension($credits = []) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    36
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    36
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    37
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    37
                                                                                                                                                                                                 | 
                                                             		// See https://phabricator.wikimedia.org/T151136  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    38
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		define( 'SCQ_VERSION', isset( $credits['version'] ) ? $credits['version'] : 'UNKNOWN' );  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    38
                                                                                                                                                                                                 | 
                                                            +		define('SCQ_VERSION', isset($credits['version']) ? $credits['version'] : 'UNKNOWN'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    39
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    39
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    40
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    40
                                                                                                                                                                                                 | 
                                                             		// Register message files  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    41
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    41
                                                                                                                                                                                                 | 
                                                             		$GLOBALS['wgMessagesDirs']['SemanticCompoundQueries'] = __DIR__ . '/i18n';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -48,10 +48,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    48
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    48
                                                                                                                                                                                                 | 
                                                             	 */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    49
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    49
                                                                                                                                                                                                 | 
                                                             	public static function onExtensionFunction() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    50
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    50
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    51
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		if ( !defined( 'SMW_VERSION' ) ) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    51
                                                                                                                                                                                                 | 
                                                            +		if (!defined('SMW_VERSION')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    52
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    52
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    53
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			if ( PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' ) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    54
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				die( "\nThe 'Semantic Compound Queries' extension requires 'Semantic MediaWiki' to be installed and enabled.\n" );  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    53
                                                                                                                                                                                                 | 
                                                            +			if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    54
                                                                                                                                                                                                 | 
                                                            +				die("\nThe 'Semantic Compound Queries' extension requires 'Semantic MediaWiki' to be installed and enabled.\n"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    55
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    55
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    56
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    56
                                                                                                                                                                                                 | 
                                                             				die(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    57
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    57
                                                                                                                                                                                                 | 
                                                             					'<b>Error:</b> The <a href="https://www.semantic-mediawiki.org/wiki/Extension:Semantic_Compound_Queries">Semantic Compound Queries</a> ' .  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -66,8 +66,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    66
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    66
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    67
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    67
                                                                                                                                                                                                 | 
                                                             		// wgHooks  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    68
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    68
                                                                                                                                                                                                 | 
                                                             		$hookContainer = MediaWikiServices::getInstance()->getHookContainer();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    69
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$hookContainer->register( 'ParserFirstCallInit', function( Parser &$parser  ) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    70
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$parser->setFunctionHook( 'compound_query', [ '\SCQ\CompoundQueryProcessor', 'doCompoundQuery' ] );  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    69
                                                                                                                                                                                                 | 
                                                            +		$hookContainer->register('ParserFirstCallInit', function(Parser&$parser) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    70
                                                                                                                                                                                                 | 
                                                            +			$parser->setFunctionHook('compound_query', ['\SCQ\CompoundQueryProcessor', 'doCompoundQuery']); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    71
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    71
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    72
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    72
                                                                                                                                                                                                 | 
                                                             			// always return true, in order not to stop MW's hook processing!  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    73
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    73
                                                                                                                                                                                                 | 
                                                             			return true;  |