0
votes

I recently acquired access to a preconfigured Drupal website. I noticed some issues loading specific admin panels, so I ended up disabling the Adaptive Theme -AT Admin theme. I got a WSOD, and managed to reenable it, but now all my admin pages are returning this error:

Fatal error: Cannot redeclare adaptivetheme_admin_preprocess_page() (previously declared in /nas/webroot/mydomain.com/web/dev/themes/adaptivetheme/at_admin/template.php:6) in /nas/webroot/mydomain.com/web/dev/themes/adaptivetheme/at_admin/template.php on line 47

Here's the file it's talking about:

<?php

/**
 * Override or insert variables into page templates.
 */
function adaptivetheme_admin_preprocess_page(&$vars) {
  // RFC2822 date format
  if ($rfc = date("r" , time())) {
    $vars['datetime_rfc'] = t('@time', array('@time' => $rfc));
  }
  else {
    $rfc = '';
    $vars['datetime_rfc'] = '';
  }
  // ISO 8601 date format
  if ($iso = gmdate('Y-m-d\TH:i:sO')) {
    $vars['datetime_iso'] = $iso;
  }
  else {
    $iso = '';
    $vars['datetime_iso'] = '';
  }

  $vars['content_header_attributes_array']['class'][] = 'branding-elements';
  $vars['content_header_attributes_array']['role'][] = 'banner';
}

/**
 * Alter the search block form.
 */
function adaptivetheme_admin_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'search_block_form') {
    $form['search_block_form']['#title'] = t('Search');
    $form['search_block_form']['#title_display'] = 'invisible';
    $form['search_block_form']['#size'] = 20;
    $form['search_block_form']['#attributes']['placeholder'] = t('Search');
    $form['actions']['submit']['#value'] = t('Go');
  }
}

function adaptivetheme_admin_preprocess_page(&$vars) {
  global $user;
  $vars['datetime_rfc'] = '';
  $vars['datetime_iso'] = '';
  $vars['datetime_rfc'] = date("r" , time()); // RFC2822 date format
  $vars['datetime_iso'] = date("c" , time()); // ISO 8601 date format
}

I'm pretty green on Drupal administration. I'd simply like to get the admin panel working again. I tried flushing all the caches, but get a different error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 280097 bytes) in /nas/webroot/mydomain.com/web/dev/includes/cache.inc on line 463

I found I can make quick changes if I login through SFTP and change the name of this particular sub-theme's folder. A bare-version of the admin shows up, but returns the same error after 15 seconds or so. This allowed me to at least re-enable the theme, but I'm unsure why it's still not loading.

1
Your directory structure according to the above warning off. Your custom and contrib themes should be located at <drupal-directory>/sites/all/themes/<theme>. It looks like you put it right into <drupal-directory>/themes/<theme>. This will delete your theme when you update Drupal core. - danielson317

1 Answers

1
votes

Fatal error: Cannot redeclare adaptivetheme_admin_preprocess_page() tells that function adaptivetheme_admin_preprocess_page() defined twice in template.php. As you can see it is on line 6 and line 47. So you need to remove one of them. Or probably merge code and left only one definition of function.

Memory issue you can fix by increasing of php memory limit value. Seems now you have 128MB. Try to increase it up to 512MB, it should be good enough for drupal.