Let me start off by saying I love this module andthe elegance od using drupal's update system. I tried following the example in the online docs and added a new role. However when I run the update I get:
warning: array_merge() [function.array-merge]: Argument #2 is not an array in /var/www/drupal.flash4play.com/public_html/update.php on line 174.
warning: Invalid argument supplied for foreach() in /var/www/drupal.flash4play.com/public_html/update.php on line 338.
This is my code in public_html/sites/all/modules/test/updates/test_update_6002.inc:
<?php
/**
* ---------------------------------------------
* Generated by custom_module_updates.module
* http://drupal.org/project/custom_module_tools
* Generated on Fri, 08/14/2009 - 18:10
* ---------------------------------------------
test3
*/
$update = array(
'created' => 1250286567,
'updated' => 1250286611,
'update_function' => 'test_update_6002',
'data' => 'a:1:{i:0;a:6:{s:4:"type";s:5:"macro";s:4:"data";a:4:{s:7:"form_id";s:19:"user_admin_new_role";s:4:"path";s:16:"admin/user/roles";s:10:"parameters";a:1:{i:0;a:3:{s:7:"storage";N;s:9:"submitted";b:0;s:4:"post";a:7:{s:13:"form_build_id";s:37:"form-a4f9d258a38b04305a1622af8acce640";s:10:"form_token";s:32:"428bbec9b81fe9743d59fc41337d3452";s:7:"form_id";s:19:"user_admin_new_role";s:11:"update_save";s:1:"1";s:14:"update_message";s:17:"Adding a new role";s:4:"name";s:9:"test role";s:2:"op";s:8:"Add role";}}}s:6:"values";a:5:{s:4:"name";s:9:"test role";s:2:"op";s:8:"Add role";s:15:"update_function";s:16:"test_update_6002";s:11:"update_upid";s:1:"3";s:14:"update_message";s:17:"Adding a new role";}}s:2:"op";s:8:"Add role";s:7:"message";s:17:"Adding a new role";s:9:"submitted";i:1250286611;s:4:"user";O:8:"stdClass":27:{s:3:"uid";s:1:"1";s:4:"name";s:6:"waygee";s:4:"pass";s:32:"4f10e9746a4f8b355ee9d7d2b9d4ee5a";s:4:"mail";s:16:"waygee@yahoo.com";s:4:"mode";s:1:"0";s:4:"sort";s:1:"0";s:9:"threshold";s:1:"0";s:5:"theme";s:0:"";s:9:"signature";s:0:"";s:7:"created";s:10:"1242662935";s:6:"access";s:10:"1250286484";s:5:"login";s:10:"1250278778";s:6:"status";s:1:"1";s:8:"timezone";N;s:8:"language";s:0:"";s:7:"picture";s:52:"sites/default/files/profile_images/WayGeeProfile.jpg";s:4:"init";s:16:"waygee@yahoo.com";s:4:"data";s:101:"a:2:{s:14:"picture_upload";s:0:"";s:13:"form_build_id";s:37:"form-9923af66a014613730238281a58ce7ff";}";s:13:"timezone_name";s:0:"";s:3:"sid";s:32:"7bdd28d48cbfb6cc0ec5f59a9bc92716";s:8:"hostname";s:11:"66.92.116.2";s:9:"timestamp";s:10:"1250286588";s:5:"cache";s:1:"0";s:7:"session";s:0:"";s:14:"picture_upload";s:0:"";s:13:"form_build_id";s:37:"form-9923af66a014613730238281a58ce7ff";s:5:"roles";a:1:{i:2;s:18:"authenticated user";}}}}',
'comment' => 'test3 ',
);
//Write update record
if(drupal_write_record('custom_module_updates', $update)){
drupal_set_message(t('Custom Module Update has been inserted into the database.'));
drupal_set_message(t('You must now visit the !link to execute the changes.', array('%link' => l('Custom Module Updates page', 'admin/reports/custom_module_updates'))));
dsm($update);
}
Any suggestions? I'm hoping I did this right.
Comments
Comment #1
jon pughThanks for the heads up.
The problem is that hook_update_N() functions have to return $ret; where $ret is an array, even if its an empty array.
The update code should still have run just fine, it's the update.php system that is throwing a minor error because it didn't get the array.
I'm in the process of figuring out how to improve this module and go from here, I'll be sure to add the fix needed for this problem.
Thanks!
Comment #2
lionstone commentedI get this error message, as well. Where should
return $ret;go ? I tried like this but to no avail:Very excited about the potential of this project!
Comment #3
jon pughProject is no longer supported.