From daa7b348128f3f4279ceef5eb23629e8cb031f83 Mon Sep 17 00:00:00 2001 From: Ilias Dimopoulos Date: Fri, 2 Aug 2019 22:07:57 +0300 Subject: [PATCH 01/12] ISAICP-5455: Temp fix for the news publication issue. --- web/modules/custom/joinup_core/joinup_core.module | 12 ++++++++++++ web/themes/joinup/joinup_theme.theme | 13 ++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/web/modules/custom/joinup_core/joinup_core.module b/web/modules/custom/joinup_core/joinup_core.module index f4b2a25708..1b4171f526 100644 --- a/web/modules/custom/joinup_core/joinup_core.module +++ b/web/modules/custom/joinup_core/joinup_core.module @@ -1362,3 +1362,15 @@ function joinup_core_cron() { cached_computed_field_cron(); } } + +/** + * Implements hook_ENTITY_TYPE_presave(). + * + * During saving a node, if the entity never had a published version and is now + * published, the creation date is updated with the current datetime. + */ +function joinup_core_node_presave(NodeInterface $entity) { + if ($entity->hasField('published_at') && empty($entity->published_at->value) && $entity->isPublished()) { + $entity->set('published_at', \Drupal::time()->getRequestTime()); + } +} diff --git a/web/themes/joinup/joinup_theme.theme b/web/themes/joinup/joinup_theme.theme index d318472664..5a9e329a82 100644 --- a/web/themes/joinup/joinup_theme.theme +++ b/web/themes/joinup/joinup_theme.theme @@ -931,7 +931,8 @@ function joinup_theme_preprocess_page_title__node__news(&$variables) { $field_news_headline = $viewBuilder->viewField($node->field_news_headline, 'default'); $variables['additional_content']['field_news_headline'] = $field_news_headline; - $published = \Drupal::service('date.formatter')->format($node->published_at->published_at_or_created, 'date_only'); + $datetime = empty($node->published_at->value) ? $node->getCreatedTime() : $node->published_at->value; + $published = \Drupal::service('date.formatter')->format($datetime, 'date_only'); $variables['additional_content']['published'] = $published; $author_inline = _joinup_theme_get_author($node); @@ -945,7 +946,8 @@ function joinup_theme_preprocess_page_title__node__discussion(&$variables) { /** @var \Drupal\node\NodeInterface $node */ $node = $variables['entity']; - $published = \Drupal::service('date.formatter')->format($node->published_at->published_at_or_created, 'date_only'); + $datetime = empty($node->published_at->value) ? $node->getCreatedTime() : $node->published_at->value; + $published = \Drupal::service('date.formatter')->format($datetime, 'date_only'); $variables['additional_content']['published'] = $published; $author_inline = _joinup_theme_get_author($node); @@ -959,7 +961,8 @@ function joinup_theme_preprocess_page_title__node__video(&$variables) { /** @var \Drupal\node\NodeInterface $node */ $node = $variables['entity']; - $published = \Drupal::service('date.formatter')->format($node->published_at->published_at_or_created, 'date_only'); + $datetime = empty($node->published_at->value) ? $node->getCreatedTime() : $node->published_at->value; + $published = \Drupal::service('date.formatter')->format($datetime, 'date_only'); $variables['additional_content']['published'] = $published; $author_inline = _joinup_theme_get_author($node); @@ -1059,8 +1062,8 @@ function joinup_theme_preprocess_page_title__node__event(&$variables) { $field_event_date = $viewBuilder->viewField($node->get('field_event_date'), 'default'); $field_event_location = $viewBuilder->viewField($node->get('field_location'), 'default'); - $published = \Drupal::service('date.formatter')->format($node->published_at->published_at_or_created, 'date_only'); - + $datetime = empty($node->published_at->value) ? $node->getCreatedTime() : $node->published_at->value; + $published = \Drupal::service('date.formatter')->format($datetime, 'date_only'); $author_inline = _joinup_theme_get_author($node); $variables['additional_content']['field_event_date'] = $field_event_date; From 4123767cb649d04cec793f7d29b6cebdba0ab29e Mon Sep 17 00:00:00 2001 From: Ilias Dimopoulos Date: Sun, 4 Aug 2019 13:09:01 +0300 Subject: [PATCH 02/12] Revert "ISAICP-5455: Temp fix for the news publication issue." This reverts commit daa7b348128f3f4279ceef5eb23629e8cb031f83. --- web/modules/custom/joinup_core/joinup_core.module | 12 ------------ web/themes/joinup/joinup_theme.theme | 13 +++++-------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/web/modules/custom/joinup_core/joinup_core.module b/web/modules/custom/joinup_core/joinup_core.module index 1b4171f526..f4b2a25708 100644 --- a/web/modules/custom/joinup_core/joinup_core.module +++ b/web/modules/custom/joinup_core/joinup_core.module @@ -1362,15 +1362,3 @@ function joinup_core_cron() { cached_computed_field_cron(); } } - -/** - * Implements hook_ENTITY_TYPE_presave(). - * - * During saving a node, if the entity never had a published version and is now - * published, the creation date is updated with the current datetime. - */ -function joinup_core_node_presave(NodeInterface $entity) { - if ($entity->hasField('published_at') && empty($entity->published_at->value) && $entity->isPublished()) { - $entity->set('published_at', \Drupal::time()->getRequestTime()); - } -} diff --git a/web/themes/joinup/joinup_theme.theme b/web/themes/joinup/joinup_theme.theme index 5a9e329a82..d318472664 100644 --- a/web/themes/joinup/joinup_theme.theme +++ b/web/themes/joinup/joinup_theme.theme @@ -931,8 +931,7 @@ function joinup_theme_preprocess_page_title__node__news(&$variables) { $field_news_headline = $viewBuilder->viewField($node->field_news_headline, 'default'); $variables['additional_content']['field_news_headline'] = $field_news_headline; - $datetime = empty($node->published_at->value) ? $node->getCreatedTime() : $node->published_at->value; - $published = \Drupal::service('date.formatter')->format($datetime, 'date_only'); + $published = \Drupal::service('date.formatter')->format($node->published_at->published_at_or_created, 'date_only'); $variables['additional_content']['published'] = $published; $author_inline = _joinup_theme_get_author($node); @@ -946,8 +945,7 @@ function joinup_theme_preprocess_page_title__node__discussion(&$variables) { /** @var \Drupal\node\NodeInterface $node */ $node = $variables['entity']; - $datetime = empty($node->published_at->value) ? $node->getCreatedTime() : $node->published_at->value; - $published = \Drupal::service('date.formatter')->format($datetime, 'date_only'); + $published = \Drupal::service('date.formatter')->format($node->published_at->published_at_or_created, 'date_only'); $variables['additional_content']['published'] = $published; $author_inline = _joinup_theme_get_author($node); @@ -961,8 +959,7 @@ function joinup_theme_preprocess_page_title__node__video(&$variables) { /** @var \Drupal\node\NodeInterface $node */ $node = $variables['entity']; - $datetime = empty($node->published_at->value) ? $node->getCreatedTime() : $node->published_at->value; - $published = \Drupal::service('date.formatter')->format($datetime, 'date_only'); + $published = \Drupal::service('date.formatter')->format($node->published_at->published_at_or_created, 'date_only'); $variables['additional_content']['published'] = $published; $author_inline = _joinup_theme_get_author($node); @@ -1062,8 +1059,8 @@ function joinup_theme_preprocess_page_title__node__event(&$variables) { $field_event_date = $viewBuilder->viewField($node->get('field_event_date'), 'default'); $field_event_location = $viewBuilder->viewField($node->get('field_location'), 'default'); - $datetime = empty($node->published_at->value) ? $node->getCreatedTime() : $node->published_at->value; - $published = \Drupal::service('date.formatter')->format($datetime, 'date_only'); + $published = \Drupal::service('date.formatter')->format($node->published_at->published_at_or_created, 'date_only'); + $author_inline = _joinup_theme_get_author($node); $variables['additional_content']['field_event_date'] = $field_event_date; From 1cbe38127d33e59feeff334b085a08f7314a633d Mon Sep 17 00:00:00 2001 From: Ilias Dimopoulos Date: Sun, 4 Aug 2019 17:41:01 +0300 Subject: [PATCH 03/12] ISAICP-5455: Fix the values of the published_at property. --- .../joinup_core/joinup_core.post_update.php | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) 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 ea184ccd8a..abf3896ebd 100644 --- a/web/modules/custom/joinup_core/joinup_core.post_update.php +++ b/web/modules/custom/joinup_core/joinup_core.post_update.php @@ -681,3 +681,104 @@ function joinup_core_post_update_install_publication_date() { function joinup_core_post_update_enable_joinup_privacy() { \Drupal::service('module_installer')->install(['joinup_privacy']); } + +/** + * Fix publication dates for all cases. + */ +function joinup_core_post_update_fix_all_publication_dateq(&$sandbox) { + // This function will iterate through all content and will apply the default + // value to all revisions until the first published one and then, it will + // apply the created date to all other revisions. When an entity is initially + // published, then every subsequent revision should cary the same value + // regardless of whether it is published or not. + // + // In the below example, the entity is created as an unpublished and is + // published in the second version. All other versions retain the value. + // @codingStandardsIgnoreStart + // | revision | status | publication date | + // | 1 | 0 | PUBLICATION_DATE_DEFAULT | + // | 2 | 1 | | + // | 3 | 0 | | + // | 4 | 1 | | + // | 5 | 0 | | + // @codingStandardsIgnoreEnd + // + // The above approach is applied to the revision table. For the data table, + // the published_at value will have 2 cases. It will receive the default value + // if the entity has never been published or the publication date if the + // entity has been published at least once, regardless of the current state. + $database = \Drupal::database(); + $node_storage = \Drupal::entityTypeManager()->getStorage('node'); + if (empty($sandbox['nids'])) { + // Clean all set publication dates from the revisions table, as the empty + // value is needed later on. + $database + ->update($node_storage->getRevisionDataTable()) + ->expression('published_at', 'null') + ->execute(); + + $sandbox['nids'] = $database->query('SELECT nid FROM {node} n')->fetchCol(); + $sandbox['progress'] = 0; + $sandbox['total'] = count($sandbox['nids']); + } + + $nids = array_splice($sandbox['nids'], 0, 300); + $query = $database->select('node', 'n'); + $query->leftJoin('node_field_revision', 'nr', 'n.nid = nr.nid'); + $query->fields('nr', ['nid', 'vid', 'changed']); + $query->condition('status', 1); + $query->condition('n.nid', $nids, 'IN'); + $query->groupBy('nr.nid, nr.vid, nr.changed'); + $query->orderBy('nr.vid', 'DESC'); + + $node_data = $query->execute()->fetchAllAssoc('nid'); + foreach ($nids as $nid) { + if (empty($node_data[$nid])) { + // Node has never been published. Set the default value to all revisions. + $database + ->update($node_storage->getDataTable()) + ->expression('published_at', PUBLICATION_DATE_DEFAULT) + ->condition('nid', $nid) + ->execute(); + $database + ->update($node_storage->getRevisionDataTable()) + ->expression('published_at', PUBLICATION_DATE_DEFAULT) + ->condition('nid', $nid) + ->execute(); + } + else { + // Node has been published at least once. The data table will receive the + // publication date while for the revision table, the publication date + // will be set for all versions including and following the first + // published version. All others will receive the default value. + $first_published_timestamp = $node_data[$nid]->changed; + $first_published_vid = $node_data[$nid]->vid; + + // Set the revisions that will receive the publication timestamp. + $database + ->update($node_storage->getDataTable()) + ->expression('published_at', $first_published_timestamp) + ->condition('nid', $nid) + ->execute(); + $database + ->update($node_storage->getRevisionDataTable()) + ->expression('published_at', $first_published_timestamp) + ->condition('nid', $nid) + ->condition('vid', $first_published_vid, '>=') + ->execute(); + + // The revisions that are left have a null publication date and need to + // receive the default value. + $database + ->update($node_storage->getRevisionDataTable()) + ->expression('published_at', PUBLICATION_DATE_DEFAULT) + ->condition('nid', $nid) + ->isNull('published_at') + ->execute(); + } + } + + $sandbox['progress'] += count($nids); + $sandbox['#finished'] = (int) empty($sandbox['nids']) ? 1 : $sandbox['progress'] / $sandbox['total']; + return "Processed {$sandbox['progress']} out of {$sandbox['total']} nodes."; +} From 0bfda759c7a8f53873d08f30b138562cca8be3f1 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Tue, 6 Aug 2019 09:13:25 +0300 Subject: [PATCH 04/12] ISAICP-5455: Clear the complete cache so that Redis will not provide stale data during database updates. While working on this ticket I saw user data from my previous database installation being returned from entity storage. This was still present in the Redis cache. We should clear the entire cache before updating. --- build.project.xml | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/build.project.xml b/build.project.xml index cc41ef450c..df03c1936d 100644 --- a/build.project.xml +++ b/build.project.xml @@ -94,21 +94,6 @@ - - - bin - config - - + From 4599fb63920ea5c5efa5c8981fd02681547783bf Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Tue, 6 Aug 2019 10:24:05 +0300 Subject: [PATCH 05/12] ISAICP-5455: Remove the slow per-entity update, it will be replaced by a fast update query. --- .../joinup_core/joinup_core.post_update.php | 101 ------------------ 1 file changed, 101 deletions(-) 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 abf3896ebd..ea184ccd8a 100644 --- a/web/modules/custom/joinup_core/joinup_core.post_update.php +++ b/web/modules/custom/joinup_core/joinup_core.post_update.php @@ -681,104 +681,3 @@ function joinup_core_post_update_install_publication_date() { function joinup_core_post_update_enable_joinup_privacy() { \Drupal::service('module_installer')->install(['joinup_privacy']); } - -/** - * Fix publication dates for all cases. - */ -function joinup_core_post_update_fix_all_publication_dateq(&$sandbox) { - // This function will iterate through all content and will apply the default - // value to all revisions until the first published one and then, it will - // apply the created date to all other revisions. When an entity is initially - // published, then every subsequent revision should cary the same value - // regardless of whether it is published or not. - // - // In the below example, the entity is created as an unpublished and is - // published in the second version. All other versions retain the value. - // @codingStandardsIgnoreStart - // | revision | status | publication date | - // | 1 | 0 | PUBLICATION_DATE_DEFAULT | - // | 2 | 1 | | - // | 3 | 0 | | - // | 4 | 1 | | - // | 5 | 0 | | - // @codingStandardsIgnoreEnd - // - // The above approach is applied to the revision table. For the data table, - // the published_at value will have 2 cases. It will receive the default value - // if the entity has never been published or the publication date if the - // entity has been published at least once, regardless of the current state. - $database = \Drupal::database(); - $node_storage = \Drupal::entityTypeManager()->getStorage('node'); - if (empty($sandbox['nids'])) { - // Clean all set publication dates from the revisions table, as the empty - // value is needed later on. - $database - ->update($node_storage->getRevisionDataTable()) - ->expression('published_at', 'null') - ->execute(); - - $sandbox['nids'] = $database->query('SELECT nid FROM {node} n')->fetchCol(); - $sandbox['progress'] = 0; - $sandbox['total'] = count($sandbox['nids']); - } - - $nids = array_splice($sandbox['nids'], 0, 300); - $query = $database->select('node', 'n'); - $query->leftJoin('node_field_revision', 'nr', 'n.nid = nr.nid'); - $query->fields('nr', ['nid', 'vid', 'changed']); - $query->condition('status', 1); - $query->condition('n.nid', $nids, 'IN'); - $query->groupBy('nr.nid, nr.vid, nr.changed'); - $query->orderBy('nr.vid', 'DESC'); - - $node_data = $query->execute()->fetchAllAssoc('nid'); - foreach ($nids as $nid) { - if (empty($node_data[$nid])) { - // Node has never been published. Set the default value to all revisions. - $database - ->update($node_storage->getDataTable()) - ->expression('published_at', PUBLICATION_DATE_DEFAULT) - ->condition('nid', $nid) - ->execute(); - $database - ->update($node_storage->getRevisionDataTable()) - ->expression('published_at', PUBLICATION_DATE_DEFAULT) - ->condition('nid', $nid) - ->execute(); - } - else { - // Node has been published at least once. The data table will receive the - // publication date while for the revision table, the publication date - // will be set for all versions including and following the first - // published version. All others will receive the default value. - $first_published_timestamp = $node_data[$nid]->changed; - $first_published_vid = $node_data[$nid]->vid; - - // Set the revisions that will receive the publication timestamp. - $database - ->update($node_storage->getDataTable()) - ->expression('published_at', $first_published_timestamp) - ->condition('nid', $nid) - ->execute(); - $database - ->update($node_storage->getRevisionDataTable()) - ->expression('published_at', $first_published_timestamp) - ->condition('nid', $nid) - ->condition('vid', $first_published_vid, '>=') - ->execute(); - - // The revisions that are left have a null publication date and need to - // receive the default value. - $database - ->update($node_storage->getRevisionDataTable()) - ->expression('published_at', PUBLICATION_DATE_DEFAULT) - ->condition('nid', $nid) - ->isNull('published_at') - ->execute(); - } - } - - $sandbox['progress'] += count($nids); - $sandbox['#finished'] = (int) empty($sandbox['nids']) ? 1 : $sandbox['progress'] / $sandbox['total']; - return "Processed {$sandbox['progress']} out of {$sandbox['total']} nodes."; -} From 016d4007ee96ae4e480467384c5aa810d5886a3c Mon Sep 17 00:00:00 2001 From: Claudiu Cristea Date: Mon, 5 Aug 2019 19:56:59 +0300 Subject: [PATCH 06/12] ISAICP-5459: Run phpunit in verbose mode. --- phpunit.xml.dist | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 928b9cfbc6..8f1f04c5a4 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -9,7 +9,8 @@ beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutOutputDuringTests="true" beStrictAboutChangesToGlobalState="true" - checkForUnintentionallyCoveredCode="false"> + checkForUnintentionallyCoveredCode="false" + verbose="true"> + + + + + + + + + + + + + + - From 80ead45953f33c5a10f06def0c8b79a694941b9c Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Wed, 7 Aug 2019 11:00:07 +0300 Subject: [PATCH 09/12] ISAICP-5455: Restore the publication dates. --- composer.json | 2 +- composer.lock | 56 +++++++++---------- .../joinup_core/joinup_core.post_update.php | 21 +++++++ 3 files changed, 50 insertions(+), 29 deletions(-) diff --git a/composer.json b/composer.json index 02a9eba946..afc4a02523 100644 --- a/composer.json +++ b/composer.json @@ -228,7 +228,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-07-07/2983348-19.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-07/2983348-29.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 abcc0ae232..e2eea2d7c7 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": "59b1effba1ce31f2145b858ab290f887", + "content-hash": "5b54cd8540fd6b7ca55e72ac5ca2bae8", "packages": [ { "name": "SEMICeu/adms-ap_validator", @@ -2429,7 +2429,11 @@ }, "drupal": { "version": "8.x-1.1", - "datestamp": "1492709942" + "datestamp": "1492709942", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } } }, "notification-url": "https://packages.drupal.org/8/downloads", @@ -3616,7 +3620,7 @@ }, "drupal": { "version": "8.x-1.3", - "datestamp": "1556645881", + "datestamp": "1551291083", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -4659,7 +4663,7 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0-or-later" + "GPL-2.0+" ], "authors": [ { @@ -4678,7 +4682,7 @@ "description": "Simple migrate drush commands: run, generate.", "homepage": "https://www.drupal.org/project/migrate_drush", "support": { - "source": "https://git.drupalcode.org/project/migrate_drush" + "source": "http://cgit.drupalcode.org/migrate_drush" } }, { @@ -4935,6 +4939,10 @@ "name": "leonk", "homepage": "https://www.drupal.org/user/84179" }, + { + "name": "mpp", + "homepage": "https://www.drupal.org/user/359881" + }, { "name": "pfrenssen", "homepage": "https://www.drupal.org/user/382067" @@ -4969,8 +4977,8 @@ "dev-4.x": "4.x-dev" }, "drupal": { - "version": "8.x-4.0-beta3+8-dev", - "datestamp": "1557949081", + "version": "8.x-4.0-beta3+10-dev", + "datestamp": "1559069285", "security-coverage": { "status": "not-covered", "message": "Project has not opted into security advisory coverage!" @@ -5314,7 +5322,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-07-07/2983348-19.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-07/2983348-29.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" } }, @@ -5371,8 +5379,8 @@ "dev-1.x": "1.x-dev" }, "drupal": { - "version": "8.x-1.1-beta1+0-dev", - "datestamp": "1532080685", + "version": "8.x-1.x-dev", + "datestamp": "1486527783", "security-coverage": { "status": "not-covered", "message": "Dev releases are not covered by Drupal security advisories." @@ -5381,17 +5389,13 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0-or-later" + "GPL-2.0+" ], "authors": [ { "name": "Bevan", "homepage": "https://www.drupal.org/user/49989" }, - { - "name": "Nixou", - "homepage": "https://www.drupal.org/user/2304734" - }, { "name": "RobLoach", "homepage": "https://www.drupal.org/user/61114" @@ -5428,7 +5432,7 @@ "description": "Redirect anonymous users from 403 Access Denied pages to the /user/login page.", "homepage": "https://www.drupal.org/project/r4032login", "support": { - "source": "https://git.drupalcode.org/project/r4032login" + "source": "http://cgit.drupalcode.org/r4032login" }, "time": "2017-02-08T04:20:19+00:00" }, @@ -5828,7 +5832,7 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0+" + "GPL-2.0-or-later" ], "authors": [ { @@ -6076,7 +6080,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." @@ -6150,7 +6154,7 @@ "description": "Provides code-driven workflow functionality.", "homepage": "https://www.drupal.org/project/state_machine", "support": { - "source": "https://git.drupalcode.org/project/state_machine" + "source": "http://cgit.drupalcode.org/state_machine" } }, { @@ -6201,7 +6205,7 @@ "description": "Provides support for extending sub-paths of URL aliases.", "homepage": "https://www.drupal.org/project/subpathauto", "support": { - "source": "https://git.drupalcode.org/project/subpathauto" + "source": "http://cgit.drupalcode.org/subpathauto" } }, { @@ -6430,7 +6434,7 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0-or-later" + "GPL-2.0+" ], "authors": [ { @@ -6453,7 +6457,7 @@ "description": "Select which roles should be able to see unpublished nodes.", "homepage": "https://www.drupal.org/project/view_unpublished", "support": { - "source": "https://git.drupalcode.org/project/view_unpublished" + "source": "http://cgit.drupalcode.org/view_unpublished" } }, { @@ -9924,7 +9928,7 @@ "reference": "master" }, "type": "library", - "time": "2019-04-02T18:33:21+00:00" + "time": "2019-03-22T22:25:24+00:00" }, { "name": "stack/builder", @@ -12636,7 +12640,7 @@ }, "drupal": { "version": "8.x-1.27", - "datestamp": "1558553350", + "datestamp": "1558552081", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -12930,10 +12934,6 @@ { "name": "larowlan", "homepage": "https://www.drupal.org/user/395439" - }, - { - "name": "matslats", - "homepage": "https://www.drupal.org/user/140053" } ], "description": "Imports default content when a module is enabled", 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 ea184ccd8a..34a7be350a 100644 --- a/web/modules/custom/joinup_core/joinup_core.post_update.php +++ b/web/modules/custom/joinup_core/joinup_core.post_update.php @@ -681,3 +681,24 @@ function joinup_core_post_update_install_publication_date() { function joinup_core_post_update_enable_joinup_privacy() { \Drupal::service('module_installer')->install(['joinup_privacy']); } + +/** + * Populate all publication dates. + */ +function joinup_core_post_update_fix_publication_dates() { + $module_path = DRUPAL_ROOT . '/' . drupal_get_path('module', 'publication_date') . '/publication_date.install'; + require_once $module_path; + + // Due to an incorrect earlier version of the install hook of the + // Publication Date module a number of older news items were present without a + // publication date. Erase all publication dates and restore them. + $connection = \Drupal::database(); + $connection->update($node_storage->getDataTable()) + ->expression('published_at', PUBLICATION_DATE_DEFAULT) + ->execute(); + $connection->update($node_storage->getRevisionDataTable()) + ->expression('published_at', PUBLICATION_DATE_DEFAULT) + ->execute(); + + _publication_date_populate_database_field(); +} From a8c259f8babe47d78ec4eb4a295cd209395342d6 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Wed, 7 Aug 2019 11:22:07 +0300 Subject: [PATCH 10/12] ISAICP-5455: Ensure that our post update hook runs before the one from the Publication Date module. --- .../custom/joinup_core/joinup_core.post_update.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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 34a7be350a..9c7dc6b92c 100644 --- a/web/modules/custom/joinup_core/joinup_core.post_update.php +++ b/web/modules/custom/joinup_core/joinup_core.post_update.php @@ -685,13 +685,13 @@ function joinup_core_post_update_enable_joinup_privacy() { /** * Populate all publication dates. */ -function joinup_core_post_update_fix_publication_dates() { - $module_path = DRUPAL_ROOT . '/' . drupal_get_path('module', 'publication_date') . '/publication_date.install'; - require_once $module_path; - +function joinup_core_post_update_0_fix_publication_dates() { // Due to an incorrect earlier version of the install hook of the // Publication Date module a number of older news items were present without a // publication date. Erase all publication dates and restore them. + // Note that since this update hook is prefixed with a 0 it is guaranteed to + // run before the post update hook of the Publication Date module. + $node_storage = \Drupal::entityTypeManager()->getStorage('node'); $connection = \Drupal::database(); $connection->update($node_storage->getDataTable()) ->expression('published_at', PUBLICATION_DATE_DEFAULT) @@ -699,6 +699,4 @@ function joinup_core_post_update_fix_publication_dates() { $connection->update($node_storage->getRevisionDataTable()) ->expression('published_at', PUBLICATION_DATE_DEFAULT) ->execute(); - - _publication_date_populate_database_field(); } From 6307fb70f2497256d60838e3a7f2c52d15835e6c Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Wed, 7 Aug 2019 11:31:51 +0300 Subject: [PATCH 11/12] ISAICP-5455: Invent a better name for the update hook. --- web/modules/custom/joinup_core/joinup_core.post_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9c7dc6b92c..5b595dae03 100644 --- a/web/modules/custom/joinup_core/joinup_core.post_update.php +++ b/web/modules/custom/joinup_core/joinup_core.post_update.php @@ -683,7 +683,7 @@ function joinup_core_post_update_enable_joinup_privacy() { } /** - * Populate all publication dates. + * Reset the publication dates. */ function joinup_core_post_update_0_fix_publication_dates() { // Due to an incorrect earlier version of the install hook of the From a209b96bb8846a923e3068a3e75c43ff246f9783 Mon Sep 17 00:00:00 2001 From: Pieter Frenssen Date: Wed, 7 Aug 2019 21:32:09 +0300 Subject: [PATCH 12/12] ISAICP-5455: Use a more recent version of the Publication Date patch which is compatible with PHP 7.2 and lower. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index afc4a02523..967c630ff8 100644 --- a/composer.json +++ b/composer.json @@ -228,7 +228,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-29.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-07/2983348-32.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": {