diff --git a/composer.json b/composer.json index 17aa06ca7c..6b370d186d 100644 --- a/composer.json +++ b/composer.json @@ -237,7 +237,7 @@ "Do not override the default user entity view. @see https://www.drupal.org/node/2650192": "https://www.drupal.org/files/issues/properly_place_fields-2650192-4-D8.patch" }, "drupal/publication_date": { - "Published on empty for existing nodes @see https://www.drupal.org/project/publication_date/issues/2983348": "https://www.drupal.org/files/issues/2019-08-07/2983348-32.patch", + "Published on empty for existing nodes @see https://www.drupal.org/project/publication_date/issues/2983348": "https://www.drupal.org/files/issues/2019-08-16/2983348-39.patch", "Provide computed properties that return the publication date or the created/updated date @see https://www.drupal.org/project/publication_date/issues/3066317": "https://www.drupal.org/files/issues/2019-07-07/3066317-3.patch" }, "drupal/rdf_entity": { diff --git a/composer.lock b/composer.lock index 16196ebf2f..d392fb3cfd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b49d39673edcec664dca5ea4e1a19bdc", + "content-hash": "8503e1b259ba46c80e17e06614307f38", "packages": [ { "name": "SEMICeu/adms-ap_validator", @@ -2438,7 +2438,7 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0-or-later" + "GPL-2.0+" ], "authors": [ { @@ -2633,6 +2633,14 @@ "GPL-2.0-or-later" ], "authors": [ + { + "name": "bircher", + "homepage": "https://www.drupal.org/user/1344166" + }, + { + "name": "gnuget", + "homepage": "https://www.drupal.org/user/992990" + }, { "name": "mlncn", "homepage": "https://www.drupal.org/user/64383" @@ -2745,8 +2753,8 @@ "dev-1.x": "1.x-dev" }, "drupal": { - "version": "8.x-1.0-alpha7", - "datestamp": "1521314235", + "version": "8.x-1.0-alpha6+2-dev", + "datestamp": "1513615684", "security-coverage": { "status": "not-covered", "message": "Project has not opted into security advisory coverage!" @@ -3683,7 +3691,7 @@ }, "drupal": { "version": "8.x-1.3", - "datestamp": "1556645881", + "datestamp": "1551291083", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -3877,7 +3885,7 @@ }, "drupal": { "version": "8.x-4.0-alpha3", - "datestamp": "1521598850", + "datestamp": "1521598685", "security-coverage": { "status": "not-covered", "message": "Alpha releases are not covered by Drupal security advisories." @@ -4726,7 +4734,7 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0-or-later" + "GPL-2.0+" ], "authors": [ { @@ -5381,7 +5389,7 @@ } }, "patches_applied": { - "Published on empty for existing nodes @see https://www.drupal.org/project/publication_date/issues/2983348": "https://www.drupal.org/files/issues/2019-08-07/2983348-32.patch", + "Published on empty for existing nodes @see https://www.drupal.org/project/publication_date/issues/2983348": "https://www.drupal.org/files/issues/2019-08-16/2983348-39.patch", "Provide computed properties that return the publication date or the created/updated date @see https://www.drupal.org/project/publication_date/issues/3066317": "https://www.drupal.org/files/issues/2019-07-07/3066317-3.patch" } }, @@ -5448,7 +5456,7 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0-or-later" + "GPL-2.0+" ], "authors": [ { @@ -6139,7 +6147,7 @@ }, "drupal": { "version": "8.x-1.0-beta3", - "datestamp": "1477868939", + "datestamp": "1542122580", "security-coverage": { "status": "not-covered", "message": "Beta releases are not covered by Drupal security advisories." @@ -6493,7 +6501,7 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0-or-later" + "GPL-2.0+" ], "authors": [ { @@ -6657,7 +6665,7 @@ "description": "Plugin to export views data into various file formats.", "homepage": "https://www.drupal.org/project/views_data_export", "support": { - "source": "https://git.drupalcode.org/project/views_data_export" + "source": "http://cgit.drupalcode.org/views_data_export" } }, { @@ -7484,7 +7492,7 @@ "reference": "master" }, "type": "drupal-theme-library", - "time": "2018-10-31T20:10:45+00:00" + "time": "2018-05-01T01:48:25+00:00" }, { "name": "jakub-onderka/php-console-color", @@ -9985,7 +9993,7 @@ "reference": "master" }, "type": "library", - "time": "2019-03-13T23:53:42+00:00" + "time": "2019-03-22T22:25:24+00:00" }, { "name": "stack/builder", diff --git a/web/modules/custom/joinup_core/joinup_core.post_update.php b/web/modules/custom/joinup_core/joinup_core.post_update.php index 76d5e08e7f..113344d50c 100644 --- a/web/modules/custom/joinup_core/joinup_core.post_update.php +++ b/web/modules/custom/joinup_core/joinup_core.post_update.php @@ -712,9 +712,85 @@ function joinup_core_post_update_0_fix_publication_dates() { $node_storage = \Drupal::entityTypeManager()->getStorage('node'); $connection = \Drupal::database(); $connection->update($node_storage->getDataTable()) - ->expression('published_at', PUBLICATION_DATE_DEFAULT) + ->fields(['published_at' => NULL]) ->execute(); $connection->update($node_storage->getRevisionDataTable()) - ->expression('published_at', PUBLICATION_DATE_DEFAULT) + ->fields(['published_at' => NULL]) ->execute(); } + +/** + * Reset the publication dates again. + */ +function joinup_core_post_update_refix_publication_dates() { + $connection = Database::getConnection(); + + // Clean up the values from the database and start anew. + joinup_core_post_update_0_fix_publication_dates(); + + // The upstream update path is using the `changed` timestamp in order to + // update the publication timestamp. However, we already have a way of + // accurately tracking it, the `created` property. We already update the + // `created` property during the initial publication so by reproducing the + // upstream queries but having the `created` property used instead, we + // properly set the publication date. + $queries = [ + // Update nodes with multiple revisions that have at least one published + // revision so the publication date is set to the created timestamp of the + // first published revision. + [ + 'query' => <<= s.vid; +SQL + , + 'arguments' => [], + ], + + // Set the remainder of the publication dates in the revisions table to the + // default timestamp. This applies to all revisions that were created before + // the node was first published. + [ + 'query' => << [':default_timestamp' => PUBLICATION_DATE_DEFAULT], + ], + + // Copy the publication date from the revisions table to the node table. + [ + 'query' => << [], + ], + ]; + + // Perform the operations in a single atomic transaction. + $transaction = $connection->startTransaction(); + try { + foreach ($queries as $query_data) { + \Drupal::database()->query($query_data['query'], $query_data['arguments']); + } + } + catch (Exception $e) { + $transaction->rollBack(); + throw new Exception('Database error', 0, $e); + } +}