SemanticMediaWiki /
SemanticApprovedRevs
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | use SMW\ApprovedRevs\Hooks; |
||
| 4 | |||
| 5 | /** |
||
| 6 | * Extension ... |
||
| 7 | * |
||
| 8 | * @see https://github.com/SemanticMediaWiki/SemanticApprovedRevs |
||
| 9 | * |
||
| 10 | * @defgroup SemanticApprovedRevs Semantic Approved Revs |
||
| 11 | */ |
||
| 12 | SemanticApprovedRevs::load(); |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @codeCoverageIgnore |
||
| 16 | */ |
||
| 17 | class SemanticApprovedRevs { |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @since 1.0 |
||
| 21 | * |
||
| 22 | * @note It is expected that this function is loaded before LocalSettings.php |
||
| 23 | * to ensure that settings and global functions are available by the time |
||
| 24 | * the extension is activated. |
||
| 25 | */ |
||
| 26 | public static function load() { |
||
| 27 | if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) { |
||
| 28 | include_once __DIR__ . '/vendor/autoload.php'; |
||
| 29 | } |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @since 1.0 |
||
| 34 | * @see https://www.mediawiki.org/wiki/Manual:Extension.json/Schema#callback |
||
| 35 | */ |
||
| 36 | public static function initExtension( $credits = [] ) { |
||
| 37 | // See https://phabricator.wikimedia.org/T151136 |
||
| 38 | define( 'SMW_APPROVED_REVS_VERSION', isset( $credits['version'] ) ? $credits['version'] : 'UNKNOWN' ); |
||
| 39 | |||
| 40 | $GLOBALS['wgMessagesDirs']['SemanticApprovedRevs'] = __DIR__ . '/i18n'; |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @since 1.0 |
||
| 45 | */ |
||
| 46 | public static function onExtensionFunction() { |
||
| 47 | |||
| 48 | if ( !defined( 'SMW_VERSION' ) ) { |
||
| 49 | if ( PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' ) { |
||
| 50 | die( "\nThe 'Semantic Approved Revs' extension requires the 'Semantic MediaWiki' extension to be installed and enabled.\n" ); |
||
| 51 | } else { |
||
| 52 | die( |
||
| 53 | '<b>Error:</b> The <a href="https://github.com/SemanticMediaWiki/SemanticApprovedRevs/">Semantic Approved Revs</a> extension' . |
||
| 54 | ' requires the <a href="https://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki">Semantic MediaWiki</a> extension to be installed and enabled.<br />' |
||
| 55 | ); |
||
| 56 | } |
||
| 57 | } |
||
| 58 | |||
| 59 | // We expected to check for APPROVED_REVS_VERSION but the extension and |
||
| 60 | // its `extension.json` doesn't set the constant so we have to rely on |
||
| 61 | // active class loading (which is an anti-pattern) to check whether the |
||
| 62 | // extension is enabled or not! |
||
| 63 | if ( !class_exists( 'ApprovedRevs' ) ) { |
||
| 64 | if ( PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' ) { |
||
| 65 | die( "\nThe 'Semantic Approved Revs' extension requires the 'Approved Revs' extension to be installed and enabled.\n" ); |
||
| 66 | } else { |
||
| 67 | die( |
||
| 68 | '<b>Error:</b> The <a href="https://github.com/SemanticMediaWiki/SemanticApprovedRevs/">Semantic Approved Revs</a> extension' . |
||
| 69 | ' requires the <a href="https://www.mediawiki.org/wiki/Extension:Approved_Revs">Approved Revs</a> extension to be installed and enabled.<br />' |
||
| 70 | ); |
||
| 71 | } |
||
| 72 | } |
||
| 73 | |||
| 74 | if ( defined( 'SESP_VERSION' ) && version_compare( SESP_VERSION, '2.1.0', '<' ) && ( $prop = Hooks::hasPropertyDefCollisions( $GLOBALS ) ) !== false ) { |
||
|
0 ignored issues
–
show
|
|||
| 75 | die( |
||
| 76 | "\nPlease remove the `$prop` property (defined by the SemanticExtraSpecialProperties extension) and switch to the new SESP version 2.1" . |
||
| 77 | " to avoid collision with the 'Semantic Approved Revs' list of properties.\n" |
||
| 78 | ); |
||
| 79 | } |
||
| 80 | |||
| 81 | $hooks = new Hooks(); |
||
| 82 | $hooks->register(); |
||
| 83 | } |
||
| 84 | |||
| 85 | } |
||
| 86 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.