DbUpdatesTrait.php in Drupal 8
File
core/modules/system/src/Tests/Update/DbUpdatesTrait.php
View source
<?php
namespace Drupal\system\Tests\Update;
@trigger_error(__NAMESPACE__ . '\\DbUpdatesTrait is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Use \\Drupal\\FunctionalTests\\Update\\DbUpdatesTrait instead. See https://www.drupal.org/node/2896640.', E_USER_DEPRECATED);
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Url;
trait DbUpdatesTrait {
use StringTranslationTrait;
protected function enableUpdates($module, $group, $index) {
$this->container
->get('state')
->set($module . '.db_updates.' . $group, $index);
}
protected function applyUpdates() {
$this
->drupalGet(Url::fromRoute('system.db_update'));
$this
->clickLink($this
->t('Continue'));
$this
->clickLink($this
->t('Apply pending updates'));
}
public static function includeUpdates($module, $group) {
if ($index = \Drupal::state()
->get($module . '.db_updates.' . $group)) {
module_load_include('inc', $module, 'update/' . $group . '_' . $index);
}
}
}
Traits
Name |
Description |
DbUpdatesTrait Deprecated |
Provides methods to conditionally enable db update functions and apply
pending db updates through the Update UI. |