? .svn
? modules/.svn
? po/.svn
Index: views.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/views.module,v
retrieving revision 1.166.2.45
diff -u -p -r1.166.2.45 views.module
--- views.module	12 Jan 2008 18:35:02 -0000	1.166.2.45
+++ views.module	30 Apr 2008 15:15:48 -0000
@@ -179,7 +179,10 @@ function views_menu_admin_items(&$items,
  * overly intensive.
  */
 function views_get_all_urls() {
-  $cache = cache_get("views_urls", 'cache_views');
+  static $cache;
+  if (!isset($cache)) {
+    $cache = cache_get("views_urls", 'cache_views');
+  }
   if ($cache == 0) {
     $views = array();
     $used = array();
@@ -565,11 +568,13 @@ function views_build_view($type, &$view,
   }
 
   $query = db_rewrite_sql($info['query'], 'node');
+  $query = str_replace('[SUBQUERY]', $info['subquery'], $query);
 
   $items = array();
   if ($query) {
     if ($view->use_pager) {
       $cquery = db_rewrite_sql($info['countquery'], 'node', 'nid', $info['rewrite_args']);
+      $cquery = str_replace('[SUBQUERY]', $info['subquery'], $cquery);
       $result = pager_query($query, $view->pager_limit, $view->use_pager - 1, $cquery, $info['args']);
       $view->total_rows = $GLOBALS['pager_total_items'][$view->use_pager - 1];
     }
@@ -704,6 +709,21 @@ function _views_get_timezone() {
   return $timezone;
 }
 
+/*
+ * Determine whether or not the database supports sub-queries.
+ */
+function _views_is_subquery() {
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+      return version_compare(mysql_get_server_info(), '4.1', '>=');
+      
+    // because mysqli is 4.1 or greater
+    case 'mysqli':
+    case 'pgsql':
+      return TRUE;
+  }
+}
+
 /**
  * Figure out what the URL of the view we're currently looking at is.
  */
@@ -910,15 +930,21 @@ function views_load_view($arg) {
  */
 function _views_load_view($arg) {
   static $cache = array();
+  static $cache_null = array();
+  
   $which = is_numeric($arg) ? 'vid' : 'name';
   if (isset($cache[$which][$arg])) {
     return $cache[$which][$arg];
   }
+  if (isset($cache_null[$which][$arg])) {
+    return NULL;
+  }
 
   $where = (is_numeric($arg) ? "v.vid =  %d" : "v.name = '%s'");
   $view = db_fetch_object(db_query("SELECT v.* FROM {view_view} v WHERE $where", $arg));
 
   if (!$view->name) {
+    $cache_null[$which][$arg] = TRUE;
     return NULL;
   }
 
@@ -2144,4 +2170,4 @@ function views_form_alter($form_id, &$fo
 // An implementation of hook_devel_caches() from devel.module. Must be in views.module so it always is included.
 function views_devel_caches() {
   return array('cache_views');
-}
\ No newline at end of file
+}
Index: views_cache.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/Attic/views_cache.inc,v
retrieving revision 1.2.2.19
diff -u -p -r1.2.2.19 views_cache.inc
--- views_cache.inc	10 Jan 2008 20:15:40 -0000	1.2.2.19
+++ views_cache.inc	30 Apr 2008 15:15:48 -0000
@@ -276,7 +276,7 @@ function _views_get_query(&$view, $args,
   else {
     views_load_query();
     $info = _views_build_query($view, $args, $filters);
-    if ($view->is_cacheable) {
+    if ($view->is_cacheable && strpos($info['query'], '[SUBQUERY]') === FALSE) {
       cache_set('views_query:' . $view->name, 'cache_views', serialize($info));
     }
   }
Index: views_query.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/Attic/views_query.inc,v
retrieving revision 1.51.2.12
diff -u -p -r1.51.2.12 views_query.inc
--- views_query.inc	10 Jan 2008 20:15:40 -0000	1.51.2.12
+++ views_query.inc	30 Apr 2008 15:15:49 -0000
@@ -63,9 +63,10 @@ function _views_build_query(&$view, $arg
 
   $info['query'] = $query->query();
   $info['countquery'] = $query->query(true);
+  $info['subquery'] = $query->subquery();
   $info['summary'] = $summary;
   $info['level'] = $level;
-  $info['args'] = $query->where_args;
+  $info['args'] = array_merge($query->subquery_args, $query->where_args);
 
   return $info;
 
@@ -289,11 +290,13 @@ class _views_query {
     $this->primary_table = $primary_table;
     $this->primary_field = $primary_field;
     $this->joins = array();
+    $this->subquery = array();
     $this->where = array();
     $this->orderby = array();
     $this->groupby = array();
     $this->tables = array();
     $this->where_args = array();
+    $this->subquery_args = array();
     $this->use_alias_prefix = $alias_prefix;
     // Joins care about order, so we put our tables in a queue to make sure
     // the order is correct.
@@ -443,6 +446,31 @@ class _views_query {
   }
 
   /*
+   * Add a subquery as a table join to the query.
+   *
+   * @param $query
+   *   The SQL of the subquery to add.
+   * @param $args
+   *   The subquery's replacable arguments
+   * @param $joininfo
+   *   specify how to join the table
+   * @param $alias
+   *   the alias name associated with the subquery
+   */
+  function add_subquery($query, $args, $joininfo, $alias) {
+    if (_views_is_subquery()) {
+      $this->subquery[$alias] = $query;
+      $this->joins[$alias][0] = $joininfo;
+      $this->subquery_args = array_merge($this->subquery_args, $args);
+    }
+    else {
+      if (db_query_temporary($query, $args, $alias)) {
+        $this->add_table($alias, FALSE, 1, $join);
+      }
+    }
+  }
+
+  /*
    * This function will add a table to the query.
    *
    * @param $table
@@ -580,6 +608,9 @@ class _views_query {
       $this->no_distinct = TRUE;
     }
 
+    // Add a placeholder for sub-queries
+    $joins = count($this->subquery) ? '[SUBQUERY]' : '';
+
     // Add all the tables to the query via joins. We assume all LEFT joins.
     foreach ($this->tablequeue as $tinfo) {
       $table = $tinfo['table'];
@@ -658,4 +689,24 @@ class _views_query {
 
     return $query;
   }
+
+  /*
+   * Return the join clauses for all of the sub-queries.
+   * Do this here instead of in query() because db_rewrite_sql() improperly
+   * rewrites sub-queries.  See http://drupal.org/node/151910
+   */
+  function subquery() {
+    // Add the subqueries to the query via joins.
+    foreach ($this->subquery as $alias => $query) {
+      $joininfo = $this->joins[$alias][0];
+
+      $left_table_alias = isset($joininfo['left']['alias']) ? $joininfo['left']['alias'] : $tinfo['alias_prefix'];
+      $left_table_alias .= $joininfo['left']['table'];
+
+      $join_type = $joininfo['type'] == 'inner' ? 'INNER' : 'LEFT';
+      $joins .= " $join_type JOIN (" . $query . ") $alias ON " . $left_table_alias .".".
+        $joininfo['left']['field'] . " = $alias." . $joininfo['right']['field'];
+    }
+    return $joins;
+  }
 }
Index: views_ui.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/views_ui.module,v
retrieving revision 1.44.2.25
diff -u -p -r1.44.2.25 views_ui.module
--- views_ui.module	14 Jul 2007 19:54:20 -0000	1.44.2.25
+++ views_ui.module	30 Apr 2008 15:15:49 -0000
@@ -334,6 +334,7 @@ function views_ui_admin_tools() {
     '#type' => 'submit',
     '#value' => t('Clear views cache'),
   );
+  $form['#skip_duplicate_check'] = TRUE;
 
   return $form;
 }
Index: po/hu.po
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/po/Attic/hu.po,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 hu.po
--- po/hu.po	21 Feb 2007 18:56:09 -0000	1.1.2.1
+++ po/hu.po	30 Apr 2008 15:15:50 -0000
@@ -56,8 +56,8 @@ msgid "Title"
 msgstr "Cím"
 
 #: views.info:0 views_rss.info:0 views_theme_wizard.info:0 views_ui.info:0
-msgid "$Name:  $"
-msgstr "$Name:  $"
+msgid "$Name: DRUPAL-5 $"
+msgstr "$Name: DRUPAL-5 $"
 
 #: modules/views_comment.inc:26 modules/views_node.inc:17
 msgid "With updated mark"
