Projet

Général

Profil

Révision 6eb8d15f

Ajouté par Assos Assos il y a presque 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/includes/cache.inc
23 23
  if ($table) {
24 24
    if (!isset($cache[$table])) {
25 25
      $cid = 'views_data:' . $table;
26
      $data = views_cache_get($cid, TRUE);
27
      if (!empty($data->data)) {
26
      if ($data = views_cache_get($cid, TRUE)) {
28 27
        $cache[$table] = $data->data;
29 28
      }
30 29
      else {
31 30
        if (!$fully_loaded) {
32
          // No cache entry, rebuild.
33
          $cache = _views_fetch_data_build();
31
          // Try to load the full views cache.
32
          if ($data = views_cache_get('views_data', TRUE)) {
33
            $cache = $data->data;
34
          }
35
          else {
36
            // No cache entry, rebuild.
37
            $cache = _views_fetch_data_build();
38
          }
34 39
          $fully_loaded = TRUE;
35 40
        }
41

  
42
        // Write back a cache for this table.
43
        if (isset($cache[$table])) {
44
          views_cache_set($cid, $cache[$table], TRUE);
45
        }
46
        else {
47
          // If there is still no information about that table, it is missing.
48
          // Write an empty array to avoid repeated rebuilds.
49
          views_cache_set($cid, array(), TRUE);
50
        }
36 51
      }
37 52
    }
38 53
    if (isset($cache[$table])) {
......
82 97

  
83 98
  // Keep a record with all data.
84 99
  views_cache_set('views_data', $cache, TRUE);
85
  // Save data in seperate cache entries.
86
  foreach ($cache as $key => $data) {
87
    $cid = 'views_data:' . $key;
88
    views_cache_set($cid, $data, TRUE);
89
  }
90 100
  return $cache;
91 101
}
92 102

  

Formats disponibles : Unified diff