You are here

function jplayer_update_7002 in jPlayer 8.2

Same name and namespace in other branches
  1. 7.2 jplayer.install \jplayer_update_7002()

Transition to the jplayer_protect module if jplayer content protection is enabled.

File

./jplayer.install, line 93
Installation file for jPlayer module.

Code

function jplayer_update_7002() {
  if (\Drupal::config('jplayer.settings')
    ->get('jplayer_protected')) {
    \Drupal::config('jplayer.settings')
      ->set('jplayer_protect', TRUE)
      ->save();
    if (!\Drupal::moduleHandler()
      ->moduleExists('jplayer_protect')) {
      module_enable(array(
        'jplayer_protect',
      ));
      db_drop_table('jplayer_protect_denied');
      db_rename_table('jplayer_denied', 'jplayer_protect_denied');
    }
    else {
      return t('It appears that the jplayer_protect module has been manually enabled. Please move any data from the {jplayer_protect} table to the {jplayer_protect_denied} table and drop the {jplayer_protect} table.');
    }
  }
  else {
    db_drop_table('jplayer_denied');
  }
  \Drupal::config('jplayer.settings')
    ->clear('jplayer_protected')
    ->save();
}