You are here

backup_migrate_dropbox.install in Backup and Migrate Dropbox 7.3

Contains install and update functions for backup migrate dropbox.

File

backup_migrate_dropbox.install
View source
<?php

/**
 * @file
 * Contains install and update functions for backup migrate dropbox.
 */

/**
 * Implements hook_uninstall().
 */
function backup_migrate_dropbox_install() {
  variable_set('backup_migrate_dropbox_app_key', '2b87l40hen5fp6x');
  variable_set('backup_migrate_dropbox_app_folder', 'DrupalBackup');
  variable_set('backup_migrate_dropbox_bearer_tokens', '{}');
}

/**
 * Implements hook_uninstall().
 */
function backup_migrate_dropbox_uninstall() {
  backup_migrate_dropbox_variable_del_multiple('backup_migrate_dropbox_');
}

/**
 * Support for the new Dropbox OAuth2 with PKCE flow.
 */
function backup_migrate_dropbox_update_7300() {
  variable_set('backup_migrate_dropbox_app_key', '2b87l40hen5fp6x');
  variable_set('backup_migrate_dropbox_app_folder', 'DrupalBackup');
  variable_set('backup_migrate_dropbox_bearer_tokens', '{}');

  /** @noinspection HtmlUnknownTarget */
  drupal_set_message(t('Mid 2021, <a href="https://dropbox.tech/developers/migrating-app-permissions-and-access-tokens#retiring-legacy-tokens">Dropbox will retire legacy tokens</a>.') . ' ' . t('The authorization part of the Backup and Migrate Dropbox module has been rewritten to use the Oauth2 method of authorizing.') . ' ' . t('You must edit all Dropbox destinations to authorize the Drupal Backup and Migrate Dropbox App to access your Dropbox account.') . ' ' . t('Please visit the !destinations_page now.', [
    '!destinations_page' => l('destinations page', 'admin/config/system/backup_migrate/settings/destination'),
  ]), 'warning');
}

/**
 * Utility function that is an altered version of variable_del, it will delete
 * a set of variables set by a module (based on prefix)
 *
 * @param string $name
 *   The variables namespace (prefix) to delete.
 */
function backup_migrate_dropbox_variable_del_multiple($name) {
  db_delete('variable')
    ->condition('name', addcslashes($name, '%_') . '%', 'LIKE')
    ->execute();
  cache_clear_all('variables', 'cache');
}

Functions

Namesort descending Description
backup_migrate_dropbox_install Implements hook_uninstall().
backup_migrate_dropbox_uninstall Implements hook_uninstall().
backup_migrate_dropbox_update_7300 Support for the new Dropbox OAuth2 with PKCE flow.
backup_migrate_dropbox_variable_del_multiple Utility function that is an altered version of variable_del, it will delete a set of variables set by a module (based on prefix)