123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896 |
- <?php
- function backup_migrate_requirements($phase) {
- $requirements = array();
-
- $t = get_t();
- if ($phase == 'runtime') {
-
-
-
- backup_migrate_include('destinations');
- foreach (backup_migrate_get_destinations() as $dest_name => $destination) {
- if (method_exists($destination, 'get_display_location')) {
- $dest_path = $destination->get_display_location();
- if (!empty($dest_path) && file_valid_uri($dest_path)) {
- $scheme = file_uri_scheme($dest_path);
-
- if ($scheme === 'private' || $scheme === 'public' || substr($dest_path, 0, 1) == '/') {
-
- $path_exists = file_prepare_directory($dest_path, FILE_CREATE_DIRECTORY);
- if ($path_exists) {
- $real_path = drupal_realpath($dest_path);
-
-
- if (strpos($real_path, DRUPAL_ROOT) === 0) {
-
-
-
- $url = substr($real_path, strlen(DRUPAL_ROOT) + 1);
- $url = url($url, array('absolute' => TRUE));
- $result = drupal_http_request($url);
-
-
-
- if (!empty($result->code) && $result->code == 200) {
-
- $dest_spec = $destination->get_list_row();
-
- $requirements['bmdest_' . $dest_name] = array(
- 'severity' => REQUIREMENT_ERROR,
- 'title' => 'Backup Migrate',
- 'value' => $t('Backup destination "%dest" is publicly accessible!', array('%dest' => $dest_spec['name'])),
- 'description' => $t('The backup destination, "%dest", stores its files in the "%path" directory. This directory is publicly available from the web server and urgently needs to be secured! Please see the Drupal manual on <a href="@manual">configuring the private directory path</a> on how to fix this problem.',
- array(
- '%dest' => $dest_spec['name'],
- '%path' => $real_path,
- '@manual' => 'https://www.drupal.org/docs/7/core/modules/file/overview',
- )),
- );
- }
-
- else {
- $files = scandir($real_path);
- if (!empty($files)) {
- foreach ($files as $file) {
-
- if ($file == '.' || $file == '..') {
- continue;
- }
- $result = drupal_http_request($url . '/' . $file);
-
-
- if (!empty($result->code) && $result->code == 200) {
-
-
- $dest_spec = $destination->get_list_row();
-
- $requirements['bmdest_' . $dest_name] = array(
- 'severity' => REQUIREMENT_ERROR,
- 'title' => 'Backup Migrate',
- 'value' => $t('Files in "%dest" are publicly accessible!', array('%dest' => $dest_spec['name'])),
- 'description' => $t('The backup destination, "%dest", stores its files in the "%path" directory. These file(s) are publicly available from the web server and urgently need to be secured! Please see the Drupal manual on <a href="@manual">configuring the private directory path</a> on how to fix this problem.',
- array(
- '%dest' => $dest_spec['name'],
- '%path' => $real_path,
- '@manual' => 'https://www.drupal.org/docs/7/core/modules/file/overview',
- )),
- );
- }
-
- break;
- }
- }
- }
- }
- }
- }
- }
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
- if (variable_get('backup_migrate_disable_cron', FALSE)) {
- $requirements['bm_disable_cron'] = array(
- 'severity' => REQUIREMENT_INFO,
- 'title' => 'Backup Migrate',
- 'value' => $t('Cron tasks are disabled'),
- 'description' => $t('The cron tasks have been disabled, so scheduled backups will not run. See the Backup & Migrate module\'s README.txt file for further details.'),
- );
- }
- }
- return $requirements;
- }
- function backup_migrate_schema() {
- $schema['backup_migrate_profiles'] = array(
- 'export' => array(
- 'key' => 'machine_name',
- 'key name' => 'Profile ID',
- 'admin_title' => 'name',
- 'primary key' => 'profile_id',
-
- 'identifier' => 'item',
-
- 'default hook' => 'exportables_backup_migrate_profiles',
- 'api' => array(
- 'owner' => 'backup_migrate',
-
- 'api' => 'backup_migrate_exportables',
- 'minimum_version' => 1,
- 'current_version' => 1,
- ),
- ),
- 'fields' => array(
- 'profile_id' => array(
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
-
- 'no export' => TRUE,
- ),
- 'machine_name' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '0',
- 'description' => 'The primary identifier for a profile.',
- ),
- 'name' => array(
- 'description' => 'The name of the profile.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- ),
- 'filename' => array(
- 'description' => 'The name of the profile.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- ),
- 'append_timestamp' => array(
- 'description' => 'Append a timestamp to the filename.',
- 'type' => 'int',
- 'size' => 'tiny',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'timestamp_format' => array(
- 'description' => 'The format of the timestamp.',
- 'type' => 'varchar',
- 'length' => 14,
- 'not null' => TRUE,
- ),
- 'filters' => array(
- 'description' => 'The filter settings for the profile.',
- 'type' => 'text',
- 'not null' => TRUE,
- 'serialize' => TRUE,
- 'serialized default' => 'a:0:{}',
- ),
- ),
- 'primary key' => array('profile_id'),
- );
- $schema['backup_migrate_destinations'] = array(
- 'export' => array(
- 'key' => 'machine_name',
- 'key name' => 'Destination ID',
- 'admin_title' => 'name',
- 'primary key' => 'destination_id',
-
- 'identifier' => 'item',
-
- 'default hook' => 'exportables_backup_migrate_destinations',
- 'api' => array(
- 'owner' => 'backup_migrate',
-
- 'api' => 'backup_migrate_exportables',
- 'minimum_version' => 1,
- 'current_version' => 1,
- ),
- ),
- 'fields' => array(
- 'destination_id' => array(
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
-
- 'no export' => TRUE,
- ),
- 'machine_name' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '0',
- 'description' => 'The primary identifier for a destination.',
- ),
- 'name' => array(
- 'description' => 'The name of the destination.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- ),
- 'subtype' => array(
- 'description' => 'The type of the destination.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- ),
- 'location' => array(
- 'description' => 'The the location string of the destination.',
- 'type' => 'text',
- 'not null' => TRUE,
- ),
- 'settings' => array(
- 'description' => 'Other settings for the destination.',
- 'type' => 'text',
- 'not null' => TRUE,
- 'serialize' => TRUE,
- 'serialized default' => 'a:0:{}',
- ),
- ),
- 'primary key' => array('destination_id'),
- );
- $schema['backup_migrate_sources'] = array(
- 'export' => array(
- 'key' => 'machine_name',
- 'key name' => 'Source ID',
- 'admin_title' => 'name',
- 'primary key' => 'source_id',
-
- 'identifier' => 'item',
-
- 'default hook' => 'exportables_backup_migrate_sources',
- 'api' => array(
- 'owner' => 'backup_migrate',
-
- 'api' => 'backup_migrate_exportables',
- 'minimum_version' => 1,
- 'current_version' => 1,
- ),
- ),
- 'fields' => array(
- 'source_id' => array(
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
-
- 'no export' => TRUE,
- ),
- 'machine_name' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '0',
- 'description' => 'The primary identifier for a source.',
- ),
- 'name' => array(
- 'description' => 'The name of the source.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- ),
- 'subtype' => array(
- 'description' => 'The type of the source.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- ),
- 'location' => array(
- 'description' => 'The the location string of the source.',
- 'type' => 'text',
- 'not null' => TRUE,
- ),
- 'settings' => array(
- 'description' => 'Other settings for the source.',
- 'type' => 'text',
- 'not null' => TRUE,
- 'serialize' => TRUE,
- 'serialized default' => 'a:0:{}',
- ),
- ),
- 'primary key' => array('source_id'),
- );
- $schema['backup_migrate_schedules'] = array(
- 'export' => array(
- 'key' => 'machine_name',
- 'key name' => 'Source ID',
- 'admin_title' => 'name',
- 'primary key' => 'schedule_id',
-
- 'identifier' => 'item',
-
- 'default hook' => 'exportables_backup_migrate_schedules',
- 'api' => array(
- 'owner' => 'backup_migrate',
-
- 'api' => 'backup_migrate_exportables',
- 'minimum_version' => 1,
- 'current_version' => 1,
- ),
- ),
- 'fields' => array(
- 'schedule_id' => array(
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
-
- 'no export' => TRUE,
- ),
- 'machine_name' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '0',
- 'description' => 'The primary identifier for a profile.',
- ),
- 'name' => array(
- 'description' => 'The name of the profile.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- ),
- 'source_id' => array(
- 'description' => 'The {backup_migrate_destination}.destination_id of the source to backup from.',
- 'type' => 'varchar',
- 'length' => 255,
- 'default' => 'db',
- 'not null' => TRUE,
- ),
- 'destination_id' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '0',
- 'description' => 'The {backup_migrate_destination}.destination_id of the destination to back up to.',
- ),
- 'copy_destination_id' => array(
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '0',
- 'description' => 'A second {backup_migrate_destination}.destination_id of the destination to copy the backup to.',
- ),
- 'profile_id' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '0',
- 'description' => 'The primary identifier for a profile.',
- ),
- 'keep' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'The number of backups to keep.',
- ),
- 'period' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'The number of seconds between backups.',
- ),
- 'enabled' => array(
- 'description' => 'Whether the schedule is enabled.',
- 'type' => 'int',
- 'size' => 'tiny',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'cron' => array(
- 'description' => 'Whether the schedule should be run during cron.',
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => 'builtin',
- ),
- 'cron_schedule' => array(
- 'description' => 'The cron schedule to run on.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '0 4 * * *',
- ),
- ),
- 'primary key' => array('schedule_id'),
- );
- return $schema;
- }
- function backup_migrate_uninstall() {
- variable_del('backup_migrate_backup_max_time');
- variable_del('backup_migrate_copy_destination_id');
- variable_del('backup_migrate_data_bytes_per_line');
- variable_del('backup_migrate_data_rows_per_line');
- variable_del('backup_migrate_data_rows_per_query');
- variable_del('backup_migrate_destination_id');
- variable_del('backup_migrate_disable_cron');
- variable_del('backup_migrate_memory_limit');
- variable_del('backup_migrate_profile_id');
- variable_del('backup_migrate_schedule_last_run_');
- variable_del('backup_migrate_source_id');
- variable_del('backup_migrate_timeout_buffer');
- variable_del('backup_migrate_verbose');
- variable_del('nodesquirrel_endpoint_urls');
- variable_del('nodesquirrel_schedule');
- variable_del('nodesquirrel_schedule_enabled');
- variable_del('nodesquirrel_schedule_source_id');
- variable_del('nodesquirrel_secret_key');
- }
- function backup_migrate_update_2000() {
- _backup_migrate_setup_database_defaults();
- return array();
- }
- function backup_migrate_update_2001() {
- $ret = array();
- $schema = drupal_get_schema_unprocessed('backup_migrate', 'backup_migrate_profiles');
-
- if (!db_field_exists('backup_migrate_profiles', 'filters')) {
- db_add_field('backup_migrate_profiles', 'filters', array(
- 'description' => t('The filter settings for the profile.'),
- 'type' => 'text',
- 'not null' => TRUE,
- ));
- }
-
- if (!db_field_exists('backup_migrate_profiles', 'source_id')) {
- db_add_field('backup_migrate_profiles', 'source_id', array(
- 'description' => t('The {backup_migrate_destination}.destination_id of the source to backup from.'),
- 'type' => 'varchar',
- 'length' => 255,
- 'default' => 'db',
- 'not null' => TRUE,
- ));
- }
-
- if (db_field_exists('backup_migrate_profiles', 'compression')) {
- db_drop_field('backup_migrate_profiles', 'compression');
- }
- return $ret;
- }
- function backup_migrate_update_2002() {
-
- return array();
- }
- function backup_migrate_update_2003() {
- $ret = array();
- $spec = array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '0',
- 'description' => 'The primary identifier for a profile.',
- );
- db_change_field('backup_migrate_schedules', 'profile_id', 'profile_id', $spec);
- return $ret;
- }
- function backup_migrate_update_2004() {
- $ret = array();
- $spec = array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '0',
- );
- $spec['description'] = 'The primary identifier for a destination.';
- db_change_field('backup_migrate_destinations', 'destination_id', 'destination_id', $spec);
- $spec['description'] = 'The primary identifier for a profile.';
- db_change_field('backup_migrate_profiles', 'profile_id', 'profile_id', $spec);
- $spec['description'] = 'The primary identifier for a schedule.';
- db_change_field('backup_migrate_schedules', 'schedule_id', 'schedule_id', $spec);
-
- if (db_field_exists('backup_migrate_destinations', 'username')) {
- db_drop_field('backup_migrate_destinations', 'username');
- }
- if (db_field_exists('backup_migrate_destinations', 'password')) {
- db_drop_field('backup_migrate_destinations', 'password');
- }
- return $ret;
- }
- function backup_migrate_update_2005() {
- require_once './' . drupal_get_path('module', 'backup_migrate') . '/includes/crud.inc';
- require_once './' . drupal_get_path('module', 'backup_migrate') . '/includes/profiles.inc';
- $ret = array();
-
-
-
- $ret[] = db_query("UPDATE {backup_migrate_profiles} SET source_id = 'db' WHERE source_id = 'db_url:default'");
- $ret[] = db_query("UPDATE {backup_migrate_schedules} SET destination_id = 'db' WHERE destination_id = 'db_url:default'");
-
- $ret[] = db_query("UPDATE {backup_migrate_profiles} SET source_id = REPLACE(source_id, 'db_url:', 'db:')");
- $ret[] = db_query("UPDATE {backup_migrate_schedules} SET destination_id = REPLACE(destination_id, 'db_url:', 'db:')");
-
- if (!db_field_exists('backup_migrate_schedules', 'source_id')) {
- db_add_field('backup_migrate_schedules', 'source_id', array(
- 'description' => t('The db source to backup from.'),
- 'type' => 'varchar',
- 'length' => 255,
- 'default' => 'db',
- 'not null' => TRUE,
- ));
- }
-
- $result = db_query('SELECT p.source_id, s.schedule_id FROM {backup_migrate_schedules} s LEFT JOIN {backup_migrate_profiles} p ON s.profile_id = p.profile_id', array(), array('fetch' => PDO::FETCH_ASSOC));
- foreach ($result as $schedule) {
- if (!$schedule['source_id']) {
- $schedule['source_id'] = 'db';
- }
- $ret[] = db_query("UPDATE {backup_migrate_schedules} SET source_id = '" . $schedule['source_id'] . "' WHERE schedule_id = '" . $schedule['profile_id'] . "'");
- }
- if (db_field_exists('backup_migrate_profiles', 'source_id')) {
- db_drop_field('backup_migrate_profiles', 'source_id');
- }
-
- $result = db_query('SELECT * FROM {backup_migrate_profiles}', array(), array('fetch' => PDO::FETCH_ASSOC));
- foreach ($result as $item) {
- if (isset($item['nodata_tables']) && isset($item['exclude_tables'])) {
- $profile = backup_migrate_get_profile($item['profile_id']);
- $profile->filters['nodata_tables'] = unserialize($item['nodata_tables']);
- $profile->filters['exclude_tables'] = unserialize($item['exclude_tables']);
- $profile->save();
- }
- }
- if (db_field_exists('backup_migrate_profiles', 'nodata_tables')) {
- db_drop_field('backup_migrate_profiles', 'nodata_tables');
- }
- if (db_field_exists('backup_migrate_profiles', 'exclude_tables')) {
- db_drop_field('backup_migrate_profiles', 'exclude_tables');
- }
- return $ret;
- }
- function backup_migrate_update_7200() {
- $from = 'public://backup_migrate';
- $to = 'private://backup_migrate';
- if (drupal_realpath($from) && !drupal_realpath($to)) {
- if (!rename($from, $to)) {
- drupal_set_message(t('Unable to move the backups directory to your private folder, please check file permissions and move the directory %from to %to', array('%from' => drupal_realpath($from), '%to' => drupal_realpath($to))), 'warning');
- }
- }
- }
- function backup_migrate_update_7202() {
- $ret = array();
- db_change_field('backup_migrate_profiles', 'filename', 'filename', array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- ));
- return $ret;
- }
- function backup_migrate_update_7203() {
- $result = db_query('SELECT * FROM {backup_migrate_schedules}', array(), array('fetch' => PDO::FETCH_ASSOC));
- foreach ($result as $item) {
- if (isset($item['last_run'])) {
- variable_set('backup_migrate_schedule_last_run_' . $item['schedule_id'], $item['last_run']);
- }
- }
- if (db_field_exists('backup_migrate_schedules', 'last_run')) {
- db_drop_field('backup_migrate_schedules', 'last_run');
- }
- }
- function backup_migrate_update_7300() {
- if (module_exists('backup_migrate_files')) {
- module_disable(array('backup_migrate_files'));
- $ret[] = array(
- 'success' => TRUE,
- 'query' => 'Disabled the Backup and Migrate Files module',
- );
- }
- if (module_exists('nodesquirrel')) {
- module_disable(array('nodesquirrel'));
- $ret[] = array(
- 'success' => TRUE,
- 'query' => 'Disabled the NodeSquirrel module',
- );
- }
-
- $schema['backup_migrate_sources'] = array(
- 'fields' => array(
- 'source_id' => array(
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '0',
- 'description' => t('The primary identifier for a source.'),
- ),
- 'name' => array(
- 'description' => t('The name of the source.'),
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- ),
- 'type' => array(
- 'description' => t('The type of the source.'),
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- ),
- 'location' => array(
- 'description' => t('The the location string of the source.'),
- 'type' => 'text',
- 'not null' => TRUE,
- ),
- 'settings' => array(
- 'description' => t('Other settings for the source.'),
- 'type' => 'text',
- 'not null' => TRUE,
- 'serialize' => TRUE,
- 'serialized default' => 'a:0:{}',
- ),
- ),
- 'primary key' => array('source_id'),
- );
- if (!db_table_exists('backup_migrate_sources')) {
- db_create_table('backup_migrate_sources', $schema['backup_migrate_sources']);
- }
-
- $result = db_query("SELECT * FROM {backup_migrate_destinations} WHERE type in ('filesource', 'db')", array(), array('fetch' => PDO::FETCH_ASSOC));
- foreach ($result as $item) {
- $item['source_id'] = $item['destination_id'];
- drupal_write_record('backup_migrate_source', $item);
- }
-
- $result = db_query('SELECT * FROM {backup_migrate_profiles}', array(), array('fetch' => PDO::FETCH_ASSOC));
- foreach ($result as $item) {
- $item['filters'] = unserialize($item['filters']);
- $item['filters']['sources'] = $item['filters']['destinations'];
- unset($item['filters']['destinations']);
- drupal_write_record('backup_migrate_profiles', $item, array('profile_id'));
- }
- }
- function backup_migrate_update_7301() {
- db_change_field('backup_migrate_schedules', 'cron', 'cron', array(
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => 'builtin',
- ));
- db_add_field('backup_migrate_schedules', 'cron_schedule', array(
- 'description' => 'The cron schedule to run on.',
- 'type' => 'varchar',
- 'length' => 255,
- 'default' => '0 4 * * *',
- 'not null' => TRUE,
- ));
- }
- function backup_migrate_update_7302() {
- db_add_field('backup_migrate_schedules', 'copy_destination_id',
- array(
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '0',
- 'description' => 'A second {backup_migrate_destination}.destination_id of the destination to copy the backup to.',
- )
- );
- }
- function backup_migrate_update_7303() {
- foreach (array(
- 'backup_migrate_sources' => 'source_id',
- 'backup_migrate_destinations' => 'destination_id',
- 'backup_migrate_schedules' => 'schedule_id',
- 'backup_migrate_profiles' => 'profile_id',
- ) as $table => $id) {
-
-
-
- db_add_index($table, 'temp', array($id));
- db_drop_primary_key($table);
-
- db_drop_index($table, 'temp');
-
- db_change_field($table, $id, 'machine_name', array(
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- ));
-
- db_add_field($table, $id,
- array(
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
-
- 'no export' => TRUE,
- ),
- array('primary key' => array($id))
- );
- }
- foreach (array('backup_migrate_sources', 'backup_migrate_destinations') as $table) {
- db_change_field($table, 'type', 'subtype', array(
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- ));
- }
- }
- function backup_migrate_update_7304() {
- db_query("UPDATE {backup_migrate_schedules} SET cron = 'builtin' WHERE cron = '0'");
- }
- function backup_migrate_update_7305() {
-
- $field_spec = array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '0',
- );
- foreach (array(
- 'backup_migrate_profiles',
- 'backup_migrate_destinations',
- 'backup_migrate_sources',
- 'backup_migrate_schedules',
- ) as $table) {
- if (!db_field_exists($table, $machine_name)) {
- try {
- db_add_field($table, 'machine_name', $field_spec);
- }
- catch (\Exception $e) {
- db_change_field($table, 'machine_name', 'machine_name', $field_spec);
- }
- }
- else {
- db_change_field($table, 'machine_name', 'machine_name', $field_spec);
- }
- }
-
- $field_spec = array(
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => 'builtin',
- );
- if (!db_field_exists('backup_migrate_schedules', 'cron')) {
- try {
- db_add_field('backup_migrate_schedules', 'cron', $field_spec);
- }
- catch (\Exception $e) {
- db_change_field('backup_migrate_schedules', 'cron', 'cron', $field_spec);
- }
- }
- else {
- db_change_field('backup_migrate_schedules', 'cron', 'cron', $field_spec);
- }
- }
- function backup_migrate_update_7306() {
- drupal_set_message(t('Please note that release 7.x-3.4 had a bug which caused all backups to be overwritten instead of having a timestamp added. Please review all backup settings to ensure they work as intended.'), 'warning');
- }
- function backup_migrate_update_7307() {
- $limit = variable_get('backup_migrate_backup_memory_limit');
- if (!empty($limit)) {
- variable_set('backup_migrate_memory_limit', $limit);
- variable_del('backup_migrate_backup_memory_limit');
- }
- }
|