Closed (fixed)
Project:
Drupal core
Version:
5.x-dev
Component:
system.module
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
14 Dec 2005 at 17:50 UTC
Updated:
25 Jan 2007 at 03:06 UTC
Jump to comment: Most recent file
We need to exclude certain variables from being saved when submitting a settings form. For example, without this patch submit the admin/settings/content-types/story page while your devel.module query log is enabled. you will queries like
DELETE FROM variable WHERE name = 'submit'
0.561INSERT INTO variable (name, value) VALUES ('submit', 's:18:\"Save configuration\";')
This patch avoids these meaningless variables.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | no_crap_in_variables_table_2.patch | 1.38 KB | Bèr Kessels |
| #6 | no_crap_in_variables_table_1.patch | 1.28 KB | Bèr Kessels |
| #1 | no_crap_in_variables_table_0.patch | 1.27 KB | moshe weitzman |
| no_crap_in_variables_table.patch | 2.18 KB | moshe weitzman |
Comments
Comment #1
moshe weitzman commentedsame patch, without unrelated upload.module fix.
Comment #2
chx commented'type' is used only by node settings and there is the problem: other modules may want to exclude other stuff. what about adding a $form['#exclude'] = array(...) to various hook_settings implementations, merging it with the default ones (reset, submit, form_id, array_filter)?
Comment #3
dries commentedIsn't the forms API supposed to know exactly what should be saved, and what not?
Comment #4
chx commentedHow could I know which hidden values are to be saved and which are not?
And also, here we have another problem, too: _submit does not get the form only form values. Can be fixed easily though...
This may even lead to somewhere, we add $form as thrid parameter to submit , and save only those that do not have #save => FALSE. Might even set this as a default on submit type.
Comment #5
moshe weitzman commentedmy patch prevents most of the crap. preventing all of the crap requires each hook_settings() to implement something and i'm not inclined to write that now. chx - if you think this patch needs work, i hope you or one of friends will resubmit. otherwise, please set to ready to commit.
Comment #6
Bèr Kessels commented+1 from me.
I was not aware of the bug, but when I just looked at my variables table, i indeed encuotered al lot of these ugly variables. The patch seems to fix this.
This is a rerolled patch (ready to commit?)
Comment #7
moshe weitzman commentedComment #8
moshe weitzman commentedComment #9
dries commentedI wonder why the forms api uses that many hidden variables.
Comment #10
chx commentedSo many? Hidden? form API only adds form_id and nothing else. 'submit', and 'reset' are buttons which the form always sets. 'type' and 'array_filter' is used with node options. 'array_filter' is a kludge because we did not want to rewrite node options (I did rewrite it once but then run away in horror -- see the checkboxes thread). 'type' I would
Comment #11
chx commenteddelete 'type' I would from my comment's end.
Comment #12
Bèr Kessels commentedSo, after we ran away in horror, what should happen to this simple patch?
It does fix the issues addressed, without running away in horror.
Comment #13
moshe weitzman commentedlets commit this one. it performs exactly as the title describes. and thats good.
Comment #14
moshe weitzman commentedany reason why this one has stalled? if so, please speak up so we can fix and resubmit.
Comment #15
Bèr Kessels commentedrerolled to fix a minor offset
Comment #16
dries commentedIs this patch still needed? The forms API has been modified to filter out some common variables.
Comment #17
markus_petrux commentedYes, I believe something is needed. Actually, before finding this issue I opened another one, because in fact, there's already code in the forms api to filter some of that 'junk', but it is incomplete. Here's the issue:
http://drupal.org/node/48209
Comment #18
Jaza commentedThis is fixed in Drupal 5. Closing.