Skip to content

Commit 7f0c9f1

Browse files
author
Josh Walker
committed
#123: Getting rid of errors when things don't exist and also removing old code outside of function.
1 parent fc7eb4d commit 7f0c9f1

File tree

1 file changed

+12
-44
lines changed

1 file changed

+12
-44
lines changed

includes/utils.inc

+12-44
Original file line numberDiff line numberDiff line change
@@ -326,29 +326,31 @@ function kalatheme_backend_check() {
326326
if (isset($check['messages'][$bool])) {
327327
$message = $check['messages'][$bool];
328328
$status = $check['bool'] ? 'status' : 'error';
329-
329+
330330
// Make sure we don't set a message twice.
331331
$already_set = FALSE;
332-
foreach ($messages[$status] as $existing) {
333-
if ($existing == $message) {
334-
$already_set = TRUE;
335-
break;
332+
if (isset($messages[$status])) {
333+
foreach ($messages[$status] as $existing) {
334+
if ($existing == $message) {
335+
$already_set = TRUE;
336+
break;
337+
}
336338
}
337339
}
338-
340+
339341
if (!$already_set) {
340342
drupal_set_message($message, $status);
341343
}
342344
}
343345
}
344346
}
345-
347+
346348
return ($info['install_permissions'] && $info['updates_module']);
347349
}
348350

349351
/**
350352
* Store and return info about backend features that we might need for Kalatheme
351-
* to work properly.
353+
* to work properly.
352354
*/
353355
function kalatheme_backend_check_info(){
354356
$info = array(
@@ -384,7 +386,7 @@ function kalatheme_backend_check_info(){
384386
),
385387
),
386388
);
387-
389+
388390
// This one is a conglomerate of some of the others.
389391
$info['install_permissions'] = array(
390392
'bool' => $info['ftp']['bool'] || $info['ssh']['bool'] || $info['write_access']['bool'],
@@ -393,44 +395,10 @@ function kalatheme_backend_check_info(){
393395
FALSE => t('Kalatheme need FTP, SSH or write access in order to generate a subtheme.'),
394396
),
395397
);
396-
398+
397399
return $info;
398400
}
399401

400-
401-
if (isset($_SERVER['PANTHEON_ENVIRONMENT'])) {
402-
$form['pantheon_check'] = array(
403-
'#weight' => -100,
404-
'#prefix' => '<div class="alert alert-info">',
405-
'#markup' => t("You are on Pantheon. <strong>You need to set the connection mode to SFTP</strong> to allow for custom Bootstrap libraries and subtheme generation!"),
406-
'#suffix' => '</div>',
407-
);
408-
}
409-
else {
410-
if (kalatheme_backend_check()) {
411-
$form['backend_check'] = array(
412-
'#weight' => -100,
413-
'#prefix' => '<div class="alert alert-success">',
414-
'#markup' => t("Your webserver is correctly configured to allow for custom Bootstrap libraries and subtheme generation!"),
415-
'#suffix' => '</div>',
416-
);
417-
}
418-
else {
419-
$form['backend_check'] = array(
420-
'#weight' => -100,
421-
'#prefix' => '<div class="alert alert-danger">',
422-
'#markup' => t("If you want Kalatheme to be able to use custom Bootstrap libraries or generate subthemes automatically please properly configure your webserver."),
423-
// @todo add link to docs here
424-
'#suffix' => '</div>',
425-
);
426-
}
427-
}
428-
429-
430-
431-
432-
433-
434402
/**
435403
* Check whether Kalatheme has write access to libraries and modules directories.
436404
*

0 commit comments

Comments
 (0)