Hi celuch,
I was moving a CMSB site to a new server, and though I'd try the beta before getting it going. It seemed to install well, but won't let me import the existing database. I receive this:
makeAllUploadRecordsRelative MySQL Error: Unknown column 'storage' in 'where clause'I
Is there a way around this?
Yes, to resolve this:
call createMissingSchemaTablesAndFields() function before makeAllUploadRecordsRelative() on line 231 of cmsb/lib/menus/admin/actionHandler.php
The whole elseif block should now look like this:
elseif ($action == 'restore') {
security_dieUnlessPostForm();
security_dieUnlessInternalReferer();
security_dieOnInvalidCsrfToken();
disableInDemoMode('','admin/general.php');
$restoreDatabaseFilePath = $GLOBALS['BACKUP_DIR'] . @$_REQUEST['file'];
restoreDatabase($restoreDatabaseFilePath);
notice("Restored backup file $restoreDatabaseFilePath");
createMissingSchemaTablesAndFields(); // create any fields that weren't in the backup database but were in the schema files
makeAllUploadRecordsRelative();
showInterface('admin/general.php');
exit;
}
The issue was caused by the missing "storage" column of the "uploads" table.
Database backup files made before v3.03 beta 1 doesn't have this column.
When we restore using a database backup, it drops the table and recreate it along with the columns and records in the backup file.
That means it recreates the "uploads" table without the "storage" column which causes the issue.
Calling createMissingSchemaTablesAndFields() function will add the missing column back after the database has been restored.
I found the same issue when installing a fresh copy v3.03 beta 1 using "Restore From Backup" option wherein the backup file doesn't have the "storage" column.
To resolve this:
call createMissingSchemaTablesAndFields() function before makeAllUploadRecordsRelative() on line 243 of cmsb/lib/admin_functions.php
NOTE: This fix will be included on the next CMSB release.
Please let us know any questions.
Thanks,
Daryl Maximo
PHP Programmer - interactivetools.com