Just wondering whether someone else is seeing this problem too.

As I work with my sites, they, at some point, completely forget about their themes.

I'd like to know where that info is saved so I could write a little something to see how it is being deleted by tracking that value. Then I could let you know what is happening. It most certainly is because of one of the 100 or so modules I'm using, but that does not help much.

So if possible, please, let me know where the info saved from admin/build/themes is saved.

Thank you!
Alexis Wilke

Comments

dave reid’s picture

What exactly do you lose? Theme settings? The enabled themes?

andypost’s picture

dave reid’s picture

Status: Active » Closed (duplicate)

That's what I thought, but I just wanted to check. We should get it fixed very soon!

andypost’s picture

Status: Closed (duplicate) » Postponed (maintainer needs more info)

I've reopen this bug because this problem not only on update.php #305653: Themes disabled during update

My env:

drupal 6.6
psql (PostgreSQL) 8.1.9
php 5.2.6

there are 3 sites (multisiting)
2 of them has different domains and sits sites/name1.domain/ and sites/name2.domain/
third site is /sub/sites/name2.domain.sub/

all of them has a different DBs but only 3rd site "randomly" (no update no cron) loose theme (row with custom theme just removes from table{system})

Once I visit mysite/sub/admin theme returns

Modules

Drupal 6.6
: Block, Database logging, Filter, Help, Locale, Menu, Node, PHP filter, Search, System, Taxonomy, Update status, Upload, User

FCKeditor - WYSIWYG HTML editor 6.x-1.3-rc5

Image 6.x-1.0-alpha3
: Image

Meta tags 6.x-1.0-rc1
: Meta tags

Taxonomy Menu 6.x-1.01
: Taxonomy Menu

Webform 6.x-2.3
: Webform
AlexisWilke’s picture

Hi guys,

I do not really know when it happens.

But yes, it looks like what is mentioned in #305653: Themes disabled during update.

I will check to see weather I lose something or not on my next update which should be very soon (As usual)!

The symptoms are as described in the other bug. There are times when I go to the Themes panel to see that no theme is enabled and none is marked as the default. Although the site continues to work even if I do not hit save, it would be tedious if I had to select 20 themes each time!

Thank you.
Alexis

andypost’s picture

After some investigation I found only few occurrences of system_theme_data
One of them update_get_projects which clears its cache every hour and then reread all projects and themes


function update_get_projects() {
  static $projects = array();
  if (empty($projects)) {
    // Retrieve the projects from cache, if present.
    $projects = update_project_cache('update_project_projects');
    if (empty($projects)) {
      // Still empty, so we have to rebuild the cache.
      _update_process_info_list($projects, module_rebuild_cache(), 'module');
      _update_process_info_list($projects, system_theme_data(), 'theme'); /////////// rebuild all themes 
      // Set the projects array into the cache table.
      cache_set('update_project_projects', $projects, 'cache_update', time() + 3600); ///// every hour - very expensive
    }
  }
  return $projects;
}

function system_theme_data() {
  // Scan the installation theme .info files and their engines.
  $themes = _system_theme_data();

  // Extract current files from database.
  system_get_files_database($themes, 'theme');

  db_query("DELETE FROM {system} WHERE type = 'theme'");

  foreach ($themes as $theme) {
    if (!isset($theme->owner)) {
      $theme->owner = '';
    }

    db_query("INSERT INTO {system} (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, isset($theme->status) ? $theme->status : 0, 0, 0);
  }

  return $themes;
}

Suppose if retrieving updates take a long time this loop can be interrupted and not all data writes to DB. I think better to change DELETE-INSERT_loop to UPDATE-DELETE

AlexisWilke’s picture

Ah! Yes! I have had problems when I try to select too many modules at once. That fails with a timeout.

I would instead strongly advice for a transaction mode:

  db_query('BEGIN');
  ... // do loop
  db_query('COMMIT');

That way, if it times out in the middle, you don't have half way done changes. Now that could be a problem too... But it is much safer.

Thank you.
Alexis

spopovits’s picture

I have the same problem of radomly losing custom theme. What I did notice is that if update.php is run, it appears the next time cron runs it disables the custom theme, but not the core theme.

andypost’s picture

Title: "Randomly" losing theme selection » "Randomly" losing theme selection on cron and update_status

@spopovits This issue about update_status and cron

About update.php please review #305653: Themes disabled during update

spopovits’s picture

I have checked that post and all the forums. this issue queue is closer to what I am seeing. I understand the update function problem and compensate for it, however periodically the non-core theme gets disabled which breaks the site, until I reenable it. There is something else other than the update.php that is disabling the theme.

johnalbin’s picture

Title: "Randomly" losing theme selection on cron and update_status » Themes disabled on cron

FYI, the update.php bug is fixed as of Drupal 6.7/6.8. #305653: Themes disabled during update

And, I've run cron.php many times with update module enable and not experienced this bug. So, its not that module per se. The bug might only be present under some specific configurations.

Those of you who are still experiencing this bug on Drupal 6.8, can you do some more testing to try to narrow down what modules/configurations are causing this?

@andypost, if you think its that line in update module, can 1.) you verify you still have the problem with Drupal 6.8 and then 2.) check if the problem is fixed if you change that line to _update_process_info_list($projects, _system_theme_data(), 'theme');?

AlexisWilke’s picture

Hi John,

I ran at least one update and cron executes once per hour and I had no problems lately.

I'm running 6.8.

I have seen the fixes in the code so I guess the problem was resolved for me.

Thank you.
Alexis Wilke

andypost’s picture

Status: Postponed (maintainer needs more info) » Fixed

After update to 6.8 everything fine...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.