-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #2854212: Add update for Drupal 7 to Backdrop upgrades.
Did not work with a test site. Needs work.
- Loading branch information
Showing
1 changed file
with
32 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,39 @@ | ||
<?php | ||
/** | ||
* Implementation of hook_install(). | ||
* @file | ||
* Install, update and uninstall functions for the Audiofield module. | ||
*/ | ||
|
||
/** | ||
* Implementation of hook_uninstall(). | ||
* @defgroup updates-7.x-to-1.x Updates from 7.x to 1.x | ||
* @{ | ||
* Update functions from Drupal 7.x to Backdrop CMS 1.x. | ||
*/ | ||
function audiofield_uninstall() { | ||
db_delete('variable') | ||
->condition('name', 'audiofield_%%', 'LIKE') | ||
->execute(); | ||
|
||
/** | ||
* Move settings from variables to config. | ||
*/ | ||
function audiofield_update_1000() { | ||
// These are hardcoded here. But if another module added more types, this | ||
// should be more dynamic, using a loop. | ||
// @see audiofield_admin_settings_form() | ||
|
||
// Migrate variables to config. | ||
$config = config('audiofield.settings'); | ||
$config->set('audioplayer', update_variable_get('audiofield_audioplayer', 'html5')); | ||
$config->set('audioplayer_wav', update_variable_get('audiofield_audioplayer_wav', 'html5')); | ||
$config->set('audioplayer_ogg', update_variable_get('audiofield_audioplayer_ogg', 'html5')); | ||
$config->set('players_dir', update_variable_get('audiofield_players_dir', 'sites/all/libraries/player')); | ||
$config->save(); | ||
|
||
// Delete variables. | ||
update_variable_del('audiofield_audioplayer'); | ||
update_variable_del('audiofield_audioplayer_wav'); | ||
update_variable_del('audiofield_audioplayer_ogg'); | ||
update_variable_del('audiofield_players_dir'); | ||
} | ||
|
||
/** | ||
* @} End of "defgroup updates-7.x-to-1.x" | ||
* The next series of updates should start at 2000. | ||
*/ |