1
0
Fork 0

Display prettier messages for second-degree required exts to avoid confusion

pull/1200/head
Jordi Boggiano 2012-10-10 17:54:17 +02:00
parent 5083f4c685
commit a8171f5be0
2 changed files with 23 additions and 2 deletions

View File

@ -81,6 +81,13 @@ class Problem
return "\n - The requested PHP extension ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error.'.';
}
// handle linked libs
if (0 === stripos($job['packageName'], 'lib-')) {
$lib = substr($job['packageName'], 4);
return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' has the wrong version instaled or is missing from your system, make sure to have the extension providing it.';
}
return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' could not be found.';
}
}
@ -88,7 +95,6 @@ class Problem
$messages = array();
foreach ($reasons as $reason) {
$rule = $reason['rule'];
$job = $reason['job'];

View File

@ -191,7 +191,22 @@ class Rule
}
$text .= ' -> satisfiable by '.implode(', ', $requireText).'.';
} else {
$text .= ' -> no matching package found.';
$targetName = $this->reasonData->getTarget();
// handle php extensions
if (0 === strpos($targetName, 'ext-')) {
$ext = substr($targetName, 4);
$error = extension_loaded($ext) ? 'has the wrong version ('.phpversion($ext).') installed' : 'is missing from your system';
$text .= ' -> the requested PHP extension '.$ext.' '.$error.'.';
} elseif (0 === strpos($targetName, 'lib-')) {
// handle linked libs
$lib = substr($targetName, 4);
$text .= ' -> the requested linked library '.$lib.' has the wrong version instaled or is missing from your system, make sure to have the extension providing it.';
} else {
$text .= ' -> no matching package found.';
}
}
return $text;