You are here

function path_breadcrumbs_update_7213 in Path Breadcrumbs 7.3

Same name and namespace in other branches
  1. 7.2 path_breadcrumbs.install \path_breadcrumbs_update_7213()

Change storage behavior for path breadcrumbs data to prevent failures during export/import.

File

./path_breadcrumbs.install, line 217
Provides database structure for PATH BREADCRUMBS module.

Code

function path_breadcrumbs_update_7213() {
  $result = db_select('path_breadcrumbs', 'p')
    ->fields('p')
    ->execute();
  foreach ($result as $path_breadcrumbs) {
    $path_breadcrumbs->data = unserialize($path_breadcrumbs->data);
    $path_breadcrumbs->data['titles'] = explode("\n", $path_breadcrumbs->data['titles']);
    $path_breadcrumbs->data['paths'] = explode("\n", $path_breadcrumbs->data['paths']);

    // Update every path breadcrumb to new data storage mechanism.
    db_update('path_breadcrumbs')
      ->fields(array(
      'data' => serialize($path_breadcrumbs->data),
    ))
      ->condition('path_id', $path_breadcrumbs->path_id)
      ->execute();

    // Clear UI caches.
    ctools_include('object-cache');
    ctools_object_cache_clear_all('path_breadcrumbs', $path_breadcrumbs->machine_name);
  }
}