Hello
When i try to run cron i get the error message
drush @1med cron
WD php: Recoverable fatal error: Argument 2 passed to db_query() must be an array, integer given, called in [error]
/var/www/drupal-7.0/sites/all/modules/contrib/votingapi/votingapi.module on line 74 and defined in db_query() (line 2213 of
/var/www/drupal-7.0/includes/database/database.inc).
Recoverable fatal error: Argument 2 passed to db_query() must be an array, integer given, called in /var/www/drupal-7.0/sites/all/modules/contrib/votingapi/votingapi.module on line 74 and defined в функции db_query() (строка 2213 в файле /var/www/drupal-7.0/includes/database/database.inc).
Drush command terminated abnormally due to an unrecoverable error.
I fix this
--- votingapi.module_o 2011-02-23 02:44:13.000000000 +0300
+++ votingapi.module 2011-02-23 02:49:08.000000000 +0300
@@ -71,10 +71,10 @@
if (variable_get('votingapi_calculation_schedule', 'immediate') == 'cron') {
$time = REQUEST_TIME;
$last_cron = variable_get('votingapi_last_cron', 0);
- $result = db_query('SELECT DISTINCT entity_type, entity_id FROM {votingapi_vote} WHERE timestamp > %d', $last_cron);
+ $result = db_query('SELECT DISTINCT entity_type, entity_id FROM {votingapi_vote} WHERE timestamp > :timestamp', array(':timestamp' => $last_cron));
- while ($content = db_fetch_object($result)) {
- votingapi_recalculate_results($content->entity_type, $content->entity_id, TRUE);
+ foreach ($result as $content) {
+ votingapi_recalculate_results($content->entity_type, $content->entity_id, TRUE);
}
variable_set('votingapi_last_cron', $time);
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | votingapi_cron_db_error.patch | 900 bytes | slashrsm |
Comments
Comment #1
slashrsm commentedIt fixes this bug also for me. I've put dema502's code in a patch, which is attached.
Comment #2
slashrsm commentedComment #3
Anonymous (not verified) commentedConfirming this. Patch #2 works, is still needed for 2xdev. Please commit.
Comment #4
pmorel commentedHad the same issue, fixed on my version, search 'cron' in the issue queue, found this bug, my patch is exactly the same as #2, please commit.
Comment #5
Taxoman commentedReady to be committed?
Comment #6
hass commented+
Comment #7
univate commentedI am using the patch in #2 to fix this issue on a live site.
Comment #8
adammichaelroach commentedPatch worked for me
Comment #9
tomogden commentedI also got the above error while in the Panels Page Manager. The patch was just what I needed, thanks!
Comment #10
Anonymous (not verified) commentedThis is really needed. +1
Comment #11
Fidelix commentedCan this please be committed?
Comment #12
phoenix commentedHad the same problem here. And wrote same code as in the patch to fix it here. This can be committed.
Comment #13
eaton commentedAt long last, committed and pushed. Will be in the 2.5 release.