public function AudioFieldPluginBase::checkVersion in AudioField 8
Checks to see if this audio plugin version is up to date.
Parameters
bool $log_error: Flag to indicate whether or not alert should be logged/shown.
Return value
bool Returns a boolean indicating if version is up to date.
1 call to AudioFieldPluginBase::checkVersion()
- AudioFieldPluginBase::checkInstalled in src/
AudioFieldPluginBase.php - Checks to see if this audio plugin has been properly installed.
File
- src/
AudioFieldPluginBase.php, line 223
Class
- AudioFieldPluginBase
- Base class for audiofield plugins. Includes global functions.
Namespace
Drupal\audiofieldCode
public function checkVersion($log_error = TRUE) {
// Get the main library for this plugin.
$library = $this
->getPluginLibrary();
// Check to make sure the installed version is up to date.
if (version_compare($this
->getPluginLibraryVersion(), $library['version'], '<')) {
// Log the warning if necessary.
if ($log_error) {
$message_data = [
'@plugin' => $this
->getPluginTitle(),
'@version' => $this
->getPluginLibraryVersion(),
'@newversion' => $library['version'],
'@download-link' => Link::fromTextAndUrl($this
->getPluginRemoteSource(), Url::fromUri($this
->getPluginRemoteSource()))
->toString(),
'%command' => 'drush audiofield-update',
'@status_report' => Link::createFromRoute('status report', 'system.status')
->toString(),
];
$this->loggerFactory
->get('audiofield')
->warning('Warning: @plugin library is out of date. You should upgrade from version @version to version @newversion. You can manually download the required version here: @download-link or you can install automatically by running the command %command. See the @status_report for more information', $message_data);
$this->messenger
->addWarning($this
->t('Warning: @plugin library is out of date. You should upgrade from version @version to version @newversion. You can manually download the required version here: @download-link or you can install automatically by running the command %command. See the @status_report for more information', $message_data));
}
return FALSE;
}
return TRUE;
}