Created from #1775842: [meta] Convert all variables to state and/or config systems.

file_default_scheme file.inc
file_description_length file.field.inc
file_description_type file.field.inc
file_icon_directory file.field.inc

Files: 
CommentFileSizeAuthor
#27 file_module_variables_cmi-1804394-27.patch4.12 KBdeviance
PASSED: [[SimpleTest]]: [MySQL] 47,568 pass(es).
[ View ]
#25 file_module_variables_cmi-1804394-25.patch4.42 KBdeviance
PASSED: [[SimpleTest]]: [MySQL] 47,603 pass(es).
[ View ]
#21 file_module_variables_cmi-1804394-21.patch4.14 KBdeviance
PASSED: [[SimpleTest]]: [MySQL] 47,569 pass(es).
[ View ]
#20 file_module_variables_cmi-1804394-20.patch4.14 KBdeviance
PASSED: [[SimpleTest]]: [MySQL] 47,581 pass(es).
[ View ]
#18 file_module_variables_cmi-1804394-17.patch4.14 KBdeviance
PASSED: [[SimpleTest]]: [MySQL] 47,564 pass(es).
[ View ]
#15 file_module_variables_cmi-1804394-15.patch4.13 KBdeviance
FAILED: [[SimpleTest]]: [MySQL] 33,255 pass(es), 161 fail(s), and 28 exception(s).
[ View ]
#11 file_module_variables_cmi-1804394-11.patch3.92 KBdeviance
FAILED: [[SimpleTest]]: [MySQL] 46,158 pass(es), 12 fail(s), and 12 exception(s).
[ View ]
#8 file_module_variables_cmi-1804394-8.patch3.63 KBAlbert Volkman
PASSED: [[SimpleTest]]: [MySQL] 46,398 pass(es).
[ View ]
#8 interdiff.txt3.65 KBAlbert Volkman
#4 file_module_variables_cmi-1804394-4.patch3.58 KBAlbert Volkman
PASSED: [[SimpleTest]]: [MySQL] 46,314 pass(es).
[ View ]

Comments

Assigned:Unassigned» sime

Here goes!

Title:convert file variables to config/state systemconvert file.module variables to CMI

Moved file_default_schema to [1799504]

Assigned:sime» Unassigned

Unassigning, as I got caught up on the #1799504: Convert system file related variables to CMI.

Status:Active» Needs review
StatusFileSize
new3.58 KB
PASSED: [[SimpleTest]]: [MySQL] 46,314 pass(es).
[ View ]

First pass at this.

Status:Needs review» Needs work
Issue tags:-Configuration system, -melb-code-sprint-2012-10

The last submitted patch, file_module_variables_cmi-1804394-4.patch, failed testing.

Status:Needs work» Needs review
Issue tags:+Configuration system, +melb-code-sprint-2012-10

Status:Needs review» Needs work

+++ b/core/modules/file/config/file.settings.ymlundefined
@@ -0,0 +1,2 @@
+description_length: 128
+description_type: 'textfield'
diff --git a/core/modules/file/file.field.inc b/core/modules/file/file.field.inc
diff --git a/core/modules/file/file.field.inc b/core/modules/file/file.field.inc
index 28a32a9..a8c8e28 100644

We should move length and type under description.

description:
- type
- length

icon directory needs to be in here too. And that one probably needs the same structure as above.

Status:Needs work» Needs review
StatusFileSize
new3.65 KB
new3.63 KB
PASSED: [[SimpleTest]]: [MySQL] 46,398 pass(es).
[ View ]

How's this?

Status:Needs review» Needs work

I think you forgot to add the update function?

Assigned:Unassigned» deviance

Status:Needs work» Needs review
StatusFileSize
new3.92 KB
FAILED: [[SimpleTest]]: [MySQL] 46,158 pass(es), 12 fail(s), and 12 exception(s).
[ View ]

Added hook_update_N

Status:Needs review» Needs work

The last submitted patch, file_module_variables_cmi-1804394-11.patch, failed testing.

Assigned:deviance» Unassigned

Assigned:Unassigned» deviance

StatusFileSize
new4.13 KB
FAILED: [[SimpleTest]]: [MySQL] 33,255 pass(es), 161 fail(s), and 28 exception(s).
[ View ]

added config-file

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, file_module_variables_cmi-1804394-15.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new4.14 KB
PASSED: [[SimpleTest]]: [MySQL] 47,564 pass(es).
[ View ]

Fixed spelling and indentation errors in yml file

Status:Needs review» Needs work

+++ b/core/modules/file/file.moduleundefined
@@ -1325,7 +1327,7 @@ function file_icon_url(File $file, $icon_directory = NULL) {
+    $icon_directory =drupal_get_path('module', 'file').'/'.config('file.settings')->get('icon.directory');

"=drupal" needs an extra space. Same for "e').'/'"

Status:Needs work» Needs review
StatusFileSize
new4.14 KB
PASSED: [[SimpleTest]]: [MySQL] 47,581 pass(es).
[ View ]

added spaces:
changed
$icon_directory =drupal_get_path('module', 'file').'/'.config('file.settings')->get('icon.directory');
to
$icon_directory = drupal_get_path('module', 'file') .'/'. config('file.settings')->get('icon.directory');

StatusFileSize
new4.14 KB
PASSED: [[SimpleTest]]: [MySQL] 47,569 pass(es).
[ View ]

added even more spaces :-/
$icon_directory = drupal_get_path('module', 'file') .'/'. config('file.settings')->get('icon.directory');
is now:
$icon_directory = drupal_get_path('module', 'file') . '/' . config('file.settings')->get('icon.directory');

RTBC for me.

Status:Needs review» Reviewed & tested by the community

Oops...

Status:Reviewed & tested by the community» Needs work

I missed this in my previous review.

+++ b/core/modules/file/file.moduleundefined
@@ -1325,7 +1327,7 @@ function file_icon_url(File $file, $icon_directory = NULL) {
-    $icon_directory = variable_get('file_icon_directory', drupal_get_path('module', 'file') . '/icons');
+    $icon_directory = drupal_get_path('module', 'file') . '/' . config('file.settings')->get('icon.directory');
   }

Now we have to hack core if we want a different icon directory that is NOT located in the file module. The correct solution is to hardcode the path in the yml file. Something like "core/modules/file/icons".

Status:Needs work» Needs review
StatusFileSize
new4.42 KB
PASSED: [[SimpleTest]]: [MySQL] 47,603 pass(es).
[ View ]

thanx! I wasnt sure which is the better practice but your comment makes complete and utter sense!
Here is the patch with the new path

Status:Needs review» Needs work

+++ b/core/modules/file/config/file.settings.ymlundefined
@@ -0,0 +1,6 @@
diff --git a/core/modules/file/config/file.settings.yml~ b/core/modules/file/config/file.settings.yml~
diff --git a/core/modules/file/config/file.settings.yml~ b/core/modules/file/config/file.settings.yml~
new file mode 100644
index 0000000..6372c80
index 0000000..6372c80
--- /dev/null
--- /dev/null
+++ b/core/modules/file/config/file.settings.yml~undefined
+++ b/core/modules/file/config/file.settings.yml~undefined
+++ b/core/modules/file/config/file.settings.yml~undefined
@@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
+description:
+  type: 'textfield'
+  length: 128
+icon:
+  directory: 'icons'

You added the core/modules/file/config/file.settings.yml~ file by accident.
Otherwise, looks fine to me.

Status:Needs work» Needs review
StatusFileSize
new4.12 KB
PASSED: [[SimpleTest]]: [MySQL] 47,568 pass(es).
[ View ]

Oops, sorry. Thought I had removed it, but it snug back in. Now, its clean.

Status:Needs review» Reviewed & tested by the community

While we're looking at this, does anyone know what these two variables actually exist for?

     $element['description'] = array(
-      '#type' => variable_get('file_description_type', 'textfield'),
+      '#type' => $config->get('description.type'),
       '#title' => t('Description'),
       '#value' => isset($item['description']) ? $item['description'] : '',
-      '#maxlength' => variable_get('file_description_length', 128),
+      '#maxlength' => $config->get('description.length'),

This isn't related to converting them to CMI, but I'm not sure why they exist at all.

Status:Reviewed & tested by the community» Fixed

Posted a new issue to ask about the variables. Committed/pushed the patch here to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.

Issue summary:View changes

Moved to 1799504