I recently upgraded to 5.11. And I saw the namesilo module required an upgrade
After clicking on upgrade I get a white screen and this error in the logs
[2025-02-26T17:33:16.450128+00:00] general.ERROR: PDOException: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column `blesta`.`module_client_meta`.`client_id` at row 1 in .../blesta/vendors/minphp/db/src/PdoConnection.php:196 Stack trace: #0 .../blesta/vendors/minphp/db/src/PdoConnection.php(196): PDOStatement->execute() #1 .../blesta/vendors/minphp/record/src/Record.php(305): Minphp\Db\PdoConnection->query() #2 .../blesta/components/modules/namesilo/namesilo.php(168): Minphp\Record\Record->insert() #3 .../blesta/components/modules/namesilo/namesilo.php(105): Namesilo->setContactsFromServices() #4 .../blesta/app/models/module_manager.php(449): Namesilo->upgrade() #5 .../blesta/app/controllers/admin_company_modules.php(179): ModuleManager->upgrade() #6 .../blesta/vendors/minphp/bridge/src/Lib/Dispatcher.php(142): AdminCompanyModules->upgrade() #7 .../blesta/index.php(21): Dispatcher::dispatch() #8 {main}
I noticed that the error is pointing to this for loop inside the function 'setContactsFromServices' which is called from the Upgrade() method.
foreach ($client_contacts as $contact_client_id => $contacts) {
$this->Record->duplicate('module_id', '=', $module_row->module_id)->
duplicate('module_row_id', '=', $module_row->id)->
duplicate('client_id', '=', $contact_client_id)->
duplicate('key', '=', 'contacts')->
insert(
'module_client_meta',
[
'module_id' => $module_row->module_id,
'module_row_id' => $module_row->id,
'client_id' => $contact_client_id,
'key' => 'contacts',
'value' => json_encode($contacts),
]
);
}
I guess this function call from the upgrade method is to retrieve all contacts for all domains and set them into the module_client_meta table.
The issue as I see it is that the $client_contacts does not contain contacts per customer, but its key is an empty element.
(data masked)
Array
(
[] => Array <-- I guess here should be the blesta client_id?
(
[54789654] => Name1
[65465465] => Name2
[65465555] => Name3
...
)
)
I believe these lines are setting the client_id to [] so the $contact_client_id is null.
$contact_ids = $domainInfo->response(true)['contact_ids'];
if (!isset($client_contacts[$client_id])) {
$client_contacts[$client_id] = [];
}
I can't get pass the upgrade method.