Per the procedure followed at http://drupal.org/node/1011698 .
-
The Acquia Purge module fills the gap for customers running on Acquia hosting products such as Acquia Cloud and Acquia Cloud Enterprise that are in need of an effective proactive purging solution for their site. This module offers a turn-key experience in the sense that it automatically purges your content upon content updates and creation without any necessary technical configuration. The Acquia Purge module works atop of the expire project.
At this point of writing this module is the advised path for Acquia customers that need purging but will raise a dependency on the purge project in the future per agreement with Purge's maintainer SqyD. This module is in no way a competitor or duplicated effort but a short-term standalone project that will slowly integrate as plugin for purge once that particular module gets ready API wise. The code has been tested considerably and several enterprise level customers have the code running in production already.
- (screenshot not applicable)
- Sandbox: http://drupal.org/sandbox/nielsvm/1871170
- GIT URI: http://git.drupal.org/sandbox/nielsvm/1871170.git acquia_purge
- First public project application yet been busy writing Drupal code for 7 years now.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | acquia-purge-coding-standards.patch | 14.11 KB | alex dicianu |
Comments
Comment #1
nielsvm commentedThe module is for D7 but will be ported to D8 in the future.
Comment #2
SqyD commentedI am SqyD / Paul Krischer, maintainer of Purge and I approve this module. This module will allow Purge 2.x to be vendor neutral and provide a solid tested base for anybody that would like to implement a platform specific purge solution that integrates with Drupal.
Comment #2.0
SqyD commentedTypo
Comment #3
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://ventral.org/pareview/httpgitdrupalorgsandboxnielsvm1871170git
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #4
alex dicianu commentedChecklist from this page: http://drupal.org/node/1587704
1. Basic application checks
1.1 Ensure your application contains a repository and project page link: ok
1.2 Ensure your project is not a duplication: ok
1.3 Ensure you don't have multiple applications: ok
2. Basic repository checks
2.1 Ensure the repository actually contains code: ok.
2.2 Ensure you are working in a version specific branch: NOT OK
Although master branches are commonly used in the Git world, the Drupal community uses major version branches (e.g., 7.x-1.x, 6.x-1.x) instead, since master does not indicate what Drupal version the project is compatible to.
It appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
2.3 Ensure your project contains a minimum of handwritten code: ok
3. Security Review
3.1 Ensure the project does not contain any security issues: ok
4. Licensing checks
4.1 Ensure the repository does not contain a ‘LICENSE.txt’ file: ok
4.2 Ensure the repository does not contain any 3rd party (non-GPL) code: ok
5. Documentation checks
5.1 Ensure the project page contains detailed information: ok
5.2 Ensure the repository contains a detailed README.txt: ok
5.3 Ensure the code contains a well-balanced amount of inline-comments: ok
6. Coding standards and style
6.1 Run an automated review and ensure there are no major issues: NOT OK.
It appears you have some coding style issues: http://ventral.org/pareview/httpgitdrupalorgsandboxnielsvm1871170git. You should get them fixed.
7. API and best practices Review
7.1 Ensure you are using Drupals API correctly: My recommendations below:
File acquia_purge.install
File acquia_purge.module
Not sure if this is the best way of doing this. You should maybe use the output of parse_url or the drupal url() function instead. It's better for handling the trailing slashes or other problems.
Again parse_url can be used instead of explode.
File: acquia_purge.tlds.inc
File: acquia_purge.rules
Instead of exploding and imploding those paths, you can simply use something like this, in order to check for starting or trailing slashes.
PS: If you wish to speed this process up, there is this program: Review Bonus
Comment #5
alex dicianu commentedHi Niels,
I have attached a .patch file that addresses the coding style issues. You could maybe give me commit right for this module and next time I could just commit the changes.
Comment #6
nielsvm commented@dicix, thank you SO much for doing this, it is much, much appreciated. I hate doing this but there's one whiny request I have before I'll commit that code: could you separate the functional changes out? What I mean with that is everything that changes the runtime path PHP takes, examples:
I'm certainly not unwilling to incorporate improvements at all but its merely taking zero risks at the moment, the code is running in production and I'm conservative with functional changes until absolutely sure they don't matter. And for that I need to test and run it first which I didn't had time for now ;).
Thanks a bunch for the nice contribution.
Comment #7
nielsvm commented@dicix: Feedback on your review. If you would agree I now consider the code to have passed your review.
Thank you for the hard work!
#2.2 Ensure you are working in a version specific branch: NOT OK
This has been fixed as of [master 1aa545f] [END-OF-MASTER-BRANCH] Removed files which live on in specific subbranches, left a notice.
#7.1 Line 38: when adding links, the drupal l() function should be used instead of writing the html markup.
I'd love to, however the API specifically prescribes that I should use direct HTML for translators to keep context:
https://api.drupal.org/api/drupal/includes%21common.inc/function/l/7
#7.1 Line 35: you are getting the url's path by stripping the domain. A better approach would be using the php parse_url function: http://fr2.php.net/parse_url. Domains can have multiple forms, such as http://www.domain.com:8080/path and you might not be able to detect this using the current method.
Sorry, I looked at the code and considered parse_url() but that won't go, we are not parsing a URL :/. Due to me unknown technical reasons the expire module delivers strings like "http://www.site.comcontact" for which the only workaround is to strip off generated url's on the domain, there is no other way. Its also not true that domains can have other representations like site.com:8080 as they come from a trusted source: Acquia's systems, everything beyond that is outside the intentions of this module.
#7.1 $uri = sprintf('http://%s%s%s', $domain, $base_path, $path); Not sure if this is the best way of doing this. You should maybe use the output of parse_url or the drupal url() function instead. It's better for handling the trailing slashes or other problems.
Agreed, although the parse_url call hasn't been necessary nor logical in the context of the code I have replaced that sprintf() call with simple string concatenation and I've fixed a different race condition with double slashes at the same time.
#7.1 Line 174: Function _acquia_purge_get_domains_add_acloud(): You should probably try to figure out if there is a better way of doing that. You might not always have the permission to read through those vhost .conf files. In my opinion, a configuration page where the admin user cand enter the ServerName and ServerAlias would be a more robust approach.
I appreciate your feedback here, and interestingly enough most things have been thought about already. This implementation isn't nice, clean nor anything to be proud of but it is something that works and Acquia has automated control over his servers its reliable and robust enough for now. There's an open standing internal request to get the customer configured domains fed via the runtime environment ($conf), which will remove this once it is implemented. Using the Cloud API is a no-go for now as our customers then have to provide API keys beating the purpose of a zero-configuration working module.
#7.1 Line 239: $site = explode('.', $site); Again parse_url can be used instead of explode.
No it cannot be used, since parse_url() parses URL's and that's not what we are parsing here. Instead we are parsing sites.php's weird domain and path description description that comes in the form of '
..
', which is documented just above that line and no URL that parse_url() could deal with anywhere close. A faster alternative to explode() doesn't exists IMHO as split() relies on the regex engine and has been marked deprecated. This logic has been designed exactly to parse these strings, and not urls.
#7.1 acquia_purge.tlds.inc: Keeping the list up to date, although it seems like an easy task, at some point it might fail for someone ... It might be worth thinking of a more reliable strategy ...
I totally agree and I knew it took maintenance when I decided for this path. The other alternative would have been automatically downloading a definition from the web but that would 1) tie the stability of this module to a random website/url on the web and 2) provide a bigger performance hit then including a static PHP array that gets caches by APC's opcode caching instead of downloading+caching+retrieving-from-cache. The alternatives are - unfortunately - worse.
#7.1 _acquia_purge_action_purge(): Instead of exploding and imploding those paths, you can simply use something like this, in order to check for starting or trailing slashes.
You are right, I have simplified, fastened and improved the safety of the implementation in [7.x-1.x 41a81ca], pushed into the 7.x-1.x branch.
Comment #8
nielsvm commentedModule is now on branch 7.x-1.x and I've just checked everything against coder (minor level checks).
I continued with the reports from PAReview.sh and managed to get it empty with minor and detail level trade-offs, a rage of following commits from f040666d194ba49f27c86f1045502119fc4470b4 to 5fca4e7cd6bfa4c862e06f176683b80b832d4ead was needed to get it empty.
All code is upstream and intended to remain stable, clean and mainly untouched as it is currently.
Comment #9
nielsvm commentedhttp://ventral.org/pareview/httpgitdrupalorgsandboxnielsvm1871170git-7x-1x
That's the latest report. Only thing mentioned is that the master branch still exists as I'm hesitant against deleting this, the history is too important for that I'd say. Nevertheless, this is how master looks like for those wondering:
Comment #10
nielsvm commentedI've forgotten to change this status a couple of weeks ago.
Comment #11
cfischer83 commentedI am currently using the 7.x-1.x-beta2-queuing-elb-support branch on our Acquia subscription, and it works for the things with which we need. I do have some comments and observations. To give some background, here is our setup:
www.example.com resolves to Akamai.
Akamai does origin pull from origin.example.com but it MASKS the origin with a host header change to "www.example.com"
Because the purge module must point to a domain on the balancer (i.e. it can't point to www.example.com), it has to be pointed to origin.worldvision.org which will leave any Varnish cache for "www.worldvision.org" uncleared when Akamai does its origin pull, thus giving Akamai an outdated Varnish cache.
The 7.x-1.x-beta2-queuing-elb-support branch has allowed us to mitigate this which clears both Varnish caches.
Some observations:
1. The queuing takes quite a bit of time, sometimes clearing up to 1600 items ten at a time. If I change this value, is there a max that the ACQUIA_PURGE_QUEUE_TRESHOLD should not exceed?
2. The queue will sometimes state a negative percentage (such as -20%) but I cannot seem to reproduce consistently. I did not see an open bug, and won't open one until I can reproduce consistently.
3. Each purge adds an individual log to Watchdog. That can be 1600+ entries every time someone hits publish. Any way to combine these into one log? (I know that would be difficult with queuing).
4. We plan on having Akamai caches purged at the same time for the same URLs, eventually. Any plans on integration with the Akamai module?
Comment #12
kscheirerYou have a couple minor errors listed here: http://pareview.sh/pareview/httpgitdrupalorgsandboxnielsvm1871170git.
Thanks for addressing possible duplication on your project page.
You should remove the master branch.
lol @ the function name _acquia_purge_are_we_on_acquiacloud() :)
Ouch, you have to grep through /etc/apache2/conf.d ? This is a very specific use module, and it's coming from Acquia, so if you're ok with it I am too.
Great addition!
----
Top Shelf Modules - Crafted, Curated, Contributed.
Comment #13
nielsvm commentedHi kscheirer,
Thank you for your review and comments. You are right that parsing Apache is horribly messy although it works and will remain to work as we have control over our servers, its Acquia specific indeed. Despite that hack, there's an internal user story that tasks to expose that information so that I can retrieve that data in a cleaner way. Customers drive the priorities of our internal user stories so I have no way to predict the time path of that and will just have to wait on the fix ;).
Now let's see how quickly this turns into a project :-).
Niels
Comment #14
charles belovThis will apparently also require an Acquia Purge Workbench Moderation module, as the message is sent when saving to draft or needs review. I'd consider this low priority, since it doesn't cause data to be lost or website visitors to get inappropriate content, but just wanted to get the issue recorded.
Comment #15
charles belovIf I may respectfully suggest a wording change:
"Changes have been made that require pages to be refreshed from your caches and load balancers. Please wait..."
It appears this message is not AJAX-driven, so "Please wait..." could be confusing, leading to someone waiting for the message to change. Also, depending on who gets permissions (I anticipate showing this message to all publishers), some of this comes across as jargon. So, I suggest:
"There have been changes to content, and this content needs to be refreshed throughout the system. There may be a delay before the new content appears to all website visitors."
This message might need to be adjusted depending on whether it only shows to the user who triggered the action or to all users who are logged in at the time who have permission to see the message.
Comment #16
kscheirerIt's been a month since RTBC, and none of those look like blocking issues, so...
Thanks for your contribution, nielsvm!
I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
----
Top Shelf Modules - Crafted, Curated, Contributed.
Comment #18
charles belovJust for findability, this appears to have moved to https://drupal.org/project/acquia_purge
Comment #18.0
charles belovMade the sandbox URL clickable.