uploads info fields not upgraded
2 posts by 2 authors in: Forums > CMS Builder
Last Post: November 27 (RSS)
By kitsguru - November 16 - edited: November 16
I have an app that uses CBSB 3.73. I had an old database backup from CMSB 3.53 that contained the data I needed for a client. I imported the data fine but notice that the uploads table did not get converted to use mediumtext for the info fields.
On examining the code, I see that the routine will not run. I only runs if the version is 3.71. Also a clean install with 3.73, although the fields are medium text, and text boxes, they only show as text field and are truncated to 254 characters.
UPDATE:
I just discovered that each upload field in each table can be controlled separately.
function _upgradeToVersion3_71() {
if (settings('programVersion') >= '3.71' && settings('programBuild') >= '2652') { return; }
// regenerate cookie prefix so that new login cookies are created with the new SameSite=Lax attribute
$newCookiePrefix = substr(md5((string)mt_rand()), 0, 5).'_';
Settings::set('cookiePrefix', $newCookiePrefix);
// update upload info columns to mediumtext (from VARCHAR(255))
$result = DB::query("ALTER TABLE `:_uploads`
MODIFY info1 MEDIUMTEXT,
MODIFY info2 MEDIUMTEXT,
MODIFY info3 MEDIUMTEXT,
MODIFY info4 MEDIUMTEXT,
MODIFY info5 MEDIUMTEXT");
if ($result->errno) {
alert("Error updating uploads table info columns to mediumtext. Mysql Error($result->errno): $result->error<br>\n");
}
//
saveAndRefresh('3.71', '2652');
}
By Dave - November 27
Hi Jeff,
When you restore old backups sometimes the MySQL and CMSB field types will be out of sync. An easy fix is just to click "modify" and then "save" on a field in the CMS database editor and it will check the MySQL column type and update it if needed.
In future, we have plans to write some more robust code to detect and adjust MySQL column types automatically, but currently, it's not automatic. Field creation is automatic, but not column type changes.
Thanks for reporting this, we'll keep it on the radar for the future.
interactivetools.com