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.
Hi!
I'm using this module, beatiful :)
But it works only for nodes.
I know that it works with Rules module, but could be useful to extend expire options taxonomy terms (and, generally, with any entity type defined on the drupal installation).
Comment | File | Size | Author |
---|---|---|---|
#27 | expire-fix-save-overriden-values-2201913-27.patch | 7.13 KB | devad |
#15 | add_support_for_terms-2201913-15.patch | 17.77 KB | Leon Kessler |
#15 | interdiff-2201913-12-15.txt | 6.14 KB | Leon Kessler |
#14 | add_support_for_terms-2201913-14.patch | 17.78 KB | Leon Kessler |
#14 | interdiff-2201913-12-14.txt | 5.52 KB | Leon Kessler |
Comments
Comment #1
SpleshkaHi,
I think that you are right, and support taxonomy and entities would be great. But currently I am not sure if I have enough time to implement this. I would appreciate any help in the development, if any.
Comment #2
arrubiu CreditAttribution: arrubiu commentedI'll take a look to your implementation of user and files expiration, maybe it could be easy to implements files :)
Comment #3
SpleshkaYes, it is really easy to do this. In general you may take a look on users' expiration and copy most of code for taxonomy.
Comment #4
capellicBut the home page says that Taxonomy is supported. Confused.
Comment #5
SpleshkaThat means that we have a support of taxonomy references. But you are right, that may be confusing.
Comment #6
mukhsim CreditAttribution: mukhsim commentedPatch attached, please test.
Comment #7
medienverbinder CreditAttribution: medienverbinder commentedHi!
I think taxonomy is basically supported. If a node has been modified, the associated taxonomy terms were deleted from the cache. However when a taxonomy term is changed, there was no response to this change.
With the patch (#6) so far everything is running correctly.
Server:
Varnish 3 proxy cache server with purge support
Drupal Modules:
Varnish
Purge
Expire
After applying the patch, I was able to consider the changes with the expire and purge module and delete taxonomy terms from cache with the corresponding ban command:
Example ban command after saving a taxonomy term (tid 34):
varnish Successfully ran command: ban req.http.host ~ [CACHESERVERURL] && req.url ~ "^/$|^/home$|^/taxonomy/term/34$|^/footerm$"
Thank you!
Comment #8
quotesBro CreditAttribution: quotesBro commentedThanks for #6, it works for me.
Here is a patch #6 with 2 fixes:
->
and
+ '#default_value' => variable_get('expire_node_override_defaults_' . $vocabulary),
->
+ '#default_value' => variable_get('expire_taxonomy_term_override_defaults_' . $vocabulary),
Comment #9
dysrama CreditAttribution: dysrama commented+1 for patch #6, works as intended.
Patch #8 doesn't work though, since it fails to add the expire.taxonomy_term.inc file
Comment #10
joelpittet@dberror an interdiff would be nicer;) @see https://drupal.org/documentation/git/interdiff
There must have been an issue because the things you said changed made the patch ~4kb smaller. And by a quick interdiff it looks like the new file was forgotten to be added (That is super common I've seen).
Comment #11
joelpittetHere is #8 again because they were nice catches in there, with an interdiff between #6 and #8.
Comment #12
joelpittetHa, and I did that backwards... whoops.
Comment #13
joelpittetHere's a review, lots of nitpicks for coding standards:
Shouldn't be all caps.
Is this check needed?
Extra line break added.
Probably shouldn't break this onto a new line for coding standards.
Again this is checking for taxonomy, maybe it shouldn't be as this whole thing depends on taxonomy.
Is this field_collection module check nessassary or can we punt that to a hook to alter if a 3rd party wants to extend expire?
Needs a comma at the end.
Should these be drush_print() and drush_print_r() statements? Also "handler" has a typo.
Debug?
Comment #14
Leon Kessler CreditAttribution: Leon Kessler commentedWould love to see this in.
I've gone through the patch and comments from #13.
Uploaded a new patch + interdiff.
Will explain changes in a follow up comment.
Comment #15
Leon Kessler CreditAttribution: Leon Kessler commentedMinor adjustment.
Here's new patch and interdiff from #12
Comments to follow...
Comment #16
Leon Kessler CreditAttribution: Leon Kessler commentedOkay so...
1)
Removed
module_exists('taxonomy')
checks (I think these have just been copied over from the node settings).We could wrap the whole thing in a module_exists check, not sure if it would be worth it.
2)
Removed this entire setting, as it didn't really make sense on the config page.
You had:
"Taxonomy term page."
and then
"Taxonomy term pages"
Again this has been copied from the node settings (where you can expire a nodes term pages). Instead I've moved everything to "Taxonomy term reference pages". This now takes care of the lot (taxonomy_term_reference, node_reference, user_reference and entityreference).
3)
taxonomy_term_reference is not a module, it's a field type contained within the taxonomy module. We still need to check for node_reference module.
4)
Removed all debug code from _drush_expire_entity
5)
Have cleaned up Drupal coding standards, including some of the comments in
includes/expire.taxonomy_term.inc
(which went over 85 characters).6)
I've left this in, because it's how all the other sections are commented, and doesn't strictly break coding standards.
7)
Have also left in the line breaks in
expire_taxonomy_term_settings_form()
. Again this mimics how the rest of the module is done, and also doesn't break actually coding standards.Comment #17
joelpittetThis looks much better @leon.nk thanks for the cleanup and explaining your changes in detail.
I'm going to give this a whirl and see how it goes.
Comment #18
joelpittetSeems to work very well. Thank you @leon.nk!
Comment #20
SpleshkaThanks for your patches and reviews guys! Added few changes and commited to 7.x-2.x.
Comment #22
sam.spinoy@gmail.com CreditAttribution: sam.spinoy@gmail.com at Adapt commentedThe "Override default settings for this vocabulary" option does not seem to work? The options are present on the admin/structure/taxonomy//edit page but they don't get saved.
Comment #23
smitty CreditAttribution: smitty commentedI can confirm that the overridings made for the different Vocabularys are not saved.
I assume, that's because the functions "expire_taxonomy_vocabulary_update" "expire_taxonomy_vocabulary_insert" which could be called by taxonomy_vocabulary_save (taxonomy module) are missing. The same with "expire_taxonomy_vocabulary_delete". (at least the Metatag Module defines such functions to get the changes made to the taxonomy form saved).
Comment #24
earelin CreditAttribution: earelin commentedThe override of vocabulary does not work. I agree with comments from #23. I have created a patch that fix this problem using hook_taxonomy_vocabulary_update|insert. I had to change the form to be a tree for easier process of the data on the vocabulary array.
Comment #25
devad CreditAttribution: devad as a volunteer commentedPatch #24 works fine if vocabulary update action is launched from standard vocabulary edit tab:
http://mysite.com/admin/structure/taxonomy/vocab_name/edit
However, if vocabulary udate action is launched from vocabulary term list:
http://mysite.com/admin/structure/taxonomy/vocab_name
it is loosing some already saved expire variables and giving following notices:
Notice: Undefined property: stdClass::$expire in expire_taxonomy_vocabulary_update() (line 166 of /home/mysite/public_html/sites/all/modules/expire/expire.module).
Notice: Undefined property: stdClass::$expire in expire_taxonomy_vocabulary_update() (line 168 of /home/mysite/public_html/sites/all/modules/expire/expire.module).
Notice: Undefined property: stdClass::$expire in expire_taxonomy_vocabulary_update() (line 169 of /home/mysite/public_html/sites/all/modules/expire/expire.module).
Warning: Invalid argument supplied for foreach() in expire_taxonomy_vocabulary_update() (line 169 of /home/mysite/public_html/sites/all/modules/expire/expire.module).
I have wrapped problematic piece of code with "if (isset($vocabulary->expire))" to prevent notices and problems and it worked.
Comment #26
devad CreditAttribution: devad as a volunteer commentedNew patch.
Comment #27
devad CreditAttribution: devad as a volunteer commentedTried to fix line endings... I hope #27 is ok.
Comment #28
joelpittetThis should likely be in a new issue and made reference here. Usually we don't re-open issues unless it needs to be reverted.
Comment #29
smitty CreditAttribution: smitty commentedThe last patch works like a charm!
Please commit it.
Comment #30
smitty CreditAttribution: smitty commentedUnfortunately, it is not possible to expire the nodes which contain a taxonomy term, if the taxonomy term is changed. It would be great if this feature could be implemented too.
I created an own issue for this: https://www.drupal.org/node/2695017