function _sassy_check_phpsass_version in Sassy 7.2
1 call to _sassy_check_phpsass_version()
- sassy_requirements in ./
sassy.install - Implementation of hook_requirements().
File
- ./
sassy.install, line 48
Code
function _sassy_check_phpsass_version() {
$url = 'https://raw.github.com/richthegeek/phpsass/master/VERSION';
$pattern = '/^Version ([0-9]+)/';
$result = drupal_http_request($url);
if ($result && $result->code == 200 && preg_match($pattern, $result->data, $matches)) {
$remote = intval($matches[1], 10);
}
else {
return -1;
}
if (!($path = libraries_get_path('phpsass'))) {
$path = libraries_get_path('phamlp');
}
$local = @file_get_contents($path . '/VERSION');
if (preg_match($pattern, $local, $matches)) {
$local = intval($matches[1], 10);
return $local >= $remote ? 1 : 0;
}
return 0;
}