1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
<?php
namespace SMW;
/**
* Internal benchmarks (XDebug) have shown that some extensions may affect the
* performance to a greater degree than expected and can impose a performance
* penalty to the overall system (templates, queries etc.).
*
* If a user is willing to incur those potential disadvantages by setting the
* `CompatibilityMode`, s(he) is to understand the latent possibility of those
* disadvantages.
*
* @license GNU GPL v2+
* @since 2.4
*
* @author mwjames
*/
class CompatibilityMode {
/**
* @since 2.4
*
* @return boolean
*/
public static function extensionNotEnabled() {
if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
return !$GLOBALS['smwgSemanticsEnabled'];
}
$GLOBALS['smwgSemanticsEnabled'] = true;
ApplicationFactory::getInstance()->getSettings()->set( 'smwgSemanticsEnabled', true );
return false;
}
/**
* Allows to run `update.php` with a bare-bone setup in cases where enabledSemantics
* has not yet been enabled.
*
* @since 2.4
*/
public static function enableTemporaryCliUpdateMode() {
$GLOBALS['smwgSemanticsEnabled'] = true;
ApplicationFactory::getInstance()->getSettings()->set( 'smwgSemanticsEnabled', true );
ApplicationFactory::getInstance()->getSettings()->set( 'smwgPageSpecialProperties', [ '_MDAT' ] );
}
/**
* @since 2.4
*/
public static function disableSemantics() {
$disabledSettings = [
'smwgSemanticsEnabled' => false,
'smwgNamespacesWithSemanticLinks' => [],
'smwgQEnabled' => false,
'smwgAutoRefreshOnPurge' => false,
'smwgAutoRefreshOnPageMove' => false,
'smwgFactboxCacheRefreshOnPurge' => false,
'smwgAdminFeatures' => false,
'smwgPageSpecialProperties' => [],
'smwgEnableUpdateJobs' => false,
'smwgEnabledEditPageHelp' => false,
'smwgParserFeatures' => SMW_PARSER_NONE,
];
foreach ( $disabledSettings as $key => $value) {
ApplicationFactory::getInstance()->getSettings()->set( $key, $value );
$GLOBALS[$key] = $value;
}
}
}
|