File Installer.php
has 1112 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Base code for MediaWiki installer.
*
* DO NOT PATCH THIS FILE IF YOU NEED TO CHANGE INSTALLER BEHAVIOR IN YOUR PACKAGE!
Installer
has 67 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Installer {
/**
* URL to mediawiki-announce list summary page
*/
Function readExtension
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private function readExtension( $fullJsonFile, $extDeps = [], $skinDeps = [] ) {
$load = [
$fullJsonFile => 1
];
if ( $extDeps ) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method readExtension
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function readExtension( $fullJsonFile, $extDeps = [], $skinDeps = [] ) {
$load = [
$fullJsonFile => 1
];
if ( $extDeps ) {
Function dirIsExecutable
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function dirIsExecutable( $dir, $url ) {
$scriptTypes = [
'php' => [
"<?php echo 'exec';",
"#!/var/env php\n<?php echo 'exec';",
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method resetMediaWikiServices
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function resetMediaWikiServices(
?Config $installerConfig = null,
$serviceOverrides = [],
bool $disableStorage = false
) {
Method getInstallSteps
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getInstallSteps( DatabaseInstaller $installer ) {
$coreInstallSteps = [
[ 'name' => 'database', 'callback' => [ $installer, 'setupDatabase' ] ],
[ 'name' => 'tables', 'callback' => [ $installer, 'createTables' ] ],
[ 'name' => 'tables-manual', 'callback' => [ $installer, 'createManualTables' ] ],
Method getExtensionInfo
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getExtensionInfo( $type, $parentRelPath, $name ) {
if ( $this->getVar( 'IP' ) === null ) {
throw new RuntimeException( 'Cannot find extensions since the IP variable is not yet set' );
}
if ( $type !== 'extension' && $type !== 'skin' ) {
Method subscribeToMediaWikiAnnounce
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function subscribeToMediaWikiAnnounce() {
$status = Status::newGood();
$http = MediaWikiServices::getInstance()->getHttpRequestFactory();
if ( !$http->canMakeRequests() ) {
$status->warning( 'config-install-subscribe-fail',
Function getExtensionInfo
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function getExtensionInfo( $type, $parentRelPath, $name ) {
if ( $this->getVar( 'IP' ) === null ) {
throw new RuntimeException( 'Cannot find extensions since the IP variable is not yet set' );
}
if ( $type !== 'extension' && $type !== 'skin' ) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method dirIsExecutable
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function dirIsExecutable( $dir, $url ) {
$scriptTypes = [
'php' => [
"<?php echo 'exec';",
"#!/var/env php\n<?php echo 'exec';",
Method createSysop
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function createSysop() {
$name = $this->getVar( '_AdminName' );
$user = User::newFromName( $name );
if ( !$user ) {
Function findExtensionsByType
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function findExtensionsByType( $type = 'extension', $directory = 'extensions' ) {
if ( $this->getVar( 'IP' ) === null ) {
return Status::newGood( [] );
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method findExtensionsByType
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function findExtensionsByType( $type = 'extension', $directory = 'extensions' ) {
if ( $this->getVar( 'IP' ) === null ) {
return Status::newGood( [] );
}
Method envCheckUploadsServerResponse
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function envCheckUploadsServerResponse() {
$url = $this->getVar( 'wgServer' ) . $this->getVar( 'wgScriptPath' ) . '/images/README';
$httpRequestFactory = MediaWikiServices::getInstance()->getHttpRequestFactory();
$status = null;
Method envCheckDB
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function envCheckDB() {
global $wgLang;
/** @var string|null $dbType The user-specified database type */
$dbType = $this->getVar( 'wgDBtype' );
Function envCheckDB
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function envCheckDB() {
global $wgLang;
/** @var string|null $dbType The user-specified database type */
$dbType = $this->getVar( 'wgDBtype' );
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function createSysop
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function createSysop() {
$name = $this->getVar( '_AdminName' );
$user = User::newFromName( $name );
if ( !$user ) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function subscribeToMediaWikiAnnounce
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function subscribeToMediaWikiAnnounce() {
$status = Status::newGood();
$http = MediaWikiServices::getInstance()->getHttpRequestFactory();
if ( !$http->canMakeRequests() ) {
$status->warning( 'config-install-subscribe-fail',
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return Status::newFatal( 'config-extension-dependency',
basename( dirname( $fullJsonFile ) ), $e->getMessage() );
Avoid too many return
statements within this method. Open
return Status::newGood( $ret );
Function envCheckMemory
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function envCheckMemory() {
$limit = ini_get( 'memory_limit' );
if ( !$limit || $limit == -1 ) {
return true;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"