From c70747a5f31710659e17fa4d43f4989f0a4e972e Mon Sep 17 00:00:00 2001 From: Janette Day Date: Tue, 13 Feb 2018 11:43:54 -0600 Subject: [PATCH 1/2] Upgrade dkan to 7.x-1.14.2 --- build-dkan.make | 2 +- dkan/CHANGELOG.txt | 14 + dkan/OWNERS.md | 36 --- dkan/dkan.info | 4 - dkan/docs/_static/css/custom.css | 20 ++ dkan/docs/admin/index.rst | 4 +- dkan/docs/admin/sitemanagermaintenance | 47 +++ dkan/docs/community/help.rst | 10 + dkan/docs/conf.py | 7 +- dkan/docs/requirements.txt | 2 +- dkan/drupal-org.make | 16 +- dkan/modules/contrib/features/PATCHES.txt | 4 + .../contrib/features/features.export.inc | 6 +- .../filefield_sources/filefield_sources.info | 6 +- .../filefield_sources/filefield_sources.js | 2 +- .../filefield_sources.module | 24 +- .../filefield_sources/sources/attach.inc | 5 +- .../filefield_sources/sources/clipboard.inc | 4 +- .../filefield_sources/sources/reference.inc | 4 +- .../filefield_sources/sources/remote.inc | 47 ++- dkan/modules/contrib/gravatar/gravatar.info | 2 +- .../open_data_schema_ckan.info | 3 - .../open_data_schema_dcat.info | 3 - .../open_data_schema_map_xml_output.info | 3 - .../open_data_schema_pod.info | 3 - .../open_data_schema_map.info | 3 - dkan/modules/contrib/recline/recline.info | 3 - .../uuidreference_select.info | 3 - .../visualization_entity_charts_dkan.info | 3 - .../visualization_entity_charts.infoi | 4 - ...isualization_entity_choropleth_bundle.info | 3 - .../visualization_entity_embed.info | 3 - .../visualization_entity_geojson_bundle.info | 3 - ...zation_entity_recline_field_reference.info | 3 - ...entity_visualization_contributor_role.info | 3 - .../visualization_entity.info | 3 - .../dkan_data_dashboard.info | 4 - .../dkan/dkan_data_story/dkan_data_story.info | 4 - .../dkan/dkan_dataset/dkan_dataset.info | 4 - .../includes/getRemoteFileInfo.php | 293 ++++++++---------- .../dkan_dataset_content_types.info | 3 - .../dkan_dataset_groups.info | 3 - .../dkan_dataset_rest_api.info | 3 - .../dkan_dataset_voting.info | 3 - .../dkan/dkan_datastore/dkan_datastore.info | 4 - .../dkan_datastore_api.info | 3 - .../dkan_datastore_api.module | 1 - .../dkan_datastore_fast_import.info | 3 - .../dkan/dkan_sitewide/dkan_sitewide.info | 4 - .../dkan_sitewide.views_default.inc | 8 + .../dkan_sitewide_panelizer.info | 3 - .../modules/dkan/dkan_topics/dkan_topics.info | 4 - .../dkan_default_topics.info | 3 - .../dkan/dkan_workflow/dkan_workflow.info | 4 - .../open_data_federal_extras.info | 4 - .../open_data_schema_map_dkan.info | 4 - dkan/test/features/resource.all.feature | 8 +- .../dkan_dataset/getRemoteFileInfoTest.php | 43 ++- dkan/themes/nuboot_radix/nuboot_radix.info | 3 - docroot/PATCHES.txt | 1 + docroot/includes/database/schema.inc | 8 +- 61 files changed, 360 insertions(+), 377 deletions(-) delete mode 100644 dkan/OWNERS.md create mode 100644 dkan/docs/_static/css/custom.css create mode 100644 dkan/docs/admin/sitemanagermaintenance create mode 100644 dkan/modules/contrib/features/PATCHES.txt delete mode 100644 dkan/modules/contrib/visualization_entity/modules/visualization_entity_charts/visualization_entity_charts.infoi diff --git a/build-dkan.make b/build-dkan.make index 41f661d2f..20b641f5b 100644 --- a/build-dkan.make +++ b/build-dkan.make @@ -8,4 +8,4 @@ projects: download: type: git url: https://github.com/GetDKAN/dkan.git - tag: 7.x-1.14.1 + tag: 7.x-1.14.2 diff --git a/dkan/CHANGELOG.txt b/dkan/CHANGELOG.txt index c5b0c46e3..5165371b7 100644 --- a/dkan/CHANGELOG.txt +++ b/dkan/CHANGELOG.txt @@ -1,3 +1,17 @@ +7.x-1.14.2 +---------- + - #2359 Upgrade filefield_sources to 1.11 + - #2341 Modifies curl settings so url headers and info can be properly acquired with curl + - #2370 Patch features to add new line after div.version { + color: #eee; +} diff --git a/dkan/docs/admin/index.rst b/dkan/docs/admin/index.rst index 6bf99d263..519a90bc1 100644 --- a/dkan/docs/admin/index.rst +++ b/dkan/docs/admin/index.rst @@ -35,8 +35,10 @@ Appearance :maxdepth: 1 account_access_and_setup + adding_new_content + admin_menu appearance data_and_content/index people/index structure - admin_menu + diff --git a/dkan/docs/admin/sitemanagermaintenance b/dkan/docs/admin/sitemanagermaintenance new file mode 100644 index 000000000..92fba7536 --- /dev/null +++ b/dkan/docs/admin/sitemanagermaintenance @@ -0,0 +1,47 @@ +# Site Manager Monthly Maintenance Checklist + + +### Content +*(Accessible via the “Content” tab on the black site administration toolbar)* + +- Check the “Content” list for an overview of the content currently hosted on your site. + +- Is there any content that needs to be published or unpublished? Are there duplicates? If so, take a moment to clean up your content. + +### Groups +*(Accessible via the “Groups” button on the main site navigation bar)* + +- Is the Groups list up to date? + +- Does each Group have an appropriate image and description? + +### Tags and Taxonomies +*(Mouse over Site Configuration on the black site administration toolbar, then click “Taxonomy”)* + +- Check your site’s list of Tags, located in the Taxonomy menu. To view a list of all Tags on the site, click “List terms.” + +- Are there any misspelled tags? Are there any duplicate tags? If so, take a moment to clean up your tags. + +### User management +*(Accessible via the “People” tab on the black site administration toolbar)* + +- Is the user list up to date? For site security, always double-check that there aren’t any accounts accessible to users who have left your organization. If this is the case, their accounts should be canceled or blocked. + +- Do all of the users in your organization have the proper site roles? (Site Manager, Editor, Content Creator.) + +### Workbench (Optional, if the Workbench/Workflow Modules have been enabled) +*(Accessible via the “My Workbench” tab in the site administration bar)* + +- Workbench moderation queue tasks - check each of these tabs: + +**My drafts** +- Are there any drafts that ought to be pushed to “Published” or “Needs Review”? + +**Needs review** +- Are there any items under review that ought to be pushed back to “Draft” or published? + +**Stale drafts** +- These are drafts that have been unmoderated for over 72 hours. Make sure content doesn’t build up under this queue! + +**Stale reviews** +- These are items under review that have been unmoderated for over 72 hours. diff --git a/dkan/docs/community/help.rst b/dkan/docs/community/help.rst index f30b940d2..5dbc0d4c9 100644 --- a/dkan/docs/community/help.rst +++ b/dkan/docs/community/help.rst @@ -7,3 +7,13 @@ For professional DKAN development services and support: - `Angry Cactus `_ - `National Democratic Institute `_ - `Annai `_ + +Add your company +================= + +If you provide DKAN development and/or support services, here's how to add your company to business directory: + +- Create a /dkan page on your website (ex: https://civicactions.com/dkan/) +- Create a [new issue](https://github.com/GetDKAN/dkan/issues/new) and include logo, company name, link to /dkan page, brief description of services with respect to DKAN + +Someone on the DKAN team will review your request and add your company if it's appropriate for the DKAN community. diff --git a/dkan/docs/conf.py b/dkan/docs/conf.py index f530f7dcd..a31e3b7ef 100644 --- a/dkan/docs/conf.py +++ b/dkan/docs/conf.py @@ -19,13 +19,13 @@ master_doc = 'index' # General information about the project. -project = u'DKAN' +project = u'DKAN Docs' copyright = u'2017' author = u'DKAN Team' -version = '1.13' -release = '1.13' +version = '1.14' +release = '1.14' language = 'en' @@ -214,6 +214,7 @@ github_doc_root = 'https://github.com/GetDKAN/dkan/tree/rtd/docs/' def setup(app): + app.add_stylesheet( "css/custom.css" ) app.add_config_value('recommonmark_config', { 'url_resolver': lambda url: github_doc_root + url, 'auto_toc_tree_section': 'Contents', diff --git a/dkan/docs/requirements.txt b/dkan/docs/requirements.txt index c50eac206..e62fbc186 100644 --- a/dkan/docs/requirements.txt +++ b/dkan/docs/requirements.txt @@ -1,4 +1,4 @@ -sphinx>=1.5.2 +sphinx==1.5.6 sphinx-rtd-theme>=0.2.4 recommonmark==0.4.0 # sphinxcontrib-httpdomain==1.5.0 diff --git a/dkan/drupal-org.make b/dkan/drupal-org.make index 65dcfa0d4..960b10301 100644 --- a/dkan/drupal-org.make +++ b/dkan/drupal-org.make @@ -2,10 +2,10 @@ api: '2' core: 7.x includes: -- https://raw.githubusercontent.com/NuCivic/visualization_entity/7.x-1.14.1/visualization_entity.make -- https://raw.githubusercontent.com/NuCivic/open_data_schema_map/7.x-1.14.1/open_data_schema_map.make +- https://raw.githubusercontent.com/NuCivic/visualization_entity/7.x-2.0/visualization_entity.make +- https://raw.githubusercontent.com/NuCivic/open_data_schema_map/7.x-2.0/open_data_schema_map.make - https://raw.githubusercontent.com/NuCivic/leaflet_draw_widget/5a5f8faf664aeca02371f6692307580d9fab9116/leaflet_widget.make -- https://raw.githubusercontent.com/NuCivic/recline/7.x-1.14.1/recline.make +- https://raw.githubusercontent.com/NuCivic/recline/7.x-2.0/recline.make projects: admin_menu: version: 3.0-rc5 @@ -94,6 +94,8 @@ projects: version: '1.4' features: version: '2.10' + patch: + 2765721: https://www.drupal.org/files/issues/features-blank-line-after-php-tag-2765721-0.patch features_roles_permissions: version: '1.2' feeds: @@ -146,7 +148,7 @@ projects: url: https://git.drupal.org/project/file_resup.git revision: 6cf030c2c139374c75527221775965ff0242df15 filefield_sources: - version: '1.10' + version: '1.11' font_icon_select: download: type: git @@ -246,7 +248,7 @@ projects: download: type: git url: https://github.com/GetDKAN/open_data_schema_map.git - tag: 7.x-1.14.1 + tag: 7.x-2.0 panelizer: version: '3.4' panels: @@ -276,7 +278,7 @@ projects: download: type: git url: https://github.com/GetDKAN/recline.git - tag: 7.x-1.14.1 + tag: 7.x-2.0 ref_field: download: type: git @@ -349,7 +351,7 @@ projects: download: type: git url: https://github.com/GetDKAN/visualization_entity.git - tag: 7.x-1.14.1 + tag: 7.x-2.0 type: module workbench: version: '1.2' diff --git a/dkan/modules/contrib/features/PATCHES.txt b/dkan/modules/contrib/features/PATCHES.txt new file mode 100644 index 000000000..7e1b5fb03 --- /dev/null +++ b/dkan/modules/contrib/features/PATCHES.txt @@ -0,0 +1,4 @@ +The following patches have been applied to this project: +- https://www.drupal.org/files/issues/features-blank-line-after-php-tag-2765721-0.patch + +This file was automatically generated by Drush Make (http://drupal.org/project/drush). diff --git a/dkan/modules/contrib/features/features.export.inc b/dkan/modules/contrib/features/features.export.inc index 5045b1311..c6aa0f12c 100644 --- a/dkan/modules/contrib/features/features.export.inc +++ b/dkan/modules/contrib/features/features.export.inc @@ -315,7 +315,7 @@ function features_export_render($export, $module_name, $reset = FALSE) { $code = array_filter($code); foreach ($code as $filename => $contents) { if ($filename != '_files') { - $code[$filename] = "=7.36) package = Fields core = 7.x -; Information added by Drupal.org packaging script on 2015-08-18 -version = "7.x-1.10" +; Information added by Drupal.org packaging script on 2018-02-07 +version = "7.x-1.11" core = "7.x" project = "filefield_sources" -datestamp = "1439893374" +datestamp = "1517969885" diff --git a/dkan/modules/contrib/filefield_sources/filefield_sources.js b/dkan/modules/contrib/filefield_sources/filefield_sources.js index 05625840f..a854b5578 100644 --- a/dkan/modules/contrib/filefield_sources/filefield_sources.js +++ b/dkan/modules/contrib/filefield_sources/filefield_sources.js @@ -13,7 +13,7 @@ Drupal.behaviors.fileFieldSources.attach = function(context, settings) { $(this).parents('div.filefield-sources-list').find('a.active').removeClass('active'); // Find the unique FileField Source class name. - var fileFieldSourceClass = this.className.match(/filefield-source-[0-9a-z]+/i)[0]; + var fileFieldSourceClass = this.className.match(/filefield-source-[0-9a-z_]+/i)[0]; // The default upload element is a special case. if ($(this).is('.filefield-source-upload')) { diff --git a/dkan/modules/contrib/filefield_sources/filefield_sources.module b/dkan/modules/contrib/filefield_sources/filefield_sources.module index f338bd522..230ffa383 100644 --- a/dkan/modules/contrib/filefield_sources/filefield_sources.module +++ b/dkan/modules/contrib/filefield_sources/filefield_sources.module @@ -425,6 +425,18 @@ function filefield_sources_includes($include = TRUE, $enabled_only = TRUE) { * @see hook_file_download(). */ function filefield_sources_file_access($uri) { + // Always allow access to public files. + $scheme = file_uri_scheme($uri); + if ($scheme === 'public') { + return TRUE; + } + + // Or if the current user has the "bypass file access" permission from the + // File Entity module, then reuse of any file is permitted. + if (user_access('bypass file access')) { + return TRUE; + } + $headers = array(); foreach (module_implements('file_download') as $module) { $function = $module . '_file_download'; @@ -581,7 +593,17 @@ function filefield_sources_save_file($filepath, $validators = array(), $destinat } // If we made it this far it's safe to record this file in the database. - return file_save($file); + if ($file = file_save($file)) { + // Track non-public files in the session if they were uploaded by an + // anonymous user. This allows modules such as the File module to only + // grant view access to the specific anonymous user who uploaded the file. + // See similar code in file_save_upload(). + if (!$user->uid && !in_array($destination_scheme, variable_get('file_public_schema', array('public')))) { + $_SESSION['anonymous_allowed_file_ids'][$file->fid] = $file->fid; + } + return $file; + } + return FALSE; } /** diff --git a/dkan/modules/contrib/filefield_sources/sources/attach.inc b/dkan/modules/contrib/filefield_sources/sources/attach.inc index 0608b01a5..b41d795cf 100644 --- a/dkan/modules/contrib/filefield_sources/sources/attach.inc +++ b/dkan/modules/contrib/filefield_sources/sources/attach.inc @@ -144,7 +144,7 @@ function filefield_source_attach_process($element, &$form_state, $form) { $form_state['filefield_sources'][$instance['field_name']]['attach_options'] = $options; } - $description = t('This method may be used to attach files that exceed the file size limit. Files may be attached from the %directory directory on the server, usually uploaded through FTP.', array('%directory' => realpath($path))); + $description = t('This method may be used to attach files that exceed the file size limit. Files may be attached from the %directory directory on the server, usually uploaded through FTP.', array('%directory' => drupal_realpath($path))); // Error messages. if ($options === FALSE || empty($settings['path'])) { @@ -188,6 +188,7 @@ function filefield_source_attach_process($element, &$form_state, $form) { 'method' => 'replace', 'effect' => 'fade', ), + '#access' => !isset($attach_message), ); return $element; @@ -251,7 +252,7 @@ function filefield_source_attach_value($element, &$item) { $item = array_merge($item, (array) $file); // Delete the original file if "moving" the file instead of copying. - if ($filepath != $original_filepath && $instance['widget']['settings']['filefield_sources']['source_attach']['attach_mode'] !== 'copy') { + if (drupal_realpath($filepath) !== drupal_realpath($file->uri) && $instance['widget']['settings']['filefield_sources']['source_attach']['attach_mode'] !== 'copy') { @unlink($filepath); } } diff --git a/dkan/modules/contrib/filefield_sources/sources/clipboard.inc b/dkan/modules/contrib/filefield_sources/sources/clipboard.inc index 20d8827bc..f4e1189f5 100644 --- a/dkan/modules/contrib/filefield_sources/sources/clipboard.inc +++ b/dkan/modules/contrib/filefield_sources/sources/clipboard.inc @@ -153,7 +153,9 @@ function filefield_source_clipboard_value(&$element, &$item) { } // Remove the temporary file generated from paste. - @unlink($filepath); + if ($filepath !== $item['uri']) { + @unlink($filepath); + } } } diff --git a/dkan/modules/contrib/filefield_sources/sources/reference.inc b/dkan/modules/contrib/filefield_sources/sources/reference.inc index 93d327202..28aec1809 100644 --- a/dkan/modules/contrib/filefield_sources/sources/reference.inc +++ b/dkan/modules/contrib/filefield_sources/sources/reference.inc @@ -182,7 +182,9 @@ function filefield_source_reference_autocomplete($entity_type, $bundle_name, $fi if (!empty($field)) { $files = filefield_source_reference_get_files($filename, $field); foreach ($files as $fid => $file) { - $items[$file->filename ." [fid:$fid]"] = theme('filefield_source_reference_autocomplete_item', array('file' => $file)); + if (filefield_sources_file_access($file->uri)) { + $items[$file->filename ." [fid:$fid]"] = theme('filefield_source_reference_autocomplete_item', array('file' => $file)); + } } } diff --git a/dkan/modules/contrib/filefield_sources/sources/remote.inc b/dkan/modules/contrib/filefield_sources/sources/remote.inc index e379309bd..2aac87517 100644 --- a/dkan/modules/contrib/filefield_sources/sources/remote.inc +++ b/dkan/modules/contrib/filefield_sources/sources/remote.inc @@ -15,16 +15,18 @@ define('FILEFIELD_SOURCE_REMOTE_HINT_TEXT', 'http://example.com/files/file.png') * Implements hook_filefield_source_info(). */ function filefield_source_remote_info() { - $source = array(); - $source['remote'] = array( - 'name' => t('Remote URL textfield'), - 'label' => t('Remote URL'), - 'description' => t('Download a file from a remote server.'), - 'process' => 'filefield_source_remote_process', - 'value' => 'filefield_source_remote_value', - 'file' => 'sources/remote.inc', - ); - return $source; + if (filefield_sources_curl_enabled()) { + $source = array(); + $source['remote'] = array( + 'name' => t('Remote URL textfield'), + 'label' => t('Remote URL'), + 'description' => t('Download a file from a remote server.'), + 'process' => 'filefield_source_remote_process', + 'value' => 'filefield_source_remote_value', + 'file' => 'sources/remote.inc', + ); + return $source; + } } /** @@ -62,6 +64,9 @@ function filefield_source_remote_settings($op, $instance) { $return = array(); // Add settings to the FileField widget form. + if (!filefield_sources_curl_enabled()) { + drupal_set_message(t('Filefield sources: remote plugin will be disabled without php-curl extension.'), 'warning'); + } return $return; @@ -144,6 +149,9 @@ function filefield_source_remote_value($element, &$item) { curl_setopt($ch, CURLOPT_HEADERFUNCTION, '_filefield_source_remote_parse_header'); // Causes a warning if PHP safe mode is on. @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); + // Set a user agent - some hosts block requests unless header is present. + $curl_version = curl_version(); + curl_setopt($ch,CURLOPT_USERAGENT,'PHP-curl/' . $curl_version['version']); curl_exec($ch); $info = curl_getinfo($ch); if ($info['http_code'] != 200) { @@ -242,6 +250,9 @@ function filefield_source_remote_value($element, &$item) { curl_setopt($ch, CURLOPT_WRITEFUNCTION, 'filefield_source_remote_curl_write'); // Causes a warning if PHP safe mode is on. @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); + // Set a user agent - some hosts block requests unless header is present. + $curl_version = curl_version(); + curl_setopt($ch,CURLOPT_USERAGENT,'PHP-curl/' . $curl_version['version']); $transfer_success = curl_exec($ch); curl_close($ch); } @@ -250,19 +261,21 @@ function filefield_source_remote_value($element, &$item) { } // Delete the temporary file. - @unlink($filepath); + if ($filepath !== $item['uri']) { + @unlink($filepath); + } } } /** * Parse cURL header and record the filename specified in Content-Disposition. */ -function _filefield_source_remote_parse_header(&$ch, $header) { - if (preg_match('/Content-Disposition:.*?filename="(.+?)"/', $header, $matches)) { +function _filefield_source_remote_parse_header($ch, $header) { + if (preg_match('/Content-Disposition:.*?filename="(.+?)"/i', $header, $matches)) { // Content-Disposition: attachment; filename="FILE NAME HERE" _filefield_source_remote_filename($matches[1]); } - elseif (preg_match('/Content-Disposition:.*?filename=([^; ]+)/', $header, $matches)) { + elseif (preg_match('/Content-Disposition:.*?filename=([^; ]+)/i', $header, $matches)) { // Content-Disposition: attachment; filename=file.ext $uri = trim($matches[1]); _filefield_source_remote_filename($uri); @@ -394,3 +407,9 @@ function theme_filefield_source_remote_element($variables) { return '
' . drupal_render($element['url']) . '
'; } +/** + * Check for CURL extension enabled. + */ +function filefield_sources_curl_enabled() { + return function_exists('curl_version'); +} diff --git a/dkan/modules/contrib/gravatar/gravatar.info b/dkan/modules/contrib/gravatar/gravatar.info index 0c11f7fb7..b335a35eb 100644 --- a/dkan/modules/contrib/gravatar/gravatar.info +++ b/dkan/modules/contrib/gravatar/gravatar.info @@ -7,7 +7,7 @@ files[] = gravatar.admin.inc files[] = views_handler_gravatar.inc configure = admin/config/people/gravatar -; Information added by drush on 2011-12-31 +; Information added by drush on 2012-01-01 version = "7.x-1.1+5-dev" project = "gravatar" datestamp = "1325392401" \ No newline at end of file diff --git a/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_ckan/open_data_schema_ckan.info b/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_ckan/open_data_schema_ckan.info index 18162e7e9..1d0413179 100644 --- a/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_ckan/open_data_schema_ckan.info +++ b/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_ckan/open_data_schema_ckan.info @@ -6,6 +6,3 @@ dependencies[] = features dependencies[] = open_data_schema_map dependencies[] = pathauto -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_dcat/open_data_schema_dcat.info b/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_dcat/open_data_schema_dcat.info index da20da71a..1ac2faf1e 100644 --- a/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_dcat/open_data_schema_dcat.info +++ b/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_dcat/open_data_schema_dcat.info @@ -8,6 +8,3 @@ dependencies[] = open_data_schema_map_xml_output dependencies[] = pathauto files[] = DcatValidator.php -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_map_xml_output/open_data_schema_map_xml_output.info b/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_map_xml_output/open_data_schema_map_xml_output.info index cf3bb76bd..4579fe42c 100644 --- a/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_map_xml_output/open_data_schema_map_xml_output.info +++ b/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_map_xml_output/open_data_schema_map_xml_output.info @@ -4,6 +4,3 @@ core = 7.x package = Open Data dependencies[] = open_data_schema_map -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_pod/open_data_schema_pod.info b/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_pod/open_data_schema_pod.info index 740f4f61c..c40efd2a7 100644 --- a/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_pod/open_data_schema_pod.info +++ b/dkan/modules/contrib/open_data_schema_map/modules/open_data_schema_pod/open_data_schema_pod.info @@ -6,6 +6,3 @@ dependencies[] = features dependencies[] = open_data_schema_map files[] = PodValidator.php -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/contrib/open_data_schema_map/open_data_schema_map.info b/dkan/modules/contrib/open_data_schema_map/open_data_schema_map.info index a47bb2c65..007878124 100644 --- a/dkan/modules/contrib/open_data_schema_map/open_data_schema_map.info +++ b/dkan/modules/contrib/open_data_schema_map/open_data_schema_map.info @@ -9,6 +9,3 @@ dependencies[] = token files[] = open_data_schema_map.features.inc files[] = test/open_data_schema_map_api.test -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/contrib/recline/recline.info b/dkan/modules/contrib/recline/recline.info index e83cf2d0b..bf6e6f4b4 100644 --- a/dkan/modules/contrib/recline/recline.info +++ b/dkan/modules/contrib/recline/recline.info @@ -7,6 +7,3 @@ dependencies[] = file scripts[] = js/jsondataview.js scripts[] = js/restdataview.js -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/contrib/visualization_entity/modules/uuidreference_select/uuidreference_select.info b/dkan/modules/contrib/visualization_entity/modules/uuidreference_select/uuidreference_select.info index e56bf8c66..ed943a8e4 100644 --- a/dkan/modules/contrib/visualization_entity/modules/uuidreference_select/uuidreference_select.info +++ b/dkan/modules/contrib/visualization_entity/modules/uuidreference_select/uuidreference_select.info @@ -3,6 +3,3 @@ core = 7.x dependencies[] = uuidreference -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/contrib/visualization_entity/modules/visualization_entity_charts/modules/visualization_entity_charts_dkan/visualization_entity_charts_dkan.info b/dkan/modules/contrib/visualization_entity/modules/visualization_entity_charts/modules/visualization_entity_charts_dkan/visualization_entity_charts_dkan.info index e02dabe5e..ad07b1988 100644 --- a/dkan/modules/contrib/visualization_entity/modules/visualization_entity_charts/modules/visualization_entity_charts_dkan/visualization_entity_charts_dkan.info +++ b/dkan/modules/contrib/visualization_entity/modules/visualization_entity_charts/modules/visualization_entity_charts_dkan/visualization_entity_charts_dkan.info @@ -12,6 +12,3 @@ features[field_instance][] = visualization-ve_chart-field_uuid_resource features_exclude[dependencies][uuidreference] = uuidreference project path = profiles/dkan/modules/contrib/visualization_entity_charts/modules -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/contrib/visualization_entity/modules/visualization_entity_charts/visualization_entity_charts.infoi b/dkan/modules/contrib/visualization_entity/modules/visualization_entity_charts/visualization_entity_charts.infoi deleted file mode 100644 index a93cb6461..000000000 --- a/dkan/modules/contrib/visualization_entity/modules/visualization_entity_charts/visualization_entity_charts.infoi +++ /dev/null @@ -1,4 +0,0 @@ - -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/contrib/visualization_entity/modules/visualization_entity_choropleth_bundle/visualization_entity_choropleth_bundle.info b/dkan/modules/contrib/visualization_entity/modules/visualization_entity_choropleth_bundle/visualization_entity_choropleth_bundle.info index faf0f11a3..54dd594b6 100644 --- a/dkan/modules/contrib/visualization_entity/modules/visualization_entity_choropleth_bundle/visualization_entity_choropleth_bundle.info +++ b/dkan/modules/contrib/visualization_entity/modules/visualization_entity_choropleth_bundle/visualization_entity_choropleth_bundle.info @@ -35,6 +35,3 @@ features[field_instance][] = visualization-choropleth_visualization-field_ve_map mtime = 1420866437 project path = sites/all/modules/nucivic/visualization_entity/modules -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/contrib/visualization_entity/modules/visualization_entity_embed/visualization_entity_embed.info b/dkan/modules/contrib/visualization_entity/modules/visualization_entity_embed/visualization_entity_embed.info index a31c155b1..658f15e48 100644 --- a/dkan/modules/contrib/visualization_entity/modules/visualization_entity_embed/visualization_entity_embed.info +++ b/dkan/modules/contrib/visualization_entity/modules/visualization_entity_embed/visualization_entity_embed.info @@ -5,6 +5,3 @@ core = 7.x dependencies[] = visualization_entity -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/contrib/visualization_entity/modules/visualization_entity_geojson_bundle/visualization_entity_geojson_bundle.info b/dkan/modules/contrib/visualization_entity/modules/visualization_entity_geojson_bundle/visualization_entity_geojson_bundle.info index 48fe0d481..5095b9d2c 100644 --- a/dkan/modules/contrib/visualization_entity/modules/visualization_entity_geojson_bundle/visualization_entity_geojson_bundle.info +++ b/dkan/modules/contrib/visualization_entity/modules/visualization_entity_geojson_bundle/visualization_entity_geojson_bundle.info @@ -12,6 +12,3 @@ features[features_api][] = api:2 features[field_instance][] = visualization-geojson_visualization-field_uuid_resource project path = sites/all/modules/nucivic/visualization_entity/modules -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/contrib/visualization_entity/modules/visualization_entity_recline_field_reference/visualization_entity_recline_field_reference.info b/dkan/modules/contrib/visualization_entity/modules/visualization_entity_recline_field_reference/visualization_entity_recline_field_reference.info index 9afcb321b..2dd1557c5 100644 --- a/dkan/modules/contrib/visualization_entity/modules/visualization_entity_recline_field_reference/visualization_entity_recline_field_reference.info +++ b/dkan/modules/contrib/visualization_entity/modules/visualization_entity_recline_field_reference/visualization_entity_recline_field_reference.info @@ -12,6 +12,3 @@ features[features_api][] = api:2 features[field_base][] = field_uuid_resource project path = profiles/dkan/modules/contrib -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/contrib/visualization_entity/modules/visualization_entity_visualization_contributor_role/visualization_entity_visualization_contributor_role.info b/dkan/modules/contrib/visualization_entity/modules/visualization_entity_visualization_contributor_role/visualization_entity_visualization_contributor_role.info index f85079704..307eac5bf 100644 --- a/dkan/modules/contrib/visualization_entity/modules/visualization_entity_visualization_contributor_role/visualization_entity_visualization_contributor_role.info +++ b/dkan/modules/contrib/visualization_entity/modules/visualization_entity_visualization_contributor_role/visualization_entity_visualization_contributor_role.info @@ -15,6 +15,3 @@ features[user_role][] = visualization contributor features_exclude[dependencies][role_export] = role_export project path = sites/all/modules/nucivic/visualization_entity/modules -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/contrib/visualization_entity/visualization_entity.info b/dkan/modules/contrib/visualization_entity/visualization_entity.info index 571105633..d4dad5502 100644 --- a/dkan/modules/contrib/visualization_entity/visualization_entity.info +++ b/dkan/modules/contrib/visualization_entity/visualization_entity.info @@ -10,6 +10,3 @@ features[features_api][] = api:2 mtime = 1421114365 project path = sites/all/modules/nucivic -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/dkan_data_dashboard/dkan_data_dashboard.info b/dkan/modules/dkan/dkan_data_dashboard/dkan_data_dashboard.info index 63ed315bf..ddd1fb25a 100644 --- a/dkan/modules/dkan/dkan_data_dashboard/dkan_data_dashboard.info +++ b/dkan/modules/dkan/dkan_data_dashboard/dkan_data_dashboard.info @@ -30,7 +30,3 @@ features[variable][] = panelizer_node:data_dashboard_default features[views_view][] = data_dashboards features[views_view][] = front_page_dashboards_list features_exclude[dependencies][dkan_topics] = dkan_topics - -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/dkan_data_story/dkan_data_story.info b/dkan/modules/dkan/dkan_data_story/dkan_data_story.info index d11378d6b..5123c4b09 100644 --- a/dkan/modules/dkan/dkan_data_story/dkan_data_story.info +++ b/dkan/modules/dkan/dkan_data_story/dkan_data_story.info @@ -55,7 +55,3 @@ features_exclude[dependencies][image] = image features_exclude[dependencies][strongarm] = strongarm features_exclude[dependencies][taxonomy] = taxonomy no autodetect = 1 - -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/dkan_dataset/dkan_dataset.info b/dkan/modules/dkan/dkan_dataset/dkan_dataset.info index 4f3c824b4..57aabc86c 100644 --- a/dkan/modules/dkan/dkan_dataset/dkan_dataset.info +++ b/dkan/modules/dkan/dkan_dataset/dkan_dataset.info @@ -33,7 +33,3 @@ features[ctools][] = views:views_default:3.0 features[features_api][] = api:2 features[variable][] = pathauto_node_dataset_pattern features[variable][] = pathauto_node_resource_pattern - -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/dkan_dataset/includes/getRemoteFileInfo.php b/dkan/modules/dkan/dkan_dataset/includes/getRemoteFileInfo.php index 51a8c17eb..0464afae3 100644 --- a/dkan/modules/dkan/dkan_dataset/includes/getRemoteFileInfo.php +++ b/dkan/modules/dkan/dkan_dataset/includes/getRemoteFileInfo.php @@ -12,86 +12,14 @@ class GetRemoteFileInfo { * * @var info */ - public $info = FALSE; public $url; - public $agent; - public $followRedirect; /** * Class constructor. */ public function __construct($url, $agent, $followRedirect = TRUE) { $this->url = $url; - $this->agent = $agent; - $this->followRedirect = $followRedirect; - - $this->info = $this->curlHeader($this->url, $this->agent, $this->followRedirect); - } - - /** - * Retrieves headers from url. - */ - public function curlHeader($url, $agent, $followRedirect) { - $info = array(); - - $ch = $this->getBaseCh($url, $agent, $followRedirect); - - // This changes the request method to HEAD. No need to "GET" the hole link. - curl_setopt($ch, CURLOPT_NOBODY, TRUE); - - $http_heading = curl_exec($ch); - - if (!$http_heading) { - // Should set the GetRemoteFileInfo::$info to false. - return FALSE; - } - - $info['header'] = $this->httpParseHeaders($http_heading); - $info['info'] = curl_getinfo($ch); - $info['effective_url'] = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); - curl_close($ch); - - return $info; - } - - /** - * Helper method to construct a base cURL handle. - */ - private function getBaseCh($url, $agent, $followRedirect) { - $ch = curl_init(); - - curl_setopt($ch, CURLOPT_URL, $url); - // Spoof the User Agent. - curl_setopt($ch, CURLOPT_USERAGENT, $agent); - - // Wait only 5 seconds. - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); - curl_setopt($ch, CURLOPT_TIMEOUT, 5); - - // Return the transfer as a string of the return value of curl_exec() - // instead of outputting it out directly. - curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); - - // Follow redirects. - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $followRedirect); - curl_setopt($ch, CURLOPT_MAXREDIRS, 10); - - // Force the use of a new connection instead of a cached one. - curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE); - - // Attempt to retrieve the modification date of the remote document. - curl_setopt($ch, CURLOPT_FILETIME, TRUE); - - // Cookies. - curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE); - curl_setopt($ch, CURLOPT_COOKIE, ""); - - // Include the header in the output. - curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); - curl_setopt($ch, CURLOPT_HEADER, TRUE); - - return $ch; + $this->info = $this->getFileInfo($this->url); } /** @@ -106,18 +34,16 @@ public function getInfo() { */ public function getType() { if ($info = $this->getInfo()) { - $type = $info['header']['Content-Type']; - // If the url had redirects, CURL will stack the Content Types from all - // the urls. Get the last url. - if (is_array($type)) { - $type = array_pop($type); - } + if (!empty($info["Content-Type"])) { + $content_types = array_values($info["Content-Type"]); + $array_size = count($content_types); + $last_element = $array_size - 1; - if ($explode = explode(";", $type)) { - return $explode[0]; - } - else { - return $type; + $type = $content_types[$last_element]; + + $pieces = explode(";", $type); + + return trim($pieces[0]); } } @@ -176,45 +102,18 @@ public function getExtension() { */ public function getEffectiveUrl() { $info = $this->getInfo(); - if (!empty($info)) { - return $info['effective_url']; - } - return FALSE; - } - /** - * Retrieves URL from end of string. - */ - public function getNameFromUrl() { - $basename = basename($this->url); - $name = explode('.', $basename); - if (count($name) > 2) { - $name = parse_url($basename); - if (isset($name['path'])) { - return $name['path']; - } - } - elseif (count($name) == 1) { - return $name[0]; - } - return FALSE; - } + if (!empty($info['Location'])) { + $urls = array_values($info["Location"]); + $array_size = count($urls); + $last_element = $array_size - 1; - /** - * Finds filename from Content Disposition header. - */ - public function checkDisposition($disposition) { - if (preg_match('/.*?filename=(.+)/i', $disposition, $matches)) { - return trim($matches[1]); - } - elseif (preg_match('/.*?filename="(.+?)"/i', $disposition, $matches)) { - return trim($matches[1]); - } - elseif (preg_match('/.*?filename=([^; ]+)/i', $header, $matches)) { - return trim($matches[1]); + $url = $urls[$last_element]; + + return trim($url); } - elseif ($exploded = explode('filename=', $disposition)) { - return trim($exploded[1]); + else { + return $this->url; } } @@ -228,72 +127,134 @@ public function checkDisposition($disposition) { */ public function getName() { if ($info = $this->getInfo()) { - // Check Location for proper URL. - // When URL have redirects the ['header']['Location'] will be an array. - if (isset($info['header']['Location']) && is_array($info['header']['Location'])) { - $location = $info['header']['Location']; - $location = array_shift($location); - } - - if (isset($location) && valid_url($location)) { - if ($name = $this->getNameFromUrl($this->url)) { + $spellings = [ + 'Content-Disposition', + 'Content-disposition', + 'content-disposition' + ]; + + foreach ($spellings as $spelling) { + if (isset($info[$spelling]) && $name = $this->checkDisposition($info[$spelling])) { return $name; } } - // Check content disposition. - if (isset($info['header']['Content-Disposition'])) { - return $this->checkDisposition($info['header']['Content-Disposition']); - } - elseif (isset($info['header']['Content-disposition'])) { - return $this->checkDisposition($info['header']['Content-disposition']); - } - elseif (isset($info['header']['content-disposition'])) { - return $this->checkDisposition($info['header']['content-disposition']); - } // Check URL for filename at end of string. - if ($name = $this->getNameFromUrl($this->url)) { + if ($name = $this->getNameFromUrl()) { return $name; } else { return NULL; } } - else { - return NULL; + + return NULL; + } + + /** + * Helper function. + */ + private function getFileInfoHelper($url, $no_body = TRUE) { + ob_start(); + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_HEADER, 1); + if ($no_body) { + curl_setopt($ch, CURLOPT_NOBODY, 1); + } + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); + curl_setopt($ch, CURLOPT_HTTPHEADER, array("Range: bytes=0-1000")); + + $ok = curl_exec($ch); + + curl_close($ch); + + $data = ob_get_contents(); + @ob_end_clean(); + + if ($ok) { + $info = $this->parseRequestData($data); + if (empty($info['Content-Type'])) { + return FALSE; + } + return $info; } + + return FALSE; + } + + /** + * Retrieves info from url. + */ + private function getFileInfo($url) { + if ($info = $this->getFileInfoHelper($url)) { + return $info; + } + + if ($info = $this->getFileInfoHelper($url, FALSE)) { + return $info; + } + + return FALSE; } /** * Converts headers from curl request to array. */ - public function httpParseHeaders($raw_headers) { - $headers = array(); - $key = ''; - foreach (explode("\n", $raw_headers) as $i => $h) { - $h = explode(':', $h, 2); - if (isset($h[1])) { - if (!isset($headers[$h[0]])) { - $headers[$h[0]] = trim($h[1]); - } - elseif (is_array($headers[$h[0]])) { - $headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1]))); - } - else { - $headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1]))); - } - $key = $h[0]; + private function parseRequestData($request_data) { + $info = []; + $pieces = explode(PHP_EOL, $request_data); + + foreach ($pieces as $piece) { + $key_value = explode(":", $piece); + if (count($key_value) >= 2) { + $key = array_shift($key_value); + $info[$key][] = implode(":", $key_value); } - else { - if (substr($h[0], 0, 1) == "\t") { - $headers[$key] .= "\r\n\t" . trim($h[0]); - } - elseif (!$key) { - $headers[0] = trim($h[0]);trim($h[0]); - } + } + + return $info; + } + + /** + * Retrieves URL from end of string. + */ + private function getNameFromUrl() { + + $url = $this->getEffectiveUrl(); + + $parsed = parse_url($url); + + if (isset($parsed['path'])) { + $pieces = explode('/', $parsed['path']); + return $pieces[count($pieces) - 1]; + } + + return FALSE; + } + + /** + * Finds filename from Content Disposition header. + */ + private function checkDisposition($disposition) { + $disposition = array_shift($disposition); + + $regexes = [ + '/.*?filename=(.+)/i', + '/.*?filename="(.+?)"/i', + '/.*?filename=([^; ]+)/i' + ]; + + foreach ($regexes as $regex) { + if (preg_match($regex, $disposition, $matches)) { + return trim($matches[1]); } } - return $headers; + + if ($exploded = explode('filename=', $disposition)) { + return trim($exploded[1]); + } + + return FALSE; } } diff --git a/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_content_types/dkan_dataset_content_types.info b/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_content_types/dkan_dataset_content_types.info index 85d2f7b31..bd78ac504 100644 --- a/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_content_types/dkan_dataset_content_types.info +++ b/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_content_types/dkan_dataset_content_types.info @@ -126,6 +126,3 @@ features_exclude[dependencies][dkan_featured_topics] = dkan_featured_topics features_exclude[field_base][og_group_ref] = og_group_ref features_exclude[field_instance][node-dataset-og_group_ref] = node-dataset-og_group_ref -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_groups/dkan_dataset_groups.info b/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_groups/dkan_dataset_groups.info index 70cb911e3..beea33349 100644 --- a/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_groups/dkan_dataset_groups.info +++ b/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_groups/dkan_dataset_groups.info @@ -78,6 +78,3 @@ features[views_view][] = front_page_group_list features[views_view][] = group_block features[views_view][] = groups_page -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_rest_api/dkan_dataset_rest_api.info b/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_rest_api/dkan_dataset_rest_api.info index e431f43d9..267a938f1 100644 --- a/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_rest_api/dkan_dataset_rest_api.info +++ b/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_rest_api/dkan_dataset_rest_api.info @@ -11,6 +11,3 @@ features[features_api][] = api:2 features[services_endpoint][] = dkan_dataset_api mtime = 1417998121 -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_voting/dkan_dataset_voting.info b/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_voting/dkan_dataset_voting.info index b7de27a3f..3e69c4aed 100644 --- a/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_voting/dkan_dataset_voting.info +++ b/dkan/modules/dkan/dkan_dataset/modules/dkan_dataset_voting/dkan_dataset_voting.info @@ -18,6 +18,3 @@ features[field_instance][] = node-dataset-field_rating features[variable][] = ajax_comments_node_types features[variable][] = ajax_comments_notify -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/dkan_datastore/dkan_datastore.info b/dkan/modules/dkan/dkan_datastore/dkan_datastore.info index 4bd2de8aa..23796c234 100644 --- a/dkan/modules/dkan/dkan_datastore/dkan_datastore.info +++ b/dkan/modules/dkan/dkan_datastore/dkan_datastore.info @@ -22,7 +22,3 @@ features[views_view][] = datasets files[] = includes/Datastore.inc files[] = includes/DkanDatastore.inc files[] = includes/DkanDatastoreFastImport.inc - -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/dkan_datastore/modules/dkan_datastore_api/dkan_datastore_api.info b/dkan/modules/dkan/dkan_datastore/modules/dkan_datastore_api/dkan_datastore_api.info index d7932d446..e163ba14b 100644 --- a/dkan/modules/dkan/dkan_datastore/modules/dkan_datastore_api/dkan_datastore_api.info +++ b/dkan/modules/dkan/dkan_datastore/modules/dkan_datastore_api/dkan_datastore_api.info @@ -4,6 +4,3 @@ package = DKAN API core = 7.x dependencies[] = services -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/dkan_datastore/modules/dkan_datastore_api/dkan_datastore_api.module b/dkan/modules/dkan/dkan_datastore/modules/dkan_datastore_api/dkan_datastore_api.module index 52698dad7..7dc0d355d 100644 --- a/dkan/modules/dkan/dkan_datastore/modules/dkan_datastore_api/dkan_datastore_api.module +++ b/dkan/modules/dkan/dkan_datastore/modules/dkan_datastore_api/dkan_datastore_api.module @@ -903,7 +903,6 @@ function dkan_datastore_api_output($data_select, $results, $table, $fields, $res $return->limit = (int) $limit; $return->total = (int) $count; $return->records = $items; - $return->sql = dkan_datastore_api_debug($data_select); return $help + $success + array('result' => $return); } diff --git a/dkan/modules/dkan/dkan_datastore/modules/dkan_datastore_fast_import/dkan_datastore_fast_import.info b/dkan/modules/dkan/dkan_datastore/modules/dkan_datastore_fast_import/dkan_datastore_fast_import.info index 25db56dd4..6adcc200d 100644 --- a/dkan/modules/dkan/dkan_datastore/modules/dkan_datastore_fast_import/dkan_datastore_fast_import.info +++ b/dkan/modules/dkan/dkan_datastore/modules/dkan_datastore_fast_import/dkan_datastore_fast_import.info @@ -4,6 +4,3 @@ core = 7.x package = DKAN dependencies[] = dkan_datastore -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/dkan_sitewide/dkan_sitewide.info b/dkan/modules/dkan/dkan_sitewide/dkan_sitewide.info index 9db5c0435..43a229fe6 100644 --- a/dkan/modules/dkan/dkan_sitewide/dkan_sitewide.info +++ b/dkan/modules/dkan/dkan_sitewide/dkan_sitewide.info @@ -56,7 +56,3 @@ features[variable][] = user_pictures features[views_view][] = dkan_administration_files features[views_view][] = dkan_administration_nodes features[views_view][] = popular_tags - -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/dkan_sitewide/dkan_sitewide.views_default.inc b/dkan/modules/dkan/dkan_sitewide/dkan_sitewide.views_default.inc index 284ca9c1e..af201f909 100644 --- a/dkan/modules/dkan/dkan_sitewide/dkan_sitewide.views_default.inc +++ b/dkan/modules/dkan/dkan_sitewide/dkan_sitewide.views_default.inc @@ -114,6 +114,10 @@ function dkan_sitewide_views_default_views() { ); $handler->display->display_options['style_options']['sticky'] = TRUE; $handler->display->display_options['style_options']['empty_table'] = TRUE; + /* Header: Global: Result summary */ + $handler->display->display_options['header']['result']['id'] = 'result'; + $handler->display->display_options['header']['result']['table'] = 'views'; + $handler->display->display_options['header']['result']['field'] = 'result'; /* No results behavior: Global: Unfiltered text */ $handler->display->display_options['empty']['area_text_custom']['id'] = 'area_text_custom'; $handler->display->display_options['empty']['area_text_custom']['table'] = 'views'; @@ -434,6 +438,10 @@ function dkan_sitewide_views_default_views() { ); $handler->display->display_options['style_options']['sticky'] = TRUE; $handler->display->display_options['style_options']['empty_table'] = TRUE; + /* Header: Global: Result summary */ + $handler->display->display_options['header']['result']['id'] = 'result'; + $handler->display->display_options['header']['result']['table'] = 'views'; + $handler->display->display_options['header']['result']['field'] = 'result'; /* No results behavior: Global: Unfiltered text */ $handler->display->display_options['empty']['area_text_custom']['id'] = 'area_text_custom'; $handler->display->display_options['empty']['area_text_custom']['table'] = 'views'; diff --git a/dkan/modules/dkan/dkan_sitewide/modules/dkan_sitewide_panelizer/dkan_sitewide_panelizer.info b/dkan/modules/dkan/dkan_sitewide/modules/dkan_sitewide_panelizer/dkan_sitewide_panelizer.info index 39288b070..9f53f0062 100644 --- a/dkan/modules/dkan/dkan_sitewide/modules/dkan_sitewide_panelizer/dkan_sitewide_panelizer.info +++ b/dkan/modules/dkan/dkan_sitewide/modules/dkan_sitewide_panelizer/dkan_sitewide_panelizer.info @@ -18,6 +18,3 @@ features[variable][] = panelizer_node:page_allowed_types features[variable][] = panelizer_node:page_allowed_types_default features[variable][] = panelizer_node:page_default -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/dkan_topics/dkan_topics.info b/dkan/modules/dkan/dkan_topics/dkan_topics.info index 2f43acc7e..ae157a228 100755 --- a/dkan/modules/dkan/dkan_topics/dkan_topics.info +++ b/dkan/modules/dkan/dkan_topics/dkan_topics.info @@ -57,7 +57,3 @@ features_exclude[dependencies][dkan_dataset_groups] = dkan_dataset_groups features_exclude[dependencies][dkan_topics] = dkan_topics no autodetect = 1 project path = profiles/dkan/modules/dkan - -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/dkan_topics/modules/dkan_default_topics/dkan_default_topics.info b/dkan/modules/dkan/dkan_topics/modules/dkan_default_topics/dkan_default_topics.info index 1ea4081a3..74cf9b659 100755 --- a/dkan/modules/dkan/dkan_topics/modules/dkan_default_topics/dkan_default_topics.info +++ b/dkan/modules/dkan/dkan_topics/modules/dkan_default_topics/dkan_default_topics.info @@ -6,6 +6,3 @@ dependencies[] = dkan_topics dependencies[] = taxonomy_fixtures dependencies[] = taxonomy -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/dkan_workflow/dkan_workflow.info b/dkan/modules/dkan/dkan_workflow/dkan_workflow.info index d11d4ece1..a606f2f3c 100644 --- a/dkan/modules/dkan/dkan_workflow/dkan_workflow.info +++ b/dkan/modules/dkan/dkan_workflow/dkan_workflow.info @@ -44,7 +44,3 @@ features[workbench_moderation_transitions][] = needs_review:published features[workbench_moderation_transitions][] = published:needs_review features_exclude[dependencies][ctools] = ctools features_exclude[dependencies][dkan_dataset_content_types] = dkan_dataset_content_types - -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/open_data_federal_extras/open_data_federal_extras.info b/dkan/modules/dkan/open_data_federal_extras/open_data_federal_extras.info index acc11f80a..d75adfcfa 100644 --- a/dkan/modules/dkan/open_data_federal_extras/open_data_federal_extras.info +++ b/dkan/modules/dkan/open_data_federal_extras/open_data_federal_extras.info @@ -27,7 +27,3 @@ features[field_instance][] = node-dataset-field_odfe_data_quality features[field_instance][] = node-dataset-field_odfe_investment_uii features[field_instance][] = node-dataset-field_odfe_program_code features[field_instance][] = node-dataset-field_odfe_system_of_records - -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/modules/dkan/open_data_schema_map_dkan/open_data_schema_map_dkan.info b/dkan/modules/dkan/open_data_schema_map_dkan/open_data_schema_map_dkan.info index 972307242..00a98241c 100644 --- a/dkan/modules/dkan/open_data_schema_map_dkan/open_data_schema_map_dkan.info +++ b/dkan/modules/dkan/open_data_schema_map_dkan/open_data_schema_map_dkan.info @@ -21,7 +21,3 @@ features[open_data_schema_apis][] = data_json_1_1 features[open_data_schema_apis][] = dcat_ap_v1_1_dataset features[open_data_schema_apis][] = dcat_v1_1 features[open_data_schema_apis][] = dcat_v1_1_json - -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/dkan/test/features/resource.all.feature b/dkan/test/features/resource.all.feature index edcf6c525..79ec229a3 100644 --- a/dkan/test/features/resource.all.feature +++ b/dkan/test/features/resource.all.feature @@ -87,7 +87,7 @@ Feature: Resource Then I should see "The Resource ID for this resource is" And I should see "Example Query" - @resource_all_06 @api @noworkflow + @resource_all_06 @api @noworkflow Scenario: View previous revisions of published resource Given I am logged in as a user with the "administrator" role And I am on "Resource 01" page @@ -122,7 +122,9 @@ Feature: Resource @resource_all_09 @api Scenario: View dataset reference on Resource teaser Given I am on "/search" - And I click "Resource" + And I click "Resource" in the "facet container" region + And I fill in "edit-query" with "Resource 01" + And I press "Apply" Then I should see "Dataset 01" @resource_all_10 @api @noworkflow @@ -143,7 +145,7 @@ Feature: Resource When I click "Resource 01" Then I should see "Edit" When I click "Edit" - ## If you use selenium uncomment this + ## If you use selenium uncomment this # And I click "Remote file" And I fill in "edit-field-link-remote-file-und-0-filefield-dkan-remotefile-url" with "https://s3.amazonaws.com/dkan-default-content-files/files/district_centerpoints_0.csv" And I press "edit-submit" diff --git a/dkan/test/phpunit/dkan_dataset/getRemoteFileInfoTest.php b/dkan/test/phpunit/dkan_dataset/getRemoteFileInfoTest.php index ebf8d7796..74dfc0555 100644 --- a/dkan/test/phpunit/dkan_dataset/getRemoteFileInfoTest.php +++ b/dkan/test/phpunit/dkan_dataset/getRemoteFileInfoTest.php @@ -40,24 +40,33 @@ public function getHeaders($url) { * Run test URLs threw the getRemoteFileInfo class. */ public function testUrls() { - $url = 'https://data.wa.gov/api/views/mu24-67ke/rows.csv?accessType=DOWNLOAD'; - $fileInfo = new getRemoteFileInfo($url, 'test', TRUE); - $this->assertEquals($fileInfo->getType(), 'text/csv'); - $this->assertEquals($fileInfo->getName(), 'Hospital_Inpatient_Discharges_by_DRG__Northwest__FY2011.csv'); - } + $urls = []; + $urls[0]['url'] = 'https://data.wa.gov/api/views/mu24-67ke/rows.csv?accessType=DOWNLOAD'; + $urls[0]['type'] = 'text/csv'; + $urls[0]['extension'] = 'csv'; + $urls[0]['name'] = "Hospital_Inpatient_Discharges_by_DRG__Northwest__FY2011.csv"; - /** - * Test URL extension. - * - * Mimetype can have multiple extensions associated to it. This test make sure - * that the returned extension matches both the Mimetype and the actual file - * extension. - */ - public function testUrlExtension() { - $url = "https://s3.amazonaws.com/dkan-default-content-files/files/albo.xls"; - $fileInfo = new getRemoteFileInfo($url, 'test', TRUE); - $this->assertEquals($fileInfo->getType(), 'application/vnd.ms-excel'); - $this->assertEquals($fileInfo->getExtension(), 'xls'); + $urls[1]['url'] = "https://data.ca.gov/node/1801/download"; + $urls[1]['type'] = 'text/csv'; + $urls[1]['extension'] = 'csv'; + $urls[1]['name'] = "uw_supplier_data020618.csv"; + + $urls[2]['url'] = "https://s3.amazonaws.com/dkan-default-content-files/files/albo.xls"; + $urls[2]['type'] = 'application/vnd.ms-excel'; + $urls[2]['extension'] = 'xls'; + $urls[2]['name'] = "albo.xls"; + + $urls[3]['url'] = "https://data.chhs.ca.gov/dataset/596b5eed-31de-4fd8-a645-249f3f9b19c4/resource/57da6c9a-41a7-44b0-ab8d-815ff2cd5913/download/cscpopendata.csv"; + $urls[3]['type'] = 'text/csv'; + $urls[3]['extension'] = 'csv'; + $urls[3]['name'] = "cscpopendata.csv"; + + foreach ($urls as $key => $info) { + $fileInfo = new getRemoteFileInfo($info['url'], 'test', TRUE); + $this->assertEquals($fileInfo->getType(), $info['type']); + $this->assertEquals($fileInfo->getExtension(), $info['extension']); + $this->assertEquals($fileInfo->getName(), $info['name']); + } } } diff --git a/dkan/themes/nuboot_radix/nuboot_radix.info b/dkan/themes/nuboot_radix/nuboot_radix.info index 9a478b995..17a749e7a 100644 --- a/dkan/themes/nuboot_radix/nuboot_radix.info +++ b/dkan/themes/nuboot_radix/nuboot_radix.info @@ -56,6 +56,3 @@ settings[toggle_main_menu] = 1 settings[toggle_secondary_menu] = 1 settings[copyright][format] = 'html' -; Information added by DKAN release script on 1/8/2018 -version = 7.x-1.14.1 -project = dkan diff --git a/docroot/PATCHES.txt b/docroot/PATCHES.txt index dd0db99e1..10122c491 100644 --- a/docroot/PATCHES.txt +++ b/docroot/PATCHES.txt @@ -3,5 +3,6 @@ The following patches have been applied to this project: - https://www.drupal.org/files/issues/drupal-undefinedindex_fileupload-1903010-4.patch - https://www.drupal.org/files/issues/file.remote-file_save.628094.22.patch - https://www.drupal.org/files/issues/drupal_bug_multiple_values_select_states.patch +- https://www.drupal.org/files/issues/1551132-drupal-reinstall-schema-empty-tables-87-D7.patch This file was automatically generated by Drush Make (http://drupal.org/project/drush). diff --git a/docroot/includes/database/schema.inc b/docroot/includes/database/schema.inc index 31862db39..8094cea0a 100644 --- a/docroot/includes/database/schema.inc +++ b/docroot/includes/database/schema.inc @@ -660,7 +660,13 @@ abstract class DatabaseSchema implements QueryPlaceholderInterface { */ public function createTable($name, $table) { if ($this->tableExists($name)) { - throw new DatabaseSchemaObjectExistsException(t('Table @name already exists.', array('@name' => $name))); + if (db_select($name)->countQuery()->execute()->fetchField() == 0) { + $this->dropTable($name); + watchdog('database', 'Dropped empty, already existing table @name before recreating it.', array('@name' => $name)); + } + else { + throw new DatabaseSchemaObjectExistsException(t('Table @name already exists and has data. Can\'t automatically recreate it.', array('@name' => $name))); + } } $statements = $this->createTableSql($name, $table); foreach ($statements as $statement) { From 3f99d5bd84789d1fbbd3e34f9a9b52446368dd56 Mon Sep 17 00:00:00 2001 From: Janette Day Date: Tue, 13 Feb 2018 16:45:21 -0600 Subject: [PATCH 2/2] Simplify user.admin.feature background --- dkan/test/features/user.admin.feature | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/dkan/test/features/user.admin.feature b/dkan/test/features/user.admin.feature index 787404b5f..34f2c2000 100644 --- a/dkan/test/features/user.admin.feature +++ b/dkan/test/features/user.admin.feature @@ -12,36 +12,9 @@ Feature: User Given users: | name | mail | roles | | John | john@example.com | site manager | - | Badmin | admin@example.com | site manager | | aadmin | admin@example.com | administrator | - | Gabriel | gabriel@example.com | content creator | | Jaz | jaz@example.com | editor | | Katie | katie@example.com | content creator | - | Martin | martin@example.com | editor | - | Celeste | celeste@example.com | editor | - Given groups: - | title | author | published | - | Group 01 | Badmin | Yes | - | Group 02 | Badmin | Yes | - | Group 03 | Badmin | No | - And group memberships: - | user | group | role on group | membership status | - | Gabriel | Group 01 | administrator member | Active | - | Katie | Group 01 | member | Active | - | Jaz | Group 01 | member | Pending | - | Admin | Group 02 | administrator member | Active | - | Celeste | Group 02 | member | Active | - And "Tags" terms: - | name | - | world | - | results | - And datasets: - | title | publisher | author | published | tags | description | - | Dataset 01 | Group 01 | Katie | Yes | world | Test | - | Dataset 02 | Group 01 | Katie | No | world | Test | - | Dataset 03 | Group 01 | Gabriel | Yes | results | Test | - | Dataset 04 | Group 01 | Katie | Yes | world | Test | - Scenario: Edit any user account Given I am logged in as "John"