Download & Extend

Use file_create_url() instead of base_path(), CDN support, Drupal 7 support

Project:Fusion
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Issue tags:CDN, file_create_url, WPO

Issue Summary

In Drupal 7, one should use file_create_url() to create a URL to link to a file. This single function should be used to generate all file URLs, so that all file URLs can be altered to use a CDN instead (or your own static file servers, or whatever you'd like).

However, the CDN module already supports file_create_url() in the form of a Drupal 6 core patch. Just today, somebody created an issue, asking (explaining incorrectly) how to make Fusion themes compatible with the CDN module (i.e. how to make it use file_create_url()). Well then, I thought, why not roll a patch so that any Fusion-based theme automatically does the right thing and would therefore automatically be compatible with CDN integration?

The added advantage is that you just have to delete a couple of lines of code and it will be compatible with Drupal 7 right away!

So, attached is the patch that does just that. It automatically detects whether file_create_url() is available and falls back to the "Old Drupal 7 Way" if it's not available. The patch has not been tested, but the code should be right.

AttachmentSizeStatusTest resultOperations
fusion-file_create_url-cdn-support.patch4.73 KBIdleFAILED: [[SimpleTest]]: [MySQL] Invalid patch format in fusion-file_create_url-cdn-support.patch.View details | Re-test

Comments

#1

I forgot: the issue I'm referring to that requests this functionality is #969576: Here's how to make Fusion based themes css go to the CDN.

#2

Issue tags:+WPO

#3

Rerolled. I don't know what I was thinking. Stupid bug fixed.

AttachmentSizeStatusTest resultOperations
fusion-file_create_url-cdn-support-3.patch4.71 KBIdleFAILED: [[SimpleTest]]: [MySQL] Invalid patch format in fusion-file_create_url-cdn-support-3.patch.View details | Re-test

#4

No feedback whatsoever? I thought Fusion theme development was very active?

#5

Assigned to:Wim Leers» sociotech

Hey Wim, thanks and it is.. we got a new Fusion release just out as you were working on this so we didn't have time to look at it during the that release process, but will try to take a look soon. Obviously this will need some extensive review and testing. Sorry for the lack of response!

#6

Status:needs review» needs work

This is going to need re-roll if #864668: Local and IE Fixes CSS may not be flushed from cache gets in or vice versa.

#3 no longer applies.

#7

Status:needs work» needs review

And updated patch. I tested without CDN and stylesheets work fine. You could wait for a CDN tester but otherwise this looks ready to go.

AttachmentSizeStatusTest resultOperations
Fusion-support-CDN-969824-7.patch4.9 KBIdleFAILED: [[SimpleTest]]: [MySQL] Invalid patch format in Fusion-support-CDN-969824-7.patch.View details | Re-test

#8

Thanks for the reroll! Looks good to go :)

#9

Assigned to:sociotech» aquariumtap

#10

Is this now working in fusion core? Seems all images being served up by the fusion-based theme i'm running aren't being delivered through CDN. Baffled as to whether I need to patch or not.

I'm running Drupal 7.

#11

Status:needs review» needs work

The last submitted patch, Fusion-support-CDN-969824-7.patch, failed testing.

#12

Hasn't been committed AFAICT.

#13

Assigned to:aquariumtap» Anonymous
nobody click here