Hello Jérémy,
First of all, congratulations for this wonderful module, I'm using it and it was clearly something that was missing.
Maybe one tiny bug that may not be one :
- I'm having this homebox profile which is called "Ma page d'accueil"
- Therefore one of the corresponding permission generated is "access homebox Ma page d'accueil"
- Today I upgraded linkchecker module and one of its updates was generating queries like "UPDATE {permission} SET perm ='blabla, foo, bar, needle, access homebox Ma page d'accueiln haystack' which failed because of the single quote
=> So maybe you should avoid using special characters when generating permission name ?
Or maybe the linkchecker update does not use the right syntax ?
/**
* Update the permissions table, to reflect changes to hook_perm.
*/
function linkchecker_update_6209() {
$ret = array();
$res = db_query('SELECT rid, perm FROM {permission}');
$perms = array();
while ($p = db_fetch_object($res)) {
$perm = $p->perm;
$perm = preg_replace('/access linkchecker/', 'access broken links report', $perm);
$perms[$p->rid] = $perm;
}
foreach ($perms as $rid => $permission) {
$ret[] = update_sql("UPDATE {permission} SET perm = '$permission' WHERE rid = $rid");
}
return $ret;
}
Comments
Comment #1
slybud commentedSorry for the disturbance : http://drupal.org/node/532178#comment-1887114
Comment #2
jchatard commentedNo problem!
I close this issue, feel free to reopen if something goes wrong with Homebox.
Jérémy
Comment #3
hass commentedAs per #540016: system_update_6034() will fail if permission have single quote, please fix the home box module
Comment #4
jchatard commentedI just updated code, to use cleaner permission names in 6.x-dev which will be available soon.
Note that you must re-check homebox permissions after the upgrade process, otherwise every homebox pages will return an access denied error.
Please test this new version before I can release it as stable, and hopefully make an non beta release.
Thank you for your feedbacks!
Jérémy
Comment #5
hass commentedChecked the code... I believe you need a regex that allows only A-Za-z0-9
Aside - this looks wrong...
and need to be
$page_safe_nameComment #6
jchatard commentedOk thank you hass, I've just committed your advices : http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/homebox/hom...
Hope it's good this time!
Jérémy
Comment #7
hass commentedOnly as a question... your module knows the "bad" permission names... why are you not running an update hook and replace the old broken permissions with the new?
Example (needs work for permission names):
@slybud: You need to test this... I cannot...
Comment #8
jchatard commentedOk, I have done that: http://drupal.org/cvs?commit=252434
Hopes it's good now!
Jérémy
Comment #9
hass commentedWhy are you not removing
homebox_update_6004()? :-)Aside - you must load the module in D6 times if
homebox_pages()function does not exists in the .install file and only in the .module file... otherwise the function may be undefined...Comment #10
jchatard commentedI did not removed update 6004 because if some people have updated to dev version before putting this release live, they wouldn't have the update permission names executed. I do undestand that this could be a really few people, but it can save them sometime.
I added the drupal_load call, but during my testing, I did not encountered any problem without it, anyway that sounds logical.
http://drupal.org/cvs?commit=252492
Thanks,
Jérémy
Comment #11
hass commentedBut now you have added 6005 that fixes all 604 issues automatically and 6004 is therefore only confusing all who will download the next dev... that's what I mean...
Comment #12
jchatard commentedCan I completely remove homebox_update_6004() function? 6005 will be called anyway?
Comment #13
hass commentedYes!
Comment #14
jchatard commentedOk, great!
http://drupal.org/cvs?commit=252502
Comment #15
hass commentedThe reason for the drupal_load is the upgrade path... Since D6 - modules can be upgraded if they are nevertheless disabled... if the module is disabled and a newer software version is on the webserver having newer hook_update_N's the update hooks are executed by update.php with the module disabled and this would give an undefined function error if drupal_load() is not used in the .install file.
I cannot find the doc page(s) about that...
Comment #16
jchatard commentedGood to know that!
Thank you!