Whenever I clear the cache with drush, the sidebar disappears, i.e., the $sidebar_first variable in php.tpl.php is blank.

Lately I've been coming upon my site and the sidebar is gone. Don't feel like I cleared the cache with drush, but cron's being run from the cli and that might be doing it. Might have cleared it though. Hmm. Been doing some active dev work on it lately.

I can restore the blocks by clearing the cache using the devel module's cache-clear dropdown.

My site's been doing for a couple of years, current drupal current modules, etc. I hesitated to file a bug here in Zen because there's a couple drupal core bugs related but not actually this issue.

https://drupal.org/node/1172560 and https://drupal.org/node/1173012

Well, I can't say I have much more for you. I have a hunch this is a zen bug. Any ideas? What should I check out?

Peace,
Jeremy

Comments

shruti.sheth’s picture

Hi,
I am trying to create a new zen sub theme and also cleared cache and cron run through drush, but couldn't encounter the above issue.

Can you explain in detail how is your theme implemented.

Thanks,
Shruti Sheth

glass.dimly’s picture

Thank you for researching this issue. Much appreciated.

As an update, when I run drush cc all I can replicate, but also the issue manifests randomly when I leave it for day or so. I cannot replicate the issue by running cron either through drush or wget, so I'm a bit mystified at its recurrence.

As for the site, It's a zen subtheme. Nothing special. None of the block regions are changed. Well, until now.

My sites was created and updated through 2-3 years of updates, so it would be hard to replicate it. I've search-and-replaced sidebar_first with sidebar_only, and sidebar-first with sidebar-only, then re-added all my blocks to the new region. No change, block regions still disappear on drush cache clear.

Here's the code in page.tpl.php that prints it, nothing special. Below is my .info file.

			<div id="main-left">
      	<?php print $sidebar_only; ?>
			</div>

; $Id: glass_zen.info.txt,v 1.16.2.2 2010/06/26 16:05:31 johnalbin Exp $

  ; The name and description of the theme used on the admin/build/themes page.
name        = xxx zen theme
description = Read the <a href="http://drupal.org/node/629510">online docs</a> or the included README.txt on how to create a Zen sub-theme.

  ; The screenshot used on the admin/build/themes page.
screenshot = screenshot.png

  ; "core" specifies the version of Drupal that this theme is compatible with.
  ; "base theme" specifies that this is a theme that uses the "zen" theme as its
  ; base theme. Its unlikely you will ever need to change these, but they are
  ; required fields for a Zen sub-theme. The "engine" field is not used in a
  ; sub-theme since the engine is inherited from its base theme.
core       = 6.x
base theme = zen

  ; This section adds CSS files to your theme. The media type is specified in
  ; the brackets. Typical CSS media types include "all", "screen", "print", and
  ; "handheld". See http://www.w3.org/TR/CSS21/media.html#media-types for a full
  ; list of stylesheet media types in CSS 2.1. The iPhone's preferred media type
  ; is based on the CSS3 Media queries. http://www.w3.org/TR/css3-mediaqueries/
  ;
  ; You can also override any of Zen's stylesheets or any module's stylesheets,
  ; an /extremely/ useful feature. See the excellent Drupal 6 Theme Guide at
  ; http://drupal.org/node/171209 for more details.
stylesheets[all][] = css/fontsquirrel_stylesheet.css
stylesheets[all][]   = css/html-reset.css
stylesheets[all][]   = css/wireframes.css
stylesheets[all][]   = css/layout-fixed.css
stylesheets[all][]   = css/page-backgrounds.css
stylesheets[all][]   = css/tabs.css
stylesheets[all][]   = css/messages.css
stylesheets[all][]   = css/pages.css
stylesheets[all][]   = css/block-editing.css
stylesheets[all][]   = css/blocks.css
stylesheets[all][]   = css/navigation.css
stylesheets[all][]   = css/panels-styles.css
stylesheets[all][]   = css/views-styles.css
stylesheets[all][]   = css/nodes.css
stylesheets[all][]   = css/comments.css
stylesheets[all][]   = css/forms.css
stylesheets[all][]   = css/fields.css
stylesheets[print][] = css/print.css
stylesheets[all][] = css/glass-zen.css

