3.68 install with existing schemas ***Fails***

6 posts by 2 authors in: Forums > CMS Builder
Last Post: April 29, 2024   (RSS)

By kitsguru - April 26, 2024 - edited: April 27, 2024

When I tried a new install with 3.68 using schemas from another project I got an error at Field\Factory line 39. The schema name was empty.

My workaround was to revert to 3.66, do the install - which worked fine and then update CMSB to 3.68

I haven't done a complete debug, but it should be easy to reproduce. Create a new folder with CMSB 3.68, copy schemas from another project. Then attempt the install from scratch. This has worked as long as I have used CMSB so not sure what changed.

I was tired of doing a clean install on the server using a backup with CMSB 3.68 after my workaround to create my app. I got this error.

Fatal error: Uncaught InvalidArgumentException: Field 'num' not found in schema in /home/xxx/public_html/cmsb/lib/Fields/Factory.php:32 
Stack trace: #0 /home/xxx/public_html/cmsb/lib/schema_functions.php(25): Itools\CMSB\Fields\Factory::create() 
#1 /home/xxx/public_html/cmsb/lib/admin_functions.php(216): createMissingSchemaTablesAndFields() 
#2 /home/xxx/public_html/cmsb/lib/admin_functions.php(20): installIfNeeded() 
#3 /home/xxx/public_html/cmsb/admin.php(22): require_once('/home/xxx...') 
#4 {main} thrown in /home/xxx/public_html/cmsb/lib/Fields/Factory.php on line 32 
Jeff Shields

By kitsguru - April 28, 2024

I have tracked the problem down. I started with a clean install of CMSB 3.68, no problems creating a new database.

Copied schemas from a current project that uses CMSB 3.68 into the clean install. I could not enter the Database editor - error Field "num" does not exist.

Removed all add schemas and moved them in one at a time until I hit the error. Turns out the menugroup type is the cause.

Old Format

<?php /* This is a PHP data file */ if (empty($LOADSTRUCT)) { die("This is not a program file."); }
return array (
  '_description' => '',
  '_detailPage' => '',
  '_disableAdd' => '0',
  '_disableErase' => '0',
  '_disableEraseFromModify' => '0',
  '_disableModify' => '0',
  '_disablePreview' => '0',
  '_disableView' => '0',
  '_filenameFields' => '',
  '_hideRecordsFromDisabledAccounts' => '0',
  '_indent' => '0',
  '_listPage' => '',
  '_maxRecords' => '',
  '_maxRecordsPerUser' => '',
  '_perPageDefault' => '25',
  '_previewPage' => '',
  '_primaryKey' => 'num',
  '_requiredPlugins' => '',
  '_tableName' => 'blog_module',
  'listPageFields' => NULL,
  'listPageOrder' => '',
  'listPageSearchFields' => '',
  'menuHidden' => false,
  'menuName' => 'Blog  Module',
  'menuOrder' => '0000000007',
  'menuType' => 'menugroup',
);

New Format

<?php /* This is a PHP data file */ if (empty($LOADSTRUCT)) { die("This is not a program file."); }
return array (
  '_detailPage' => '',
  '_filenameFields' => '',
  '_indent' => '0',
  '_primaryKey' => 'num',
  '_tableName' => 'testing_menugroup',
  'menuName' => 'testing',
  'menuOrder' => 1714325050,
  'menuType' => 'menugroup',
);

The solution was to delete all the MenuGroup tables in the database editor and then recreate them to get the new format.

Jeff Shields

By kitsguru - April 28, 2024 - edited: April 28, 2024

Reports builder, Newsletter Builder 3 and Simple Forum on activate caused Database Editor to throw same error

Field 'num' not found in schema
/Volumes/J/@projects/yaaws5/html/www/cmsb/lib/Fields/Factory.php on line 32
https://yaaws5.yaa.test/cmsb/admin.php?menu=database
Jeff Shields

By kitsguru - April 29, 2024

FINAL FIX:

In the "/cmsb/data/schemaPresets/customMenuGroup.ini.php" I added this to the end of the array

  'num' => array(
    'order' => 1,
    'type' => 'none',
    'label' => 'Record Number',
    'isSystemField' => '1',
  ),
Jeff Shields

By Dave - April 29, 2024

Hi Jeff, 

Thanks so much for reporting this and tracking it down!  We'll have a fix out for this in the next release shortly.

Dave Edis - Senior Developer
interactivetools.com