[BUG]: JCB Items "Checked Out" #1194
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What Happened?
I noticed with my dev site I've been working on, and installed a fresh install of Joomla 5.1.1, installed JCB 5.0.3, and JCB rows in tables are checked out according to System --> Global Checkin. Even components that I create using JCB, and install, show as records as checked out as well.
Steps to reproduce the Bug
Install Joomla 5.x, install JCB 5.0.3, navigate to System --> Global Checkin. At last count there we 673 JCB items checked out, and are unable to check back in.
Which Joomla version are you compiling in?
5.2.2
Which PHP version are you compiling in?
8.2.21
Which Joomla versions are you targeting?
5.x
Which PHP version are you targeting?
8.2+
Which Web server is JCB running on?
Apache/2.4.59 (Debian)
Which Relational Database is JCB running on?
11.4.2-MariaDB-ubu2404
Which OS is JCB running on?
Ubuntu 22.04.4 LTS
Which JCB version are you using?
v5.0.3
Where in JCB did this issue occur?
Installation of a component, Installation JCB pkg
On which browsers did you encounter the issue?
Firefox
Additional Comments
Looking at Joomla tables, checked_out is set to NULL, default NULL. When an item is checked out, it looks like the item is checked out with the Joomla user ID from the user table. When the user closes (checks in) the item, the checked_out field reverts to NULL.
In JCB the checked_out field correctly checks out by the Joomla user, but when the item is checked in, the checked_out field does not revert to NULL, but instead reverts to 0.
Manually changing checked_out from 0 to null in the DB clears the "issue" and no longer shows the item as checked out.
[BUG]: JCB Fields "Checked Out"to [BUG]: JCB Items "Checked Out"Thanks for your detailed explanation of the issue—it’s very helpful in pinpointing the problem.
After reviewing the current JCB behavior and Joomla's conventions, I noticed that JCB sets the
checked_out
field to0
as the default and reverts to0
upon check-in. However, Joomla’s expected behavior is for thechecked_out
field to revert toNULL
when an item is checked in as you pointed out.I will add the fix to this in the next update, and then bump this issue again for testing 👍
JCB v5.0.4-beta2 has now been updated to fix this issue.
I tested on a fresh install and it works. However, it appears that if upgrading an existing install of JCB, example have JCB 5.0.3 installed, and install 5.0.4-beta2, you will have to go through each DB table, update the field default value to null, then run an sql query to update the value in each row.
If the tables were updated to default=NULL, then Joomla checkin could check everything in with the push of a button.
I am not sure what you mean whit this statement, since this is exactly what we did in 5.0.4-beta2.
Look here is the code:
In the base table.
Here we act on this setting in the schema base checker.
This means it should happen during update of the JCB component automatically, if not I will need some help from your side... I will need more debugging information. Since we do not get the same issue, and would need to understand why it does not happen on your side.
I just tested, by creating a new Joomla Container in Octojoom for J!5.2.3. I then installed JCB 5.0.3.
I checked the DB and checked_out in JCB fields was Null Yes, Default 0.
After that, I installed JCB 5.1.0-rc1, and after install those fields appear to be unchanged. I have checked several fields.
Can you give me the generated mysql and BaseTable.php (for Joomla 5)? here is what I get.. see install zip.
The more, if I check the table file that runs an update (checking the table schema) here is that file... see that basetable zip.
These are the only two file I know that effect the database during the installation and both these do not set the field default to
0
It appears that the SQL may be correct, but I do see a difference between the demo basetable.php file, and the basetable.php file for VDM.
These differences are apparent in all of the components that I have.
I did some additional testing by creating a new Joomla install, and installing JCB 5.1.0.
From a FRESH install, JCB appears to create BaseTable.php correctly, but from an install where an extension is already installed, BaseTable.php is not getting updated (corrected).
The attached ZIP has 2 BaseTable.php files. The one titled BaseTable(existing).php is from my existing install, where BaseTable.php is from a fresh install of JCB.
Why Joomla Component Installation May Not Overwrite Existing Files & Possible Solutions
The issue where some files do not get updated during a Joomla component installation can arise due to several possible reasons. Since we do not experience this issue on our systems, it makes it difficult to debug directly, but based on experience and past reports in the Joomla and JCB communities, we can outline the most likely causes and solutions.
1. File System & Permission Issues
If Joomla successfully installs new files but fails to overwrite existing ones, it could be due to file system restrictions.
Possible Causes:
root
or another web user), Joomla (running underwww-data
orapache
) may not have permission to overwrite them.444
or400
) that prevent modification.Solutions:
Check File Ownership:
If files are not owned by the web server user, change ownership:
Check File Permissions:
If files are set to
444
(read-only), update permissions:Ensure No File Locks Exist:
If a process is using the file, restart the web server:
2. Hosting Environment Restrictions (CloudLinux, cPanel, or Security Policies)
Many hosting providers use security layers like CloudLinux CageFS, Imunify360, or ModSecurity that can prevent Joomla from modifying certain files.
Possible Causes:
Solutions:
Check for Immutable Files:
If a file has the
i
attribute, remove it:Temporarily Disable Hosting Security Features (If Allowed by Hosting Provider):
If using cPanel, disable ModSecurity via the hosting control panel.
3. OPcache Not Refreshing Updated PHP Files
While OPcache does not affect the physical presence of files, it can cause outdated PHP code to be executed instead of the updated version.
Possible Causes:
Solutions:
Manually Clear OPcache:
Access this file in the browser, then delete it.
Restart PHP-FPM (If Using Nginx/PHP-FPM):
Adjust OPcache Settings in
php.ini
:Then restart Apache/Nginx:
4. Joomla Installer Process Not Completing Successfully
Joomla’s
JInstaller
process is responsible for copying files and updating the database. If an issue occurs during installation, some files may not be updated.Possible Causes:
/tmp
) is not writable.JInstaller
fails silently due to an incomplete or corrupted installation package.Solutions:
Check Joomla’s Temporary Directory Permissions:
/tmp
directory is writable:Use Joomla’s "Discover" Feature:
Manually Replace Files (If Necessary):
If Joomla does not overwrite files, manually extract the component’s
.zip
file and copy the files to the correct location.5. Alternative Approach: Uninstalling and Reinstalling JCB (With Backup)
If all else fails, an alternative (but more complex) approach is to uninstall and reinstall JCB while preserving the database.
Steps to Safely Uninstall JCB:
Backup JCB Database Tables:
Ensure you save all JCB-related tables before proceeding.
Uninstall JCB from Joomla Extensions Manager.
Restore the Old JCB Database Tables:
Reinstall JCB and Let It Auto-Update the Database.
This method ensures that JCB’s database remains intact while resolving potential conflicts in the file system.
Conclusion
The fact that the files physically remain unchanged after installation suggests an issue at the file system level rather than Joomla itself. The most likely causes are:
Recommended Steps for the Client:
chown
,chmod
).lsattr
,lsof
).This issue has not been observed on our systems, making it difficult to reproduce, but these solutions should help resolve it efficiently.
I guess I should update. There isn't any issue(s) with installing/updating the component. The issue is with the compiled component.
Steps:
I even tested by creating a new site, installed the SQL, then installed JCB 5.1.0, and same issue.
Attached is the JCB SQL
OK, I have done some ADDITIONAL debugging, and I can get my component to compile correctly. Here's what I did. I don't think this is a "good" upgrade path at this point.
Export the following fields:
componentbuilder_admin_fields
componentbuilder_admin_fields_conditions
componentbuilder_admin_view
componentbuilder_component_admin_views
componentbuilder_component_config
componentbuilder_component_files_folders
componentbuilder_component_site_views
componentbuilder_dynamic_get
componentbuilder_joomla_component
componentbuilder_layout
componentbuilder_site_view
Uninstall JCB, then import these field back into the DB
Next, you need to edit the install.mysql.utf8.sql file within joomla__Component-Builder__5.x.zip file in the JCB package. Remove any of the insert statements for the tables listed above. Re-package the files, then install JCB.
There "appears" to be something with a JCB table that was updated, but isn't being updated when exporting all JCB fields, uninstalling, re-importing, then installing JCB. Doing it this way required changing all of the INSERT INTO statements to REPLACE INTO, otherwise it resulted in duplicate errors.
Still debugging. Slowly narrowing down the issue.
Due to another job, I only have a limited number of hours per week to do anything with JCB, so it's been slow.
OK, it doesn't actually appear to be related to DB tables. I thought it odd that it might have, since fields like checked_out are added by JCB in the code.
However, even after exporting DB, uninstalling JCB, import DB, then reinstall JCB (after removing all insert statements for the component, or it will error), components compiled are STILL compiling with BaseTable.php having default => 0 for checked out. I've looked at libraries/vendor_jcb/VDM.Joomla/src/Abstraction/BaseTable.php and it looks like it's correct there.
I know that the compiler is very complex. Is there somewhere that I could start looking where the compiler might be pulling that old outdate information for the BaseTable? Is it utilizing Joomla Powers, or Powers to do this? Something else?
I finally "gave up" trying to track down the issue, so I ended up installing a new instance of Joomla, fresh install of JCB, and completely rebuilt my component, and now it is working correctly. There would appear to be something in my old build that was causing the error, but what it is eludes me currently.
@mwweb the new version (5.1.1) of JCB comes with the new packager engine, and I would hope will allow more freedom to move around our extensions between JCB instances.
I will add you to the pre-test repo, so you can get early access to what we are working on (before we push it public)... it nearly ready for the next release, its a massive step forward.
This means we now have a new way to move snippets and all entities, I really think this way is far better than we had in J3, there is still much fin tuning to do. But we are nearly there...
The packaging engine is here: Official Announcement