diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f2354b6b412f34d2d4da386be5c2fdae380f3fc5..2526cbd255f09e34e914d603ec29625f03c24f80 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,7 +3,8 @@ CHANGELOG for Views for Drupal 5 Views 5.x-beta3 Bugs fixed: o Reverting #130196: The original behavior was correct. - + o #135829: Changed a bit how view table fields are defined to help prevent type confusion. + Views 5.x-beta2 Bugs fixed: o #135881: Broken test for 'visible' caused all list fields to disappear. diff --git a/views.install b/views.install index cb59314957e2cb724280f882f6d0637febe12bc4..a2422e8d0760d1411aa6e890caddbe6903e1e190 100644 --- a/views.install +++ b/views.install @@ -409,8 +409,31 @@ function views_update_12() { $ret[] = update_sql("ALTER TABLE {view_view} DROP query"); $ret[] = update_sql("ALTER TABLE {view_view} DROP countquery"); + views_make_cache_table(&$ret); + return $ret; +} + +function views_update_13() { + $ret = array(); + views_make_cache_table(&$ret); + $ret[] = update_sql("DELETE FROM {cache_views}"); + return $ret; +} - $ret[] = update_sql("CREATE TABLE {cache_views} ( +function views_update_14() { + $ret = array(); + views_make_cache_table(&$ret); + $ret[] = update_sql("DELETE FROM {cache_views}"); + return $ret; +} + +/** + * This should go in every update to ensure that it's there from a 4.7 -> 5.x + * update. + */ +function views_make_cache_table(&$ret) { + if (!db_table_exists('view_view')) { + $ret[] = update_sql("CREATE TABLE {cache_views} ( cid varchar(255) NOT NULL default '', data longblob, expire int NOT NULL default '0', @@ -419,12 +442,5 @@ function views_update_12() { PRIMARY KEY (cid), INDEX expire (expire) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - - return $ret; + } } - -function views_update_13() { - $ret = array(); - $ret[] = update_sql("DELETE FROM {cache_views}"); - return $ret; -} \ No newline at end of file diff --git a/views.module b/views.module index fefda8744c39c99671abe97fbddac524f91b2c5a..895e28e8c8c3db7e371de183b1582c0b60d78f30 100644 --- a/views.module +++ b/views.module @@ -798,7 +798,47 @@ function views_invalidate_cache() { * Provide all the fields in a view. */ function _views_view_fields() { - return array('vid', 'name', 'description', 'access', 'page', 'page_title', 'page_header', 'page_header_format', 'page_footer', 'page_footer_format', 'page_empty', 'page_empty_format', 'page_type', 'use_pager', 'nodes_per_page', 'url', 'menu', 'menu_tab', 'menu_tab_default', 'menu_tab_weight', 'menu_title', 'block', 'block_title', 'block_use_page_header', 'block_header', 'block_header_format', 'block_use_page_footer', 'block_footer', 'block_footer_format', 'block_use_page_empty', 'block_empty', 'block_empty_format', 'block_type', 'nodes_per_block', 'block_more', 'url', 'breadcrumb_no_home', 'changed', 'view_args_php', 'is_cacheable'); + return array( + 'vid' => '%d', + 'name' => "'%s'", + 'description' => "'%s'", + 'access' => "'%s'", + 'page' => '%d', + 'page_title' => "'%s'", + 'page_header' => "'%s'", + 'page_header_format' => '%d', + 'page_footer' => "'%s'", + 'page_footer_format' => '%d', + 'page_empty' => "'%s'", + 'page_empty_format' => '%d', + 'page_type' => "'%s'", + 'use_pager' => '%d', + 'nodes_per_page' => '%d', + 'url' => "'%s'", + 'menu' => '%d', + 'menu_tab' => '%d', + 'menu_tab_default' => '%d', + 'menu_tab_weight' => '%d', + 'menu_title' => "'%s'", + 'block' => '%d', + 'block_title' => "'%s'", + 'block_use_page_header' => '%d', + 'block_header' => "'%s'", + 'block_header_format' => '%d', + 'block_use_page_footer' => '%d', + 'block_footer' => "'%s'", + 'block_footer_format' => '%d', + 'block_use_page_empty' => '%d', + 'block_empty' => "'%s'", + 'block_empty_format' => '%d', + 'block_type' => "'%s'", + 'nodes_per_block' => '%d', + 'block_more' => '%d', + 'breadcrumb_no_home' => '%d', + 'changed' => '%d', + 'view_args_php' => "'%s'", + 'is_cacheable' => '%d', + ); } /** @@ -935,8 +975,8 @@ function _views_save_view($view) { // update // Prepare the query: foreach ($view as $key => $value) { - if (in_array($key, $fields)) { - $q[] = db_escape_string($key) ." = '%s'"; + if (array_key_exists($key, $fields)) { + $q[] = db_escape_string($key) ." = $fields[$key]"; $v[] = $value; } } @@ -960,10 +1000,10 @@ function _views_save_view($view) { // Prepare the query: foreach ($view as $key => $value) { - if (in_array((string) $key, $fields)) { + if (array_key_exists((string) $key, $fields)) { $k[] = db_escape_string($key); $v[] = $value; - $s[] = is_numeric($value) ? '%d' : "'%s'"; + $s[] = $fields[$key]; } }