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.
It seems like a good idea to move porterstemmer_stem()
and all its helper functions into a porterstemmer.inc
file, since this is a fair amount of code that doesn't get used on most page requests.
Comment | File | Size | Author |
---|---|---|---|
#13 | porterstemmer-reduce_module_footprint-7.x-1.x-dev-13.patch | 44.34 KB | mark_fullmer |
Comments
Comment #1
jhodgdonThat idea sounds fine to me. This could go even farther and make two include files, where one has only the stem function (all that is needed if you have the "stem" PECL extension installed), and the other has all the other stuff. Patch to do this and load files when necessary would be welcome!
Comment #2
jhodgdonI will say though that I haven't seen other modules doing this type of thing except for admin screens.
Comment #3
decafdennis CreditAttribution: decafdennis commentedComment #4
jhodgdonThanks... but could you perhaps try uploading the patch again? I'm showing a 0 byte patch, and when I click on it I cannot see anything in the file.
Comment #5
decafdennis CreditAttribution: decafdennis commentedI'm sorry. I don't know what went wrong, but here's the patch again!
Comment #6
jhodgdonThanks! This looks reasonable... We'll see about getting it committed.
Comment #7
deanflory CreditAttribution: deanflory commentedThis still hasn't been committed right since there isn't a newer release?
Comment #8
jhodgdonSorry, this fell off of my radar. Assigning it to myself so I can get it committed soon.
Comment #9
Pravin Ajaaz CreditAttribution: Pravin Ajaaz as a volunteer and at Ameex-Drupal Geeks commentedLooks good to me.
Comment #10
jhodgdonThis patch actually has a couple of problems:
a) It removes the @file doc block from the .module file without replacing it.
b) The include file only needs to be loaded if the PECL stemming library is not present, so it should only be loaded in that case if you actually want to reduce the footprint to its minimum.
Comment #11
jhodgdonComment #12
mark_fullmerComment #13
mark_fullmerThe attached patch loads the local stemming code only if the PECL library is not present, and brings the .module code and .inc file up to the latest Drupal CodeSniffer ruleset standards. All simpletests pass, as well: https://www.evernote.com/l/AlW19cSigq9A9IgVCMvW88mb4TG0nmm6V98
Comment #15
jhodgdonThis looks great, thanks! I've committed it to the project, with a minor change to the @file comments at the top of both porterstemmer.module and the new standard-stemmer.inc file. (Basically, I put the comment about the implementation of the stemming algorithm in the include file, because that is what is now in the include file, and the main module file now doesn't have the implementation in it.)