|
@@ -37,15 +37,15 @@ discard block |
|
|
block discarded – undo |
|
37
|
37
|
|
|
38
|
38
|
$name = $package->getPrettyName(); |
|
39
|
39
|
if (!preg_match('@^.*/simplesamlphp-module-(.+)$@', $name, $matches)) { |
|
40
|
|
- throw new InvalidArgumentException('Unable to install module ' . $name .', package name must be on the form "VENDOR/simplesamlphp-module-MODULENAME".'); |
|
|
40
|
+ throw new InvalidArgumentException('Unable to install module ' . $name . ', package name must be on the form "VENDOR/simplesamlphp-module-MODULENAME".'); |
|
41
|
41
|
} |
|
42
|
42
|
$moduleDir = $matches[1]; |
|
43
|
43
|
|
|
44
|
44
|
if (!preg_match('@^[a-z0-9_.-]*$@', $moduleDir)) { |
|
45
|
|
- throw new InvalidArgumentException('Unable to install module ' . $name .', module name must only contain characters from a-z, 0-9, "_", "." and "-".'); |
|
|
45
|
+ throw new InvalidArgumentException('Unable to install module ' . $name . ', module name must only contain characters from a-z, 0-9, "_", "." and "-".'); |
|
46
|
46
|
} |
|
47
|
47
|
if ($moduleDir[0] === '.') { |
|
48
|
|
- throw new InvalidArgumentException('Unable to install module ' . $name .', module name cannot start with ".".'); |
|
|
48
|
+ throw new InvalidArgumentException('Unable to install module ' . $name . ', module name cannot start with ".".'); |
|
49
|
49
|
} |
|
50
|
50
|
|
|
51
|
51
|
/* Composer packages are supposed to only contain lowercase letters, but historically many modules have had names in mixed case. |
|
@@ -55,10 +55,10 @@ discard block |
|
|
block discarded – undo |
|
55
|
55
|
if (isset($extraData['ssp-mixedcase-module-name'])) { |
|
56
|
56
|
$mixedCaseModuleName = $extraData['ssp-mixedcase-module-name']; |
|
57
|
57
|
if (!is_string($mixedCaseModuleName)) { |
|
58
|
|
- throw new InvalidArgumentException('Unable to install module ' . $name .', "ssp-mixedcase-module-name" must be a string.'); |
|
|
58
|
+ throw new InvalidArgumentException('Unable to install module ' . $name . ', "ssp-mixedcase-module-name" must be a string.'); |
|
59
|
59
|
} |
|
60
|
60
|
if (mb_strtolower($mixedCaseModuleName, 'utf-8') !== $moduleDir) { |
|
61
|
|
- throw new InvalidArgumentException('Unable to install module ' . $name .', "ssp-mixedcase-module-name" must match the package name except that it can contain uppercase letters.'); |
|
|
61
|
+ throw new InvalidArgumentException('Unable to install module ' . $name . ', "ssp-mixedcase-module-name" must match the package name except that it can contain uppercase letters.'); |
|
62
|
62
|
} |
|
63
|
63
|
$moduleDir = $mixedCaseModuleName; |
|
64
|
64
|
} |