CMSB v3.75 Beta (DB Performance, Debug Footers, and ZenDB)
6 posts by 2 authors in: Forums > CMS Builder
Last Post: Monday at 8:39pm (RSS)
By Dave - November 26
Hi everyone,
We've released a beta of version 3.75! This update has an interesting mix of new features:
- Uploads Table: We've optimized the database and added indexes for faster performance (10x faster or more for large databases)
- Upload Counts: Upload fields are now stored in MySQL and store a count of uploads for that record, so you can now easily search for records with uploads if you need to
- CMS Debug Footers: This is for plugin developers. If you're logged in as an admin, you can view-source on any page in the CMS, scroll to the bottom, and see a list of PHP files included and plugin hooks called on each one. This makes it a lot easier to find where to "hook in" to the CMS on a given page when you're writing a plugin
- Web Debug Footers: We're often debugging client websites and searching for what files are being included to build a page. This is especially true when using permalinks and the URL doesn't necessarily even correlate to the php files. If you are logged in to the CMS as an admin, you can now add ?__debug (or &__debug) to the query string of any front-end page and see some debug info and a list of included files in the footer. Here's an example from our front page:
<!-- DEBUG FOOTER (visible to admins only)
CMS Version: 3.75 (build 2805)
Memory Usage: 819.02 KB (peak: 919.51 KB)
Execution Time: 0.006 seconds
Included Frontend Files (3):
/var/www/vhosts/interactivetools.com/httpdocs/index.php
/var/www/vhosts/interactivetools.com/httpdocs/_init.php
/var/www/vhosts/interactivetools.com/httpdocs/_footer.php
-->
This lets us quickly track down the files we need to edit or update, saving time on every project.
- ZenDB Updates: ZenDB now uses SmartArray and SmartString. This makes it incredibly easy to write some simple, compact, and powerful code. We've had to make a backwards incompatible change to make this work, though. So if you are using SmartArrays already, you need to change ::new() to :newSS(). SmartArray::new() creates a SmartArray with regular values, whereas SmartArray::newSS() returns SmartStrings for values. And don't worry if none of that makes sense, we'll automate and simplify it over time. But rest assured we have some incredibly powerful new tools we're rolling out.
- SmartArray and SmartString docs: You can find them here:
- ZenDB ->load() method: ZenDB can now load associated records from any of these field types: createdByUserNum, updatedByUserNum, upload fields, list field, and foreign key fields. Here's an example with some of the above libraries all working together:
$articles = DB::select("articles", "LIMIT 10"); // SmartArray of articles
$latestArticle = $articles->last(); // Get last article
$latestArticle->debug(); // show debug info
// Output:
//[
// 'num' => 25,
// 'createdDate' => '2024-11-12 22:04:28',
// 'createdByUserNum' => 0, // ->load('createdByUserNum') for more
// 'name' => 'Sample Article title',
// 'categoryId' => "\t12\t36\t22\t", // ->load('categoryId') for more
// 'uploads' => 12, // ->load('uploads') for more
// 'authorId' => 231, // ->load('authorId') for more
// ]
// You can now call ->load() to load additional records:
foreach ($latestArticle->load('uploads') as $upload) { /* show uploads */ }
$latestArticle->load('authorId')->fullname; // get author name
// Or even use these values in strings:
foreach ($articles as $article) {
echo "$article->title by {$article->load('authorId')->fullname}\n";
}
The property format (e.g., $article->title) is much cleaner and simpler than what you'd typically have to write with {$article['title']}. The rule with properties is you don't need {braces} with basic $var->property access, only if you're adding more on (like the load query above).
We've done this in such a way that nothing is loaded until you need it (to minimize load on the database) and when you load() something it loads and caches associated records, but not everything. So in the above examples, it would load authors for the 10 articles on the page, so only one database query is required.
Lots of new things there so feel free to post any questions or feedback!
The full changelog for this release is as follows:
*** November 26, 2024 - Version 3.75 (Debug Footers and DB performance)
SERVER REQUIREMENTS (Since Dec 2023): PHP 8.0+ and MySQL 5.7+ (or MariaDB 10.2+)
NEW FEATURES
- Uploads Table: Optimized database and added indexes for faster performance (up to 10x faster for large databases)
- Debug Footers: Added admin debug footers (HTML comments with page/system info for troubleshooting)
- Frontend: Add ?__debug to URL to see exec time, memory usage, and included files
- CMS Admin: View source to see loaded menu files and plugin hooks available on any page
- ZenDB: Added new $results->load('field') method loads records for uploads, createdByUserNum, and other list fields
- ZenDB: Added :: as an alternative alias for inserting table prefixes
MINOR CHANGES
- Database Editor UI: Add colored labels for MySQL Type column and display non-utf8mb4 charsets (if present)
- Upload fields: Columns now store a count of the uploads (for database queries)
- Programmers: Added utility functions: explodeTSV(), implodeTSV() and inTSV() for parsing multi-value list field values
- ZenDB: Results are returned as SmartArrays and SmartStrings for advanced array and string manipulation
BUG FIXES
- PHP 8.4 compatibility fixes
- Database Editor: Added option to bypass errors when unable to automatically apply schema updates
- Single Record Menus: Fixed issue where previous uploads weren't showing up in upload browse list
- Minor UI fixes for field and label spacing and alignment
- 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 beta testing allows us to release new features even faster.
Thanks, we look forward to your feedback! :)
interactivetools.com
By Deborah - November 27
Hi, Dave.
I uploaded this beta over a v3.74 (release). I cannot access the login page and am seeing the error below. I uploaded twice and verified that the /vendor/composer/ directory files are all there.
-------------
PHP Fatal error: Uncaught Error: Class "ComposerAutoloaderInit097176c782d72c531cf2be6669039213" not found in /home/tstbdgweb/public_html/cmsbbeta/vendor/autoload.php:25
Stack trace:
#0 /home/tstbdgweb/public_html/cmsbbeta/lib/init.php(96): require_once()
#1 /home/tstbdgweb/public_html/cmsbbeta/lib/init.php(45): Itools\Cmsb\setupAutoLoaderAndHelpers()
#2 /home/tstbdgweb/public_html/cmsbbeta/lib/init.php(27): Itools\Cmsb\init()
#3 /home/tstbdgweb/public_html/cmsbbeta/plugins/permalinks_1-12/permalinks/permalinks_dispatcher.php(12): include_once('/home/tstbdgweb...')
#4 {main}
thrown in /home/tstbdgweb/public_html/cmsbbeta/vendor/autoload.php on line 25
-------------
This is just a test site, but I wanted to report it in case it's not "just me".
"10X faster" is quite an achievement! I'm looking forward to that.
Thanks!
Deborah
By Dave - November 27
Hi Deborah,
Thanks for the report!
Can you confirm that you're accessing the CMS directly and not through a Permalinks URL? I see a reference to permalinks in the call stack.
But feel free to fill out a second-level support request here and I'll check it out, that's a interesting error: https://interactivetools.com/support/request/
Thanks!
interactivetools.com
By Deborah - November 27
Dave, I am using the standard admin.php login URL. I had Permalinks plugin active, but am not using it.
I removed the Permalinks plugin, removed it from the site's htaccess, and from the activePlugins list. Still seeing the CMSB "An unexpected error occurred".
There have been no additional written to the main PHP error log after the one I sent you, so that error may have happened only during installation.
I toggled phpHideErrors off in settings.dat.php. Now when I load the admin page, I see this: "MySQL Error(1170): BLOB/TEXT column 'mediaNum' used in key specification without a key length".
If this is only happening for me, then perhaps something's not right with my database. Too many tests?
~ Deborah
.
By Dave - November 27
Hi All,
We've released an updated beta with all reported bugs fixed here: https://interactivetools.com/download/
Thanks!
interactivetools.com
By Dave - Monday at 8:39pm
Hi All,
We're working on another beta update and will post it shortly.
interactivetools.com