From fe7e01c60d9d0c540112fa2ffe4265240e2fe0cb Mon Sep 17 00:00:00 2001 From: Angie Byron <webchick@24967.no-reply.drupal.org> Date: Sun, 21 Nov 2010 20:35:10 +0000 Subject: [PATCH] #931736 by dww: Fixed No upgrade path for the D6 'file_directory_temp' setting. --- .../tests/upgrade/drupal-6.filled.database.php | 10 +++++++++- modules/simpletest/tests/upgrade/upgrade.upload.test | 9 +++++++++ modules/system/system.install | 11 ++++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/modules/simpletest/tests/upgrade/drupal-6.filled.database.php b/modules/simpletest/tests/upgrade/drupal-6.filled.database.php index 9f33ee0a7cde..25092e70f13b 100644 --- a/modules/simpletest/tests/upgrade/drupal-6.filled.database.php +++ b/modules/simpletest/tests/upgrade/drupal-6.filled.database.php @@ -19735,7 +19735,15 @@ )) ->values(array( 'name' => 'file_directory_temp', - 'value' => 's:26:"/Applications/MAMP/tmp/php";', + 'value' => 's:29:"/drupal-6/file/directory/temp";', +)) +->values(array( + 'name' => 'file_directory_path', + 'value' => 's:29:"/drupal-6/file/directory/path";', +)) +->values(array( + 'name' => 'file_downloads', + 'value' => 'i:2;', )) ->values(array( 'name' => 'filter_html_1', diff --git a/modules/simpletest/tests/upgrade/upgrade.upload.test b/modules/simpletest/tests/upgrade/upgrade.upload.test index 761d6558de87..a0402a38e4cd 100644 --- a/modules/simpletest/tests/upgrade/upgrade.upload.test +++ b/modules/simpletest/tests/upgrade/upgrade.upload.test @@ -65,5 +65,14 @@ class UploadUpgradePathTestCase extends UpgradePathTestCase { } $this->assertIdentical($filenames, $recorded_filenames, 'The uploaded files are present in the same order after the upgrade.'); } + // Make sure the file settings were properly migrated. + $d6_file_directory_temp = '/drupal-6/file/directory/temp'; + $d6_file_directory_path = '/drupal-6/file/directory/path'; + $d6_file_downloads = 2; // FILE_DOWNLOADS_PRIVATE + + $this->assertNull(variable_get('file_directory_temp', NULL), "The 'file_directory_temp' variable was properly removed."); + $this->assertEqual(variable_get('file_temporary_path', 'drupal-7-bogus'), $d6_file_directory_temp, "The 'file_temporary_path' setting was properly migrated."); + $this->assertEqual(variable_get('file_default_scheme', 'drupal-7-bogus'), 'private', "The 'file_default_scheme' setting was properly migrated."); + $this->assertEqual(variable_get('file_private_path', 'drupal-7-bogus'), $d6_file_directory_path, "The 'file_private_path' setting was properly migrated."); } } diff --git a/modules/system/system.install b/modules/system/system.install index ad76e11be315..5e0d5b8d25a8 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -2157,7 +2157,7 @@ function system_update_7033() { } /** - * Migrate the file_downloads setting and create the new {file_managed} table. + * Migrate the file path settings and create the new {file_managed} table. */ function system_update_7034() { $files_directory = variable_get('file_directory_path', NULL); @@ -2917,6 +2917,15 @@ function system_update_7065() { db_delete('sessions')->condition('sid', '')->execute(); } +/** + * Migrate the 'file_directory_temp' variable. + */ +function system_update_7066() { + $d6_file_directory_temp = variable_get('file_directory_temp', file_directory_temp()); + variable_set('file_temporary_path', $d6_file_directory_temp); + variable_del('file_directory_temp'); +} + /** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. -- GitLab