Project URL
http://drupal.org/sandbox/balintcsaba/1948756
Git instructions
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/balintcsaba/1948756.git cacheflush
For Drupal
7.x and above
Description
The fine granularity of control over cache tables and function makes this module the ultimate tool to clear the Drupal caches.
It ships with a predefined set of actions, but it's biggest strength lays in it's configuration, where one can build any number of custom presets to fit almost any need on both development and production environments.
It is suitable for any role, starting from developers to administrators or editors. Access to each preset can be limited by permissions.
It allows mixing core and contrib cache tables and/or functions with low level custom rules to always clear just what's necessary, reducing precious development time.
Using this module minimizes time spent waiting for all the caches to be cleared when you a just need to recognize a new template file, for ex.
Integration
It fully integrates with the Drupal 7 core admin menu,
and also with the popular Administration Menu module.
Related modules
Administration Menu
+ this will probably ship with similar default presets, although the stress here is on ability of custom preset creation
+ also it integrates with the core admin menu as well, so no need to add the admin menu module just to have the cache clear options
Flush page cache
+ I contacted the owner of this module, jrockowitz, and he is not maintaining his module anymore so he kindly allowed me to inspire from the custom preset creation part, and he's willing to deprecate his module in favor of this, once it's released (D7 version)
CacheFlusher
+ I also contacted the owner of this sandbox, bhosmer, with the intention of using the "cacheflusher" namespace, but he was not willing to cooperate, although his module fill never be a full project according to it's application issue (http://drupal.org/node/1170924)
Review Bonus
I already had a project application, http://drupal.org/node/1862664
The module in question is now part of the Taxonomy Tools project, of which I became the maintainer.
Still, I don't yet have full project access on d.org.
As mentioned there, I'm moving my previous manual reviews here:
- http://drupal.org/node/1856330#comment-6830690
- http://drupal.org/node/1856330#comment-6842106
- http://drupal.org/node/1864452#comment-6840648
- http://drupal.org/node/1865018#comment-6842208
After klausi's review
Comments
Comment #1
reszliHi balintcsaba,
I'm really happy to see such a module under develpment
here is a quick review after installing it on a brand new D7
UI/UX
most of below list could be nice addition for better UX, some of them are mistakes
+ admin menu links could be more organized; for ex. separate sub-menu entry for list of existing presets, one for new preset creation
+ add default presets into the list as disabled rows and allow ordering of presets - reflected in them generated menus as well
+ change empty text of table (corrently says "no content")
+ reproduce same (similar) presets as admin menu by default
+ hide save button below form, when nothing to save
+ allow description textfield/area on preset creation, so presets can have an longer explanation
+ add one common label before vertical tabs ("Cache sources")
+ add one general description before vertical tabs ("Select below the different cache sources you wish to clear when your preset is executed. Don't be afraid to select them, all these are flushed when you normally clear all the caches. Select only those you need for better performance. ")
+ vertical tab titles and descriptions:
1.a. Core cache tables
1.b Select any of the cache database tables below, to be truncated when this preset is executed.
2.a. Other core cache options
2.b. Select any of the below functions to be run when this preset is executed.
3.a. Contrib cache tables
3.b. Select any of the tables defined by contributed modules to be flushed when this preset is executed.
4.a. Other contrib cache options
4.b. Note: Some contrib modules have unique ways to store their cache, or to flush them. These require custom configuration, so if you can't find some of your contrib modules here, please submit us an issue on http://drupal.org/project/cacheflush/issues/....
Select any from the list below to clear when this preset is executed.
5.a. Custom (advanced)
5.b. *** copy from the other module ***
5.c. Summary (below label) should say: "X custom rows defined"
+ vertical tab summary when nothing selected: "Nothing selected."
+ cache_block, cache_field, cache_image belongs to core modules, so it should be in the first vertical tab, I guess
+ always have at least one empty row by default in the custom section
+ add "- select table -" default label in the table drop-down in the custom section
+ make preset name field required (show * after label)
+ pre-fill preset name after validation error / refresh
+ go to list of presets after creation
+ arrange width of columns in the preset list
+ Edit | Delete buttons can go into one column called Operations
CODE
+ info file description = "Allows you to create configurable cache flusher presets."
+ I would rename "cacheflush.advanced.preset.inc" into "cacheflush.advanced.inc" or "cacheflush.adv_preset.inc" to be shorter
+ menu item 'admin/cacheflush/clearall' is defined twice in module file
+ add inline comment to describe different parts of the module
+ grammar: _cacheflush_clear_preset_clear_tabel should be *_table, is_tabel should be is_table, You must select a tabel should be table. etc...
+ sometimes you use empty line after function xyz() {, sometimes you don't...
DOCS
+ README.txt is empty
ERROR
+ and finally, when I try to run my custom preset it gives me an error, I assume something is missing from the GIT repo
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE (expire <> '0') AND (expire < '1364248055')' at line 1: DELETE FROM {} WHERE (expire...Comment #2
arun ak commentedHi,
Nice module. There are some issues I noted.
The menu item 'Cache Flush' is opened in overlay. But after clearing cache you are redirecting to $_SERVER['HTTP_REFERER'].
Please use drupal functions(request_uri()) for getting path. And its better after clearing cache redirect to the overlay page with status message that specifying which preset cache is cleared.
Comment #3
balintcsaba commentedHi ARUN AK,
I updated the status message how you suggested. About request_uri() i don't think is a good solution for me, because that is the current request URI ..... so if i put in drupal_goto() i will create an infinite loop. I need to get back to the page where the button was clicked. Yes i know that is not working with Overlay (just like the Admin Menu module), if i find a better solution i will implement.
Thank you for your time.
B.Csaba
Comment #4
beljaako commentedHi balintcsaba,
I like the idea of this module. Could come in handy when developing. Here's my manual review.
- What's the difference between admin/config/development/cacheflush and admin/config/development/cacheflush/list? It looks like they are exactly the same except for two links.
- I agree with ARUN AK, drupal_goto ($_SERVER['HTTP_REFERER']) is not a nice way of redirecting. I would suggest passing the path where your comming from to _cacheflush_clear_preset(). That way you can drupal_goto where you were.
- typo on line 60 "predafined" cacheflsuh.inc
- When using a wildcard, I'm getting a notice: Notice: Undefined index: wildcard in _cacheflush_clear_preset_clear_table()
- I tried some custom cache presets. Often I end up with a PDO exception:
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 WHERE (expire <> '0') AND (expire < '1364399600')' at line 1: DELETE FROM {0} WHERE (expire <> :db_condition_placeholder_0) AND (expire < :db_condition_placeholder_1) ; Array ( [:db_condition_placeholder_0] => 0 [:db_condition_placeholder_1] => 1364399600 ) in cache_clear_all() (regel 176 van /includes/cache.inc).
- When I am logged out, and directly navigate to a flush cache preset, for example: admin/cacheflush/clearall. Then I have to login of course. The problem is it keeps redirecting to itself. The browser eventually crashes in in infinate loop of cache clearing:
Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.
Keep up the good work!
Comment #5
balintcsaba commentedHi,
For beginning thank you for review.
- What's the difference between admin/config/development/cacheflush and admin/config/development/cacheflush/list? It looks like they are exactly the same except for two links.
- The difference will be noticed by does who use Admin Menu module (this was requested by reszli above for better UI with AdminMenu).
- I agree with ARUN AK, drupal_goto ($_SERVER['HTTP_REFERER']) is not a nice way of redirecting. I would suggest passing the path where your comming from to _cacheflush_clear_preset(). That way you can drupal_goto where you were.
If i use just drupal_goto() function that will redirect me to home /node (if you use the Overlay is the same) but without the overlay if you click a button in AM or just a simple Drupal installation and you are for example in content page you will stay there, otherwise not. For developer i think that this could be helping when they are clearing a page to continue there work from where let it.
- typo on line 60 "predafined" cacheflsuh.inc and PDOexepcion
Thank for the misspelling notice i will fix it. About the PDO, this is happening when you set a $cid the tabel is mandatory.
Explanation: cache_clear_all, but i think not everybody is familiar with this so i will make required the tabel and the $cid field. In this case you can't clear a hole table cache from advanced preset, but you have that option to do with other presets where that specified table was listed.
- When I am logged out, and directly navigate to a flush cache preset, for example: admin/cacheflush/clearall. Then I have to login of course. The problem is it keeps redirecting to itself. The browser eventually crashes in in infinate loop of cache clearing:
Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.
I managed to fix or to add 70 - 80% a of the reszli's post. I committed all day, i hope that i committed something that shouldn't when i tried to fix a drupal_goto() issue, and you tested that version. But tomorrow i will try to reproduce that and if is any problem i will fix it.
Thank you,
B.Csaba
Comment #6
balintcsaba commentedHi reszli,
I fixed all of your issues. Except this below witch will be included from another version.
@Future:
+ add default presets into the list as disabled rows and allow ordering of presets - reflected in them generated menus as well
+ allow description textfield/area on preset creation, so presets can have an longer explanation
Thank you
Comment #7
reszliHi balintcsaba,
Thanks for taking the time to make the interface a better experience for the users/developers.
I really like how the module looks and works now.
I see that you added the predefined presets to the list, and even those can be disabled.
It's definitely a good idea. Allowing to order them was just really an extra feature for the future.
There is only one small issue I found:
in the Custom (advanced) vertical tabs section even though I defined more then one lines
it always says 1 custom rows defined in both add and edit sections
As far as I see, only counts rows where wildcard is checked.
If that's fixed, I would mark this as RTBC.
bests,
reszli
Comment #8
balintcsaba commentedHi reszli,
Thanks again for noticing this issues. I fixed the js.
Comment #9
reszliGreat, not it provides a better feedback. Tx!
It works for me, switching status to RTBC.
Comment #10
bhosmer commentedI am the owner of the cacheflusher sandbox module, when the applicant contacted me, I suggested we pool our resources and offered him commit access to my repository.
I was in fact willing to cooperate and asked the applicant to instead of duplicating work, contribute to work that had already been done. If by "not cooperating", he means giving him the namespace for the "cacheflusher", then no, I told him we should work together and that I was willing to accept any improvements he might offer or ideas he might have.
Incidentally, I applied a while ago to promote my cacheflusher to full-project status: http://drupal.org/node/1170924
Comment #11
reszliHi bhosmer,
I reviewed your module in question:
(git clone http://git.drupal.org/sandbox/bhosmer/1170266.git cacheflusher)
which simply adds a shortcut to clear the all the caches.
If you carefully read the description of this module, you will see,
that this is a completely different tool, intended for developers and site builders,
allowing fine control over what cache values/tables to be cleared with different presets.
You have to accept, there is not much to pool in with your module here.
If you really wish to help, you can do real applications reviews, instead of bumping the progress.
bests,
reszli
Comment #12
klausiReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
manual review:
<script>alert('XSS');</script>as preset name I will get a nasty javascript popup on that page. You need to sanitize all user provided text before printing, please read http://drupal.org/node/28984 again.Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects. I also removed two automated review links from the issue summary. I'm also adding the security tag, please don't remove it, we are using it for statistical purposes and to show examples of security problems.
Comment #12.0
klausiremoved automated reviews.
Comment #12.1
balintcsaba commentedReview bonus update
Comment #12.2
balintcsaba commentedUpdate application review bonus
Comment #13
balintcsaba commentedHi klausi,
Thank you for your time, i fixed the issues, also i reviewed other 3 application. You will find in the project issue description.
Comment #13.0
balintcsaba commentedReview bonus update
Comment #14
reszliHi balintcsaba,
based on klausi's review:
2. & 3. use of t() function
cacheflush.preset.inc line 73 and 90
t() here:
'#title' => t("@val", array("@val" => $value)),is redundantno need to translate a variable only, the $value options were already passed though t() in lines 61-65
4. do not document $form and $form_state
cacheflush.preset.inc lines 263-364
you can also remove this
7. token used incorrectly
instead of
you should use it as
9. incorrect sentence on UI
cacheflush.preset.inc line 309
Table ($table): The table $table to delete from.
should be
Table ($table): The name of the table to delete from.
that's it :)
hope you can fix this soon, I'd really like to use this module asap!
reszli
Comment #15
balintcsaba commentedHi reszli,
What a nice weekend we have :):):)
Thanks for the quick review i fixed this issues
Comment #16
balintcsaba commentedAnd i forgot the status
Comment #17
reszliHi balintcsaba,
sorry to ruin your weekend, but now I have some spare time to do reviews
here are a couple more things to fix after another manual review:
1.
cacheflush.preset.inc
line 73: '#title' => t('@val', array('@val' => $value)),
line 92: '#description' => t("@val", array("@val" => $value['description'])),
incorrect use of t() for a variable only
you should remove t() from these two lines
and add them back to (only) lines 61-65 in the array declaration
2.
cacheflush.advanced.inc line 11
no need to document $form and $form_state
you should document $preset_id and $cache_presets
3.
spelling: Tabel => Table
4 matches in 2 files
cacheflush.inc line 58
cacheflush.advanced.inc lines 20, 93 and 128
4.
cacheflush.admin.inc line 12
global $base_url; not used
5.
cacheflush.admin.inc line 75
'#value' => t('Add rows'),
would be better as
'#value' => t('Add another row'),
6.
it would be a good idea to use a confirmation form on custom preset's "Delete" link
I changed your tags:
"review bonus" should be "PAReview: review bonus"
Comment #18
balintcsaba commentedHi reszli,
I fixed the 6 issues you provided, if you have more don't be shy and send me.
Comment #19
reszliHi balintcsaba,
I reviewed all the points mentioned above
one issue I realized when checking point 5.:
you can't check 'clicked_button' by it's '#value' to determine which button was clicked,
since that goes through t() and the string will differ when translated
in cacheflush.advanced.inc
line 26:
if (isset($form_state['clicked_button']) && ($form_state['clicked_button']['#value'] == 'Add another row' || $form_state['clicked_button']['#value'] == 'Remove')) {line 29:
if ($form_state['clicked_button']['#value'] == 'Remove') {line 43:
if ($form_state['clicked_button']['#value'] == 'Add another row') {you do check it correctly by the '#id' in cacheflush.preset.inc
line 132:
if ($form_state['clicked_button']['#id'] == 'edit-delete') {you should do the same in advanced.inc inc as well
other than that, it should be fine now
Tx!
Comment #20
balintcsaba commentedDone
Comment #21
sreynen commentedComment #22
reszliGreat! Tx!
Comment #23
nsuit commentedLooked ok to me. I can tell this could be usefulI for the following problem. In the past where due to some problems with varnish module. My CSS wouldn't render correctly anymore, so if that cache can be targeted and flushed on a schedule that would be great.
Comment #24
balintcsaba commentedHi nsuit,
In the near future I want to break the Tabs to separated modules and allow for others to extend the current functionality (a new tab) with varnish or why not memcache. And of course i want to make functional the automatic preset clear by cron-job.
Comment #25
kerasai commentedIn regards to point 5 on #19, the best way to handle this is to set submit callbacks on the submit buttons (via the button's #submit element). Then the appropriate callback runs when the button is clicked instead of running everything through a generic callback and trying to figure out which button the user clicked.
Comment #26
klausimanual review:
Although you should definitively fix those issues they are not critical application blockers, so ...
Thanks for your contribution, balintcsaba!
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.
Comment #26.0
klausiBonus update
Comment #27.0
(not verified) commentedAdded a missing link to the Taxonomy Tools module.
Thanks.