Skip to content

Commit

Permalink
Merge pull request #22 from wunderio/feature/dont-miss-a-beat
Browse files Browse the repository at this point in the history
Fix occasionally missing notifications.
  • Loading branch information
ragnarkurmwunder authored Mar 31, 2023
2 parents 7de1b4f + c1621e1 commit 851d7ce
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Here are few more things to try:
- Drupal `update` module:
- Make sure `/admin/reports/updates/settings` loads, and is configured
- Check the status at "Available updates" report. Is it red or green?
- `drush eval 'var_dump(update_get_available(TRUE));` - should return large array.
- `drush eval 'var_dump(update_get_available(TRUE));'` - should return large array.
- `drush eval '$available = update_get_available(TRUE); $project_data = update_calculate_project_data($available); var_dump($project_data);'`
- `drush ev '\Drupal::keyValue("update_fetch_task")->deleteAll();'` - after `update` reinstall
- `drush sqlq 'truncate batch'`
Expand Down
9 changes: 8 additions & 1 deletion src/UpdatesLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ public function run(): void {

$this->refresh();
$statuses = $this->statusesGet();
if (empty($statuses)) {
$this->logUnknown();
return;
}

$this->runDiff($statuses);
$this->runStatistics($statuses, $now);
Expand Down Expand Up @@ -316,7 +320,7 @@ public function refresh(): void {
* Get module statuses from Drupal.
*
* @return array
* Return array of statuses.
* Return array of statuses. Will be an empty array if Drupal is messed up.
*/
public function statusesGet(): array {

Expand All @@ -337,6 +341,9 @@ public function statusesGet(): array {
];

$available = update_get_available(TRUE);
if (empty($available)) {
return [];
}

// Function update_calculate_project_data not found.
/**
Expand Down
1 change: 1 addition & 0 deletions tests/src/Kernel/StatusesGetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class StatusesGetTest extends KernelTestBase {
protected function setUp(): void {
parent::setUp();
$this->installConfig(['updates_log']);
$this->installConfig(['update']);
$this->updatesLogService = \Drupal::service('updates_log.updates_logger');
}

Expand Down
2 changes: 1 addition & 1 deletion updates_log.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ description: "Log module update info"
core: 8.x
core_version_requirement: ^8 || ^9 || ^10
package: Development
version: 2.2.1
version: 2.2.2
dependencies:
- drupal:update

0 comments on commit 851d7ce

Please sign in to comment.