Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I guess they're the same as file fields, but they're handled by a different module and so need differently named hooks.
Comment | File | Size | Author |
---|---|---|---|
#24 | 1324970-24-uuid.patch | 626 bytes | David_Rothstein |
#16 | pdoException-deploy-1324970.jpg | 46.21 KB | wroxbox |
#15 | 1324970-file-deploy-15.patch | 1.02 KB | aspilicious |
#8 | 1324970.patch | 1.66 KB | John Morahan |
#7 | 1324970.patch | 1.3 KB | John Morahan |
Comments
Comment #1
John Morahan CreditAttribution: John Morahan commentedFixing doc typo and the one I copied it from
Comment #2
John Morahan CreditAttribution: John Morahan commentedAhem.
Comment #3
mlncn CreditAttribution: mlncn commentedRe-rolled.
Comment #4
Paul Kim Consulting CreditAttribution: Paul Kim Consulting commentedThis function appears to be missing in your patches:
Comment #5
John Morahan CreditAttribution: John Morahan commentedHmm, it was in the module already, wasn't it? has it been removed?
Comment #6
John Morahan CreditAttribution: John Morahan commentedIndeed it was.
Comment #7
John Morahan CreditAttribution: John Morahan commentedThere's also the fact that the file data isn't deployed. Here's a couple of patches to make this happen (the first also includes the patch above; the second is for uuid).
Comment #8
John Morahan CreditAttribution: John Morahan commentedhmm. uploaded the wrong patch for deploy. here's the right one.
Comment #9
garethsprice CreditAttribution: garethsprice commentedAwesome, thanks for posting this John! This was the missing piece of the puzzle. I also needed to manually create the target directory on the destination server, for some reason it was not auto-created (although permissions are fine).
Just pasting in the error message I was dealing with to help other people searching for this:
<strong>PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'fid' at row 1</strong>: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => 487cbdbc-a728-bee4-ed64-af003afc930c [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => 3 [:db_insert_placeholder_4] => 1 ) in file_usage_add() (line 664 of /home/gareth/public_html/deploy-catch/includes/file.inc).
Comment #10
dixon_Thanks John for the work on this!
I have a question about
$entity->file_contents
. If we dobase64_encode()
on the file and push it over HTTP, how do you take care of that on the endpoint site? Drupal core doesn't seem to have any way of handling raw base64 encoded content in afile_contents
property like that.It would be fairly simple to solve that using
hook_entity_presave()
or something on the endpoint site...Comment #11
John Morahan CreditAttribution: John Morahan commentedYes, hence the second patch above: https://drupal.org/files/1324970-uuid.patch
which should admittedly have been posted against uuid
Comment #12
aspilicious CreditAttribution: aspilicious commentedOk this works great, I'm tempted to apply
to deploy.
The only problem I see here is another assumption in UUID based on deploy code AND we need to get the uuid patch applied...
But this is the only way to have a nice and clean deploy system that does everything people want.
So this needs more discussion. (but I love it)
Great! Thnx!
Comment #13
dixon_I'm fine with adding what we need in UUID to support this. I will take a look at this shortly.
Comment #14
dixon_I'm quite sceptical about this, when thinking more about it. Doing this on every hook_entity_load() for files could potentially have bad performance implications.
We probably should find another place to do this logic. Maybe
hook_deploy_entity_alter()
is the right place to do this. That hook is invoked just before deployment...Comment #15
aspilicious CreditAttribution: aspilicious commentedProbably a better idea ;). New patch works!
I also used the patch in #7 for UUID.
Comment #16
wroxbox CreditAttribution: wroxbox commentedFirst test:
Applied patches from #7 and #15 and running the deploy from test > live is hitting lives database with error:
Second test:
Updated manually deploy.core.inc from #8 and use patch from #15
Same issue remains. The watchdog says these errors are in uuid_services and node bundle. Hitting two times to database.
The php headers Error says
Warning: Header may not contain more than a single header, new line detected. drupal_send_headers() (line 1255 /srv/bindings/52d84c13e3c54946bf6f04e478982407/code/includes/bootstrap.inc).
So I am not quite sure, if those patches actually tries to fix the error I have :)
Comment #17
aspilicious CreditAttribution: aspilicious commentedSee #9
We probably want to catch an exception with a message like: "File transfer failed, are you sure you created the needed file directories"
Comment #18
Paul Kim Consulting CreditAttribution: Paul Kim Consulting commented@aspilicious Re: Patch in comment #15
So I'm seeing that the latest Deploy (Mar 28th commit) has deprecated hook_deploy_entity_alter() ... am I correct?
Comment #19
aspilicious CreditAttribution: aspilicious commented? Where did you find that? :s
Comment #20
Paul Kim Consulting CreditAttribution: Paul Kim Consulting commentedMaybe i'm wrong :) It just magically appeared again :)
Comment #21
louis_sabet CreditAttribution: louis_sabet commentedI can confirm patches 7 (uuid) and 15 (deploy) worked for me fine.
Comment #22
aspilicious CreditAttribution: aspilicious commentedI'm waiting for someone of the UUID team to get this in. But they are hard to catch ;)
Comment #23
David_Rothstein CreditAttribution: David_Rothstein commentedI tested these patches and they worked for me too, plus the code seems to make sense.
Not sure you really needed another confirmation, but I'm marking it RTBC anyway :)
Comment #24
David_Rothstein CreditAttribution: David_Rothstein commentedI actually ran across a bug with the UUID patch in #7. If the field is configured to store uploaded files in a subdirectory, then the deployment will fail to copy it (unless that subdirectory was already created on the target site first).
The attached patch should fix it. Combining this with the Deploy patch in #15, everything should work OK.
Comment #25
guillaumev CreditAttribution: guillaumev commentedWorking beautifully for me with the two patches mentioned by David_Rothstein
Comment #26
Dean Reilly CreditAttribution: Dean Reilly commentedI can also confirm that the patches are working well.
Comment #27
dixon_Thanks everyone for the work on this, and sorry for keeping you all waiting...
I've committed David's patch from #24 that fixed the subdirectory issue and Bram's patch from #15.
Again, thanks for your patience :)
Comment #29
skalfyfan CreditAttribution: skalfyfan commentedRe: #27 - the latest dev release of uuid (july 17, 2012) does not seem to contain the patch from #24 ?
Comment #30
skalfyfan CreditAttribution: skalfyfan commentedscatch that! nevermind!
Comment #31
kenorb CreditAttribution: kenorb commentedRelated:
#1390708: Fix crash with reference to missing entity
#1694972: File entity values fail on deployment