DrushCommands.php in Media entity 8.2
File
src/Commands/DrushCommands.php
View source
<?php
namespace Drupal\media_entity\Commands;
use Drush\Commands\DrushCommands as DrushCommandsBase;
use Drupal\media_entity\CliService;
class DrushCommands extends DrushCommandsBase {
protected $cliService;
public function __construct(CliService $cli_service) {
$this->cliService = $cli_service;
}
public function mediaEntityCheckUpgrade() {
$logger = $this
->logger();
if (drupal_get_installed_schema_version('media_entity') >= 8201) {
$logger
->success(dt('Your site has already run the media_entity DB updates. If you believe this is not correct, you should consider rolling back your database to a previous backup and try again.'));
return;
}
$checks = $this->cliService
->validateDbUpdateRequirements();
if (empty($checks['errors'])) {
$logger
->success(sprintf("\33[1;32;40m\33[1m%s\33[0m", '✓') . ' ' . dt('All upgrade requirements are met and you can proceed with the DB updates.'));
}
else {
$logger
->error(sprintf("\33[31;40m\33[1m%s\33[0m", '✗') . ' ' . dt('Your site did not pass all upgrade checks. You can find more information in the error messages below.'));
}
foreach ($checks['passes'] as $pass_msg) {
$logger
->success($pass_msg);
}
foreach ($checks['errors'] as $error_msg) {
$logger
->error($error_msg);
}
}
}