Closed (fixed)
Project:
Mollom
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
7 Aug 2010 at 12:53 UTC
Updated:
24 Apr 2014 at 17:13 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
dries commentedI didn't even remember that there was a property called 'distribution_name'. ;-)
Sounds like core should provide better APIs for this kind of stuff.
Comment #3
sunIt's also not documented very well. Defaults to "Drupal", not an empty string, like I wrongly suspected:
This patch additionally injects a fake version into mollom.info for testing.
The error message indicates that those parameters may not be on the production servers yet.
Comment #4
sunLet's try again.
Comment #5
dries commentedThis is going to be prone to errors. We must remember to update this field for every release (which I'll fail to do).
Not sure I understand why it is required for testing. I don't see any tests for this functionality in the latest patch.
I'd explain why Mollom captures this information and how Mollom might use it. Without an explanation, some people might think it is 'spyware'.
Would be nice if there was an API for this ... ;-)
Comment #6
sun1) Without that version in the .info file, all CVS module checkouts will send no client version to Mollom. We could only send the value of http://api.drupal.org/api/constant/VERSION/7 then. If that is sufficient, we can do it.
2) ok, will try to write a sensible explanation.
Comment #7
dries commentedMaybe we need to update the code comment in the .info file then? The version number has nothing to do with testing, it sounds like.
Alternatively, we could use a CVS keyword like
$Revision: $. It is better in some ways (i.e. auto-magical and more precise than "7.x-1.x-dev"), but worse in others ways (i.e. no easy correlation with an actual release).Comment #8
sunDoes this work for you?
Note that CVS keywords are hopefully a relict of the past very soon. AFAIK, git does not support such keywords at all. (I may be mistaken though)
Comment #10
dries commentedI think this patch needs work (in addition to tests failing):
I don't understand why we need to hard-code this in mollom(). That is bad practice. We should update the caller instead:
$status['keys valid'] = mollom('mollom.verifyKey', _mollom_get_version());Why not
return $cache->data;? No need to assign it to a temporary variable first.$mollom_info['version'] is always set now. We can remove the conditional/check.
I don't understand this change. Makes the code unnecessarily harder to read, it seems.
Even if _mollom_get_version() returned nothing or when _mollom_get_version() returned incorrect information, assertSame() would still pass. Both use _mollom_get_version(). If we want to check that values were set, we need to use something other than assertSame().
Comment #11
sun1) Ah, you're right! I was mistakenly under the assumption that mollom.verifyKey would be invoked from elsewhere, too. Fixed that.
2) When fetching version information from the database cache, we populate the static cache prior to returning the info, so we're not hitting... hm, now that you mention it's only _mollom_status() that calls it, the static cache seems to be needless. We only need the database cache, _mollom_status() is "cached" already (in a system variable though).
3) d'oh on $mollom_info['version'], it was kinda late.
4) That's preparation code for the new testing installation profile, which we should be able to use for most of our tests. Separate issue indeed (running tests just takes horribly long on my computer for unknown reasons, so I'm always trying to make them as fast as possible).
5) Good catch! Fixed that.
Comment #12
dries commentedLooks great now. Committed to CVS HEAD.
Should be ported to DRUPAL-6--1.
Comment #13
sunSame patch for D6.
Comment #15
sunThat wasn't really a complete port.
Comment #16
sunComment #17
dries commentedCommitted to CVS HEAD. Thanks!