security update core+modules
This commit is contained in:
@@ -1,62 +1,71 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Implements HOOK_enable().
|
||||
* @file
|
||||
* Install, update, and uninstall functions for the less module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_uninstall().
|
||||
*/
|
||||
function less_enable() {
|
||||
drupal_theme_rebuild();
|
||||
}
|
||||
|
||||
function less_uninstall() {
|
||||
variable_del('less_devel');
|
||||
|
||||
variable_del('less_engine');
|
||||
|
||||
variable_del(LESS_DEVEL);
|
||||
variable_del(LESS_WATCH);
|
||||
variable_del(LESS_SOURCE_MAPS);
|
||||
|
||||
variable_del('less_dir');
|
||||
|
||||
cache_clear_all('less:', 'cache', TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_requirements().
|
||||
*
|
||||
* @param $phase The phase in which hook_requirements is run: install or runtime.
|
||||
* Implements hook_requirements().
|
||||
*/
|
||||
function less_requirements($phase) {
|
||||
$requirements = array();
|
||||
|
||||
$lessc_exists = FALSE;
|
||||
|
||||
module_load_include('module', 'less');
|
||||
if (function_exists('_less_inc')) {
|
||||
$lessc_exists = _less_inc();
|
||||
}
|
||||
$t = get_t();
|
||||
|
||||
switch ($phase) {
|
||||
case 'runtime':
|
||||
if ($lessc_exists) {
|
||||
|
||||
$less_engine_loaded = _less_inc();
|
||||
|
||||
if (!empty($less_engine_loaded)) {
|
||||
|
||||
$loaded_engine = libraries_detect($less_engine_loaded);
|
||||
|
||||
$requirements['less_version'] = array(
|
||||
'title' => t('LESS'),
|
||||
'value' => isset(lessc::$VERSION) ? preg_replace('/([^0-9\.-])+/i', '', lessc::$VERSION) : '(less than v0.3.2)',
|
||||
'description' => t('To check for newer versions of lessphp, go to <a href="!url" target="_blank">http://leafo.net/lessphp/</a>', array("!url" => url('http://leafo.net/lessphp/'))),
|
||||
'title' => $t('LESS'),
|
||||
'value' => $loaded_engine['name'] . ' - v' . $loaded_engine['version'],
|
||||
'description' => $t('To check for newer versions go to <a href="@vendor_url" target="_blank">@vendor_url</a>.', array('@vendor_url' => $loaded_engine['vendor url'])),
|
||||
'severity' => REQUIREMENT_OK,
|
||||
);
|
||||
}
|
||||
if (variable_get('less_devel', FALSE)) {
|
||||
$requirements['less_devel'] = array(
|
||||
'title' => 'LESS developer mode',
|
||||
'value' => t('Enabled'),
|
||||
'description' => t('LESS files are being regenerated on every request. Remember to <a href="!url">turn off</a> this feature on production websites.', array("!url" => url('admin/config/development/less'))),
|
||||
'severity' => REQUIREMENT_WARNING,
|
||||
);
|
||||
}
|
||||
if (!$lessc_exists) {
|
||||
else {
|
||||
$requirements['less_library'] = array(
|
||||
'title' => 'LESS',
|
||||
'description' => t('The lessphp library was not detected. Please follow the instructions on the <a href="!url" target="_blank">LESS project page</a> to install the lessphp library.', array("!url" => url('http://drupal.org/project/less'))),
|
||||
'title' => $t('LESS'),
|
||||
'value' => '',
|
||||
'description' => $t('A LESS library was not detected. Please follow the instructions on the <a href="!url" target="_blank">LESS project page</a> to install the a LESS library.', array("!url" => url('https://drupal.org/project/less'))),
|
||||
'severity' => REQUIREMENT_ERROR,
|
||||
);
|
||||
}
|
||||
if (variable_get(LESS_DEVEL, FALSE)) {
|
||||
$requirements[LESS_DEVEL] = array(
|
||||
'title' => 'LESS developer mode',
|
||||
'value' => $t('Enabled'),
|
||||
'description' => $t('LESS files are being checked on every request. Remember to <a href="!url">turn off</a> this feature on production websites.', array("!url" => url('admin/config/development/less'))),
|
||||
'severity' => REQUIREMENT_WARNING,
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return $requirements;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user