; stylesheets[handheld][] = css/mobile.css
; stylesheets[only screen and (max-device-width: 480px)][] = css/iphone.css

  ; Set the conditional stylesheets that are processed by IE.
conditional-stylesheets[if IE][all][]       = css/ie.css
conditional-stylesheets[if lte IE 6][all][] = css/ie6.css

  ; Optionally add some JavaScripts to your theme.
scripts[] = js/browser_select.js

  ; The regions defined in Zen's default page.tpl.php file.  The name in
  ; brackets is the name of the variable in the page.tpl.php file, (e.g.
  ; "[content_top]" in the .info file means there should be a $content_top
  ; variable in the page.tpl.php file.) The text after the equals sign is a
  ; descriptive text used on the admin/build/blocks page.
  ;
  ; To add a new region, copy Zen's page.tpl.php to your sub-theme's directory,
  ; add a line line to this file, and then add the new variable to your
  ; page.tpl.php template.
regions[sidebar_only]  = Sidebar Only
regions[sidebar_second] = Second sidebar
regions[navigation]     = Navigation bar
regions[highlight]      = Highlighted content
regions[content_top]    = Content top
regions[content_bottom] = Content bottom
regions[header]         = Header
regions[footer]         = Footer
regions[page_closure]   = Page closure

  ; Various page elements output by the theme can be toggled on and off. The
  ; "features" control which of these check boxes display on the
  ; admin/build/themes config page. This is useful for suppressing check boxes
  ; for elements not used by your sub-theme. To suppress a check box, omit the
  ; entry for it below. See the Drupal 6 Theme Guide for more info:
  ; http://drupal.org/node/171205#features
features[] = logo
features[] = name
features[] = slogan
features[] = mission
features[] = node_user_picture
features[] = comment_user_picture
features[] = search
features[] = favicon
features[] = primary_links
features[] = secondary_links

  ; Set the default settings to be used in theme-settings.php
settings[zen_block_editing]        = 1
settings[zen_breadcrumb]           = yes
settings[zen_breadcrumb_separator] = ' › '
settings[zen_breadcrumb_home]      = 1
settings[zen_breadcrumb_trailing]  = 1
settings[zen_breadcrumb_title]     = 0
settings[zen_rebuild_registry]     = 0
settings[zen_wireframes]           = 0
shruti.sheth’s picture

Hi,
Thanks, for posting your .info and page.tpl.php code. I would suggest you try following approaches, might be they prove helpful,
1. Disable your site cache and turn off your daily cron
2. Check console for each page, if any javascript is causing that
3. You can try disabling each module and debug, sometimes some modules do conflict and create such issues

I hope one of the above helps you solve your problem.

Thanks,
Shruti Sheth

glass.dimly’s picture

Title: Sidebar disappears on drush cache clear » Sidebar disappears on drush cache clear or blocks print empty content div
glass.dimly’s picture

Status: Active » Closed (cannot reproduce)

Alright, here's my workaround/fix. Which is not a fix, exactly.

Put this in your page.tpl.php before it prints the sidebar.

//var_dump(strlen($sidebar_only)); //uncomment to figure out how many chars in an empty block region, beats a regex!
$value_greater_than_empty_block_region = 10000; //add that value here
if (strlen($your_sidebar_name) < $value_greater_than_empty_block_region) {
	drupal_flush_all_caches(); //clears the cache
	$block_cache_clear_number = variable_get('block_cache_clear_number', 0) + 1; //gets how many times this has happened
	variable_set('block_cache_clear_number', $block_cache_clear_number);
	watchdog('block_weirdness', "cleared the weird block cache now ". $block_cache_clear_number ." times since Your_Date_Here." ); //logs the cache clear
	drupal_goto(); //refreshes the page with the cleared cache
}

Simple, effective, ugly. But legit. If this is happening all the time to me I'll post code that clears just the block cache, right now I don't think it matters because this happens infrequently.

I'm closing this because I don't think it belongs in Zen.