Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

ISAICP-5635: Fix the update path on 'master'. #1862

Merged
merged 1 commit into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions web/modules/custom/joinup_core/joinup_core.install
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Drupal\Core\Database\Database;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Site\Settings;
use Drupal\field\Entity\FieldConfig;
use Drupal\sparql_entity_storage\Entity\Query\Sparql\SparqlArg;
use Drupal\sparql_entity_storage\Entity\SparqlMapping;
use Drupal\user\Entity\User;
Expand Down Expand Up @@ -461,15 +460,3 @@ function joinup_core_update_8113(array &$sandbox): ?string {

return "Finished collecting {$sandbox['progress']} node visit counts.";
}

/**
* Stats #3: Uninstall stale fields.
*/
function joinup_core_update_8114(): void {
// Delete 'field_download_count' field.
FieldConfig::loadByName('rdf_entity', 'asset_distribution', 'field_download_count')->delete();
// Delete 'field_visit_count' field.
foreach (['discussion', 'document', 'event', 'news'] as $bundle) {
FieldConfig::loadByName('node', $bundle, 'field_visit_count')->delete();
}
}
30 changes: 30 additions & 0 deletions web/modules/custom/joinup_core/joinup_core.post_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Drupal\Core\Serialization\Yaml;
use Drupal\file\Entity\File;
use Drupal\redirect\Entity\Redirect;
use Drupal\search_api\Entity\Index;
use Drupal\sparql_entity_storage\Entity\SparqlMapping;
use EasyRdf\Graph;
use EasyRdf\GraphStore;
Expand Down Expand Up @@ -796,6 +797,35 @@ function joinup_core_post_update_refix_publication_dates() {
}
}

/**
* Stats #3: Repair Search API task.
*/
function joinup_core_post_update_stats3(): void {
$db = \Drupal::database();

$tasks = $db->select('search_api_task')
->fields('search_api_task', ['id', 'data'])
->condition('type', 'updateIndex')
->condition('server_id', 'solr_published')
->condition('index_id', 'published')
->execute()
->fetchAllKeyed();

$published_index_values = Index::load('published')->toArray();
foreach ($tasks as $id => $data) {
$data = unserialize($data);
// When a Search API index config entity is updated, a reindex is triggered
// but, for some reasons, the task uses the 'original' index config entity
// version.
// @see \Drupal\search_api\Entity\Server::updateIndex()
$data['#values'] = $published_index_values;
$db->update('search_api_task')
->condition('id', $id)
->fields(['data' => serialize($data)])
->execute();
}
}

/**
* Stats #4: Create metadata entities.
*/
Expand Down