CMSB v3.76 Beta Released (Performance Optimizations)

13 posts by 2 authors in: Forums > CMS Builder
Last Post: 8 minutes ago   (RSS)

By Dave - Tuesday at 1:54pm - edited: Tuesday at 1:54pm

Hi everyone,

We're excited to announce the beta release of version 3.76! We're already running this version on interactivetools.com and have implemented significant performance enhancements across the board. Every aspect of the codebase has been optimized for speed.

What's New

  • Performance Updates: The core CMS system now loads in less than 0.01 seconds - literally faster than a blink of an eye!
  • Schema File Changes: Schema files are now stored as *.schema.php instead of *.ini.php and contain only essential information for faster loading and easier manual editing
  • Menu Order: Menu order data is now centralized in /data/schema/__menu_order.php, eliminating the need to update ALL schema files when changing menu order (great news for Git/source control users)
  • Field Order: Within schemas, field order is now inferred by file order, making it simpler to rearrange fields through copy/paste when needed

Before You Upgrade

To appreciate the performance improvements, try this quick test:

  1. Before upgrading, reload the CMS Welcome screen a few times (click on the top-left program name)
  2. Note the average seconds displayed at the bottom of the page
  3. Upgrade to 3.76
  4. Perform the same action and compare the results and let us know

Performance varies by server configuration, but load time decreased from 0.50 seconds to 0.01 seconds on one of our development servers.

The full changelog for this release is as follows:

*** March 11, 2025 - Version 3.76 (Performance Optimizations)

SERVER REQUIREMENTS (Since Dec 2023): PHP 8.0+ and MySQL 5.7+ (or MariaDB 10.2+)

PERFORMANCE OPTIMIZATIONS
- CMS Speed: Core CMS system loads in less than 1/100th of a second (faster than you can blink!)
- CMS Fonts: Removed old font formats and switched to faster modern ones
- Schema Files: Now load faster and formatted for easier editing (field order is now implicit for cleaner diffs)
- Plugin Hooks: Unused plugin hooks are skipped to save time
- Menu Caching: Menu data is now cached and updated on database changes instead of being rebuilt on each page load
- Database Indexes: Added indexes for dragSortOrder and commonly referenced fields
- Internal Caching: Frequently called functions now cache their results instead of recalculating them
- Autoload Speed: Optimized autoloader and manually loading essential files for faster startup

BACKWARDS INCOMPATIBLE CHANGES
- Old .ini.php schema files are automatically converted to .schema.php; if you rely on direct reads/writes of `.ini.php`
please update your code. Internal CMS functions automatically adapt to the new format.
- Plugin /language/ folders are no longer supported, use main language file for translations instead (much faster)

FOR PROGRAMMERS
- Settings _dotEnvPath key introduced for optionally storing DB and Mail credentials in .env.php file outside of web root
- Upgraded Dependencies: Guzzle, PHPMailer, Firebase/JWT, OAuth2 libraries, etc. to latest versions
- SmartArray: Additional methods (getRawValue, contains, each, smartMap, or404, orDie, orThrow) and reorganized defaults
- SmartString: Additional methods (getRawValue, rawHtml, or404, orDie, orThrow, andPrefix) and reorganized defaults
- ZenDB: Additional methods: DB::likeContains(), likeContainsTSV(), likeStartsWith(), likeEndsWith() for simplified SQL pattern searches
- CMS: Added CMS::log($message) function for logging messages to the developer log - also accepts arrays and objects
- Some older method aliases are deprecated with fallback calls

BUG FIXES
- Uploads: Fixed issue where multiple new uploads with info fields only showed edit form for the first upload
- Misc code and other minor improvements

You can download the latest beta here:https://www.interactivetools.com/download/

Please post (or email) any feedback, questions, concerns, or bugs you find.   Your help with beta testing allows us to release new features even faster.

Thanks. We look forward to your feedback! :)

Dave Edis - Senior Developer
interactivetools.com

I just ran a test and updated an existing test project, which went from 0.12 seconds on the welcome screen to 13.05 seconds. This is very slow. Every screen change now takes 13 seconds to load.

Although the ini files were converted to schema.php, the old infiles were not deleted. I manually deleted the ini files, but it did not impact the time.

No entries in the developer log to help troubleshoot.

I did find one thing, though. There were old sample data files in the schema directory that I manually deleted, which took 3 seconds off the load time. They existed in the old data/schema directory, which only took .12 seconds to load.

Browser Dev Tools does not show anything useful

Jeff Shields
yaadev.com

Hi Jeff, 

Thanks for the feedback; it's very useful.

We're looking into some issues where existing plugins might be causing some all the schema files to be re-checked and re-generated on each page view, which is slow.    I'll post here as soon as we have a fix.

If possible, can you try temporarily disabling all the plugins and see if it's still slow? 

Dave Edis - Senior Developer
interactivetools.com

You are correct; it is the plugins. I deleted them all; now it is only .01 seconds, as predicted.

Jeff Shields
yaadev.com

Okay, great, thanks for checking.  We'll work on a fix for the plugins issue.

Dave Edis - Senior Developer
interactivetools.com

Hi All, 

Thanks for all the quick feedback via forum and email.  We've released beta 2 here: 
https://interactivetools.com/download/

We've also released an updated Permalinks plugin that is optimized for this new version (click download beta here): 
https://interactivetools.com/plugins/permalinks/

Feel free to give it a try or read on for technical details... 

We've added a notice (visible to admins only) "Checking for database schema updates..." at the top of: CMS Setup > Database.  This is the program checking the schema files and making any needed MySQL updates.  We've previously automatically done this on the login screen, database menu, and when called by plugins that are updating files, but we're making it more obvious for admins.  

Also, when plugins add schemas it will display (for admins): Checking for database schema updates... (initiated by plugin_name.php:123). So, if you're seeing that more than once, you can check that plugin and line number to ensure the plugin isn't running unneeded database updates.  Some plugins (ours included) were running their setup code more frequently than they needed to.

We've also added a new plugin hook, "plugin_menu_init" to make it easy to run setup code on the plugin menu.  You can see some sample code from the latest permlinks here, which double-checks its setup on the plugin menu and when it's activated.  

// on plugin active, or plugin menu - ensure schema is created
addAction('plugin_activate', 'permalink_cms_onInstallCreateSchemas',  null, 1);
addAction('plugin_menu_init', 'permalink_cms_onInstallCreateSchemas',  null, 0);

Give it a try and let me know any questions or bugs you find!  Also, remember to check the before/after times on the homepage if you can and let us know!

Thanks!

Dave Edis - Senior Developer
interactivetools.com

My original problem with slow loading was traced to a data entry error in the Security settings login timeout.

#24 - Warning: A non-numeric value encountered
/Volumes/J/test/html/www/cmsb/lib/login_functions.php on line 21
https://test.yaa.test/cmsb/admin.php?menu=admin&action=security

I unintentionally had an extraneous character in the 'advanced'.'login_expiry_limit' => '30`', when I removed the extra tick, speeds were back to normal. It appears that the entry was not validated as a number.

Jeff Shields
yaadev.com

Hi Jeff, 

The menu order functionality in the schema system works as follows:

  • loadSchema() doesn't include or load the __menu_order.php fields
  • Your plugins that detect 'menuType' should continue to work as is
  • Your plugins that check for 'menuHidden' might need some fallback code as we only save that if it's set.  e.g., if (!empty($schema['menuHidden'])) { // won't error if it's undefined
  • While loadSchema() doesn't call or load that file, saveSchema() ensures SchemaMenuOrder::refreshCache() is called which regenerates __menu_order.php with any updates.
  • The __menu_order.php file is only used to generate the CMS menu and store the menu sort order

The main changes to be aware of:

  1. The system no longer saves blank value or default fields in schema files, making schemas much smaller
  2. When checking fields, you might need to provide fallback values: $schema['city']['fieldPrefix'] ?? ''
  3. Menu order is now stored in __menu_order rather than in the schema files
  4. Field order is now determined by schema file order rather than $fieldSchema['order'] fields

For the non-numeric value issue, I added a type cast "(int)" to force it to be an integer if that comes up for anyone in future: 

function loginExpirySeconds(): int {
    // get session expiry in seconds
    $limit      = (int) settings('advanced.login_expiry_limit');

This will prevent similar problems in the future by forcing the value to be an integer if it happens for anyone else in future.

Great feedback and questions.  Let me know if you encounter any other issues!

Dave Edis - Senior Developer
interactivetools.com

What would you suggest to get the schema for myTable i.e. loadSchema('myTable') and the menuHidden from __menu_order.php?  I see several ways this could be done, but what would be the best approach?

Jeff Shields
yaadev.com