Closed (fixed)
Project:
D7 Media
Version:
7.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
30 Jan 2013 at 16:15 UTC
Updated:
4 Jan 2014 at 02:58 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
arthurf commentedMy guess is that this is this: #1846518: Document file types are undefined after module update
Comment #2
arrubiu commentedI don't think is the same.
My files are not "undefined", they are "documents", correctly.
The problems is that, before the upgrade, I've added some fields to "application" file types.
Applications now does not exists and these field are not available on "document" file types.
I'v solved adding fields to "documents" file type but this is not a solution, is a workaround.
Comment #3
ParisLiakos commentedYou can go in
field_config_instancetable, find instances with bundle = 'application' and change it to document.i am not sure i understand though where did you add the fields from on the application type?
there was no ui for that?
Comment #4
arrubiu commentedOn Structure -> FIle type I manage files and, for every type, I can manage fields.
With the upgrade the file type "application" is deleted
Comment #5
ParisLiakos commentedThen you used the dev version, somewhere between unstable6 and unstable7..
Did that fix in your database i proposed worked?
Comment #6
arrubiu commentedI was using unstable3 and I've upgraded to unstable7.
I solved simply re-adding fields to the "document" file type, all values were in the database.
Comment #7
dave reidWe can't be causing major data loss like this and requiring manual intervention before an alpha release. We should *not* be changing bundles on any existing file entities either. It's a big no-no with Drupal 7.
Comment #8
dave reidI think we need to still have the 'old' file types exist rather than go away, but be disabled or have no mime type configuration so that they cannot be used to determine *new* files. This should also ensure that anyone upgrading directly from 1.x get the files assigned the newer, "proper" file types.
Comment #9
ParisLiakos commentedBack to media since thats where the update path is
Comment #10
azinck commentedPer Dave's comment in #8: there's no particularly good way to manage this. There's no way we can seamlessly migrate users to the new bundles (way too many possible dependencies that we can never know about) so allowing the old types to continue to exist will be less disruptive in the immediate-term. But there are some significant outstanding problems:
My proposal: allow the old types to continue to exist (rip out the mapping code in media_update_7209) but write some migration code that admins can optionally run. I'm imagining a page that queries file_managed to determine all file types that don't match a current File bundle. It could then give admins the chance to transform that content (and its fields) into one of the existing bundles.
I think that migration could be done with the following steps:
The advantage is that we can give admins some help text indicating exactly what's going to happen, and give them some agency in choosing which types get mapped where.
Comment #11
ParisLiakos commentedComment #12
slashrsm commentedAttached patch re-creates 'application' file type that is disabled by default. It is a start....
Comment #13
slashrsm commentedComment #14
slashrsm commentedHere we go... Added a page and moved types migration there. Page allows site admin to:
- define mapping between old and new file types
- define whether to migrate fields
- define whether to migrate type's mime types
- define whether to delete old file type at the end
Comment #15
ParisLiakos commentedthanks for working on this!
Maybe move this to docblock so sitebuilders are informed for the upgrade location
lets make sure file_entity module is loaded before using file_type_* functions
Comment #16
ParisLiakos commentedTrying to add the damn tag again
Comment #17
slashrsm commentedComment #18
ParisLiakos commentedThanks..just thought we might need to wrap this in a conditional in case there is already an application type?
Comment #19
slashrsm commentedMakes sense...
Comment #20
slashrsm commentednew release blocker
Comment #21
dave reidComment #22
aaron commentedIt currently reads 'Multipurpose type - kepped for to support older sites.'...should be 'kept to support older sites'.
Additionally, when you enable the application type, I noticed that there are no links to adjust the fields or display mode of the type.
Comment #23
slashrsm commentedTypo fixed.
This seem to happen on all disabled file types. After cache clear it works as expected. Do you agree that this belongs to a new issue?
Comment #24
slashrsm commentedFiles....
Comment #26
devin carlson commented#24: media_fix_file_types_upgrade_path_1903224_22.patch queued for re-testing.
Comment #27
aaron commentedgreat!
Comment #28
hyperglide commentedAs this is 1 of 6 remaining 7.x-2.0 alpha blocker.
I was stirring the queue on the RTBC status or is further testing required. If so is there a way to test this if you don't have data per the issue?
Comment #29
aaron commented#24: media_fix_file_types_upgrade_path_1903224_22.patch queued for re-testing.
Comment #30
aaron commented#24: media_fix_file_types_upgrade_path_1903224_22.patch queued for re-testing.
Comment #31
aaron commentedCommitted to http://drupalcode.org/project/media.git/commit/7c45782
Comment #32
slashrsm commentedGreat! Glad to see this in!