class PendingDbUpdates in Automatic Updates 8
Pending database updates checker.
Hierarchy
- class \Drupal\automatic_updates\ReadinessChecker\PendingDbUpdates implements ReadinessCheckerInterface uses StringTranslationTrait
Expanded class hierarchy of PendingDbUpdates
1 file declares its use of PendingDbUpdates
- PendingDbUpdatesTest.php in tests/
src/ Kernel/ ReadinessChecker/ PendingDbUpdatesTest.php
1 string reference to 'PendingDbUpdates'
1 service uses PendingDbUpdates
File
- src/
ReadinessChecker/ PendingDbUpdates.php, line 11
Namespace
Drupal\automatic_updates\ReadinessCheckerView source
class PendingDbUpdates implements ReadinessCheckerInterface {
use StringTranslationTrait;
/**
* The update registry.
*
* @var \Drupal\Core\Update\UpdateRegistry
*/
protected $updateRegistry;
/**
* PendingDbUpdates constructor.
*
* @param \Drupal\Core\Update\UpdateRegistry $update_registry
* The update registry.
*/
public function __construct(UpdateRegistry $update_registry) {
$this->updateRegistry = $update_registry;
}
/**
* {@inheritdoc}
*/
public function run() {
$messages = [];
if ($this
->areDbUpdatesPending()) {
$messages[] = $this
->t('There are pending database updates. Please run update.php.');
}
return $messages;
}
/**
* Checks if there are pending database updates.
*
* @return bool
* TRUE if there are pending updates, otherwise FALSE.
*/
protected function areDbUpdatesPending() {
require_once DRUPAL_ROOT . '/core/includes/install.inc';
require_once DRUPAL_ROOT . '/core/includes/update.inc';
drupal_load_updates();
$hook_updates = update_get_update_list();
$post_updates = $this->updateRegistry
->getPendingUpdateFunctions();
return (bool) array_merge($hook_updates, $post_updates);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PendingDbUpdates:: |
protected | property | The update registry. | |
PendingDbUpdates:: |
protected | function | Checks if there are pending database updates. | 1 |
PendingDbUpdates:: |
public | function |
Run check. Overrides ReadinessCheckerInterface:: |
|
PendingDbUpdates:: |
public | function | PendingDbUpdates constructor. | 1 |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |