backdrop-contrib / project

Projects associate a code-based project with releases and power the update server of BackdropCMS.org
2 stars 10 forks source link

Project Usage admin form doesn't save config correctly #48

Closed ghost closed 3 years ago

ghost commented 3 years ago

The submit function for the admin form for the Project Usage sub-module has a bug where of the two settings, one constantly overrites the other: https://github.com/backdrop-contrib/project/blob/1.x-1.x/project_usage/project_usage.admin.inc#L49

$config->set('life_weekly_project', (int) $form_state['values']['life_weekly_project']);
$config->set('life_weekly_project', (int) $form_state['values']['life_weekly_release']);

The second line should be $config->set('life_weekly_release'...

ghost commented 3 years ago

PR: https://github.com/backdrop-contrib/project/pull/49

ghost commented 3 years ago

And then I realised config wasn't even being saved at all! Fixed that in PR too.

klonos commented 3 years ago

Good catch @BWPanda 👍 ...the code changes seem reasonable and straight-forward to me.

Any idea what the repercussions of this being that way for so long? (asking since this seems to be related to what generates the usage stats pages on b.org)

quicksketch commented 3 years ago

Any idea what the repercussions of this being that way for so long? (asking since this seems to be related to what generates the usage stats pages on b.org)

Seems that backdropcms.org has probably just been using the default values:

"life_weekly_project": 31536000 (one year) "life_weekly_release": 15724800 (six months)

I merged https://github.com/backdrop-contrib/project/pull/49 to get it into the next release. Thanks!