Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the Chrome console, there are errors indicating that the smilies files are not found. #193

Open
mckillo opened this issue Oct 5, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@mckillo
Copy link
Contributor

mckillo commented Oct 5, 2024

In Joomla 5.1.4 with PHP 8.2 and JComments 4.0.33, when I go the menu in the website, I have these errors in the browser console:

image

In this issue, there are 3 problems:

  1. In /media/com_jcomments/images/smilies folder, all smilies files have a .png extension.
  2. In the database, the _#_jcomments_smilies table contains all entries in the image field with a .gif extension in the smilies filename (except for the rolleyes.gif file, which is a gif image).
  3. In the smilies folder, there are 30 files, but the table contains only 18 entries, leaving 12 missing and 2 entries are old (dont' have files).

How to fix it:
Run in mysql these 3 scripts

  1. To change extension:
UPDATE #__jcomments_smilies
SET image = REPLACE(image, '.gif', '.png')
WHERE image != 'rolleyes.gif';
  1. Change datetime to NULL:
UPDATE #__jcomments_smilies
SET checked_out_time = NULL
WHERE checked_out_time = '0000-00-00 00:00:00';
  1. Adds rest of files missing:
DELETE FROM `#__jcomments_smilies` WHERE `a8wlc_jcomments_smilies`.`id` = 2;
DELETE FROM `#__jcomments_smilies` WHERE `a8wlc_jcomments_smilies`.`id` = 8;

INSERT INTO `#__jcomments_smilies` (`id`, `code`, `alias`, `image`, `name`, `published`, `ordering`, `checked_out`, `checked_out_time`) VALUES
(2, ':<3:', '',   'love.png', 'Love', 1, 2, 0, NULL),
(8, ':rofl:', '',  'rofl.png', 'Rofl', 1, 8, 0, NULL),
(19, ':angry:', '', 'angry.png', 'Angry', 1, 19, 0, NULL),
(20, ':blush:', '', 'blush.png', 'Blush', 1, 20, 0, NULL),
(21, ':doh:',   '', 'doh.png', 'Doh', 1, 21, 0, NULL),
(22, ':dry:',   '', 'dry.png', 'Dry', 1, 22, 0, NULL),
(23, ':grin:',  '', 'grin.png', 'Grin', 1, 23, 0, NULL),
(24, ':happy:', '', 'happy.png', 'Happy', 1, 24, 0, NULL),
(25, ':huh:',   '', 'huh.png', 'Huh', 1, 25, 0, NULL),
(26, ':innocent:',  '', 'innocent.png', 'Innocent', 1, 26, 0, NULL),
(27, ':ironic:',  '', 'ironic.png', 'Ironic', 1, 27, 0, NULL),
(28, ':kiss:',  '', 'kiss.png', 'Kiss', 1, 28, 0, NULL),
(29, ':love:',  '', 'love.png', 'Love', 1, 29, 0, NULL),
(30, ':ninja:',  '', 'ninja.png', 'Ninja', 1, 30, 0, NULL);

The ids 2 and ,8 have been deleted because their image files don't exist.
Note: In these scripts, you must change '#_' for your prefix in Joomla database.

In the master, there are:

  • to update: Jcomments-4\component\administrator\install\sql\mysql\default.smilies.sql
  • to create a new SQL update (nex version 4.0.34): Jcomments-4\component\administrator\install\sql\updates\mysql\4.0.34.sql
@Globulopolis
Copy link
Collaborator

I'm not sure about these changes you made. If look at the smilies folder in new package you will see *.png(and one animated .gif) files. And update sql files at administrator/install/sql/updates/mysql/4.0.31.sql and administrator/install/sql/updates/mysql/4.0.33.sql that made updates.

@mckillo
Copy link
Contributor Author

mckillo commented Oct 6, 2024

I have installed version 4.0.33 without a previous version. When you install JComments v4.0.3, the installation script doesn't run the 4.0.33.sql file (this file only runs if there is a version update).

@mckillo
Copy link
Contributor Author

mckillo commented Oct 6, 2024

If you look at the table in the database, the smiley files (in the image field) are all GIFs, while in the smilies folder they are PNG files (except for one). I believe the Jcomments-4\component\administrator\install\sql\mysql\default.smilies.sql file should be updated with these changes for a clean installation.

@exstreme exstreme added the bug Something isn't working label Oct 6, 2024
@Globulopolis
Copy link
Collaborator

I have installed version 4.0.33 without a previous version. When you install JComments v4.0.3, the installation script doesn't run the 4.0.33.sql file (this file only runs if there is a version update).

Creating new sql update file as you suggested in first post doesn't make sense. I think this code must run in installer script.

@mckillo
Copy link
Contributor Author

mckillo commented Oct 6, 2024

Although I have worked with this extension in the past, I had to install it now for a client project . Honestly, I'm new to debugging this extension, so I don't have a deep understanding of its inner workings (I'll leave that to you). From what I've seen, I think what I've mentioned makes sense, but I'll try to explain it in more detail. Please keep in mind that my explanation may be wrong, because I don't know the layout of the code.

For this issue, I believe that two things need to be done for next version (4.0.34):

  • Update the Jcomments-4\component\administrator\install\sql\mysql\default.smilies.sql file for new installations of Jcomments 4.0.34
  • Create a new SQL update file -> Jcomments-4\component\administrator\install\sql\updates\mysql\4.0.34.sql to update JComments from 4.0.x to 4.0.34 (next version).

The code from the first post is a patch to be applied after installing version 4.0.33. not a patch of the file of package JComments.

Your install script pkg_jcomments.php, checks if there is any content in the #__jcomments_smilies table. If it doesn't find any, then it runs the SQL file (line 104) to: PATH_ROOT . '/administrator/components/com_jcomments/install/sql/mysql/default.smilies.sql. For this reason the default.smilies.sql must be update for the new installations.

I hope this helps clarify the previous explanation.
Thanks for applyling the patch to resolve it for the future version.

@mckillo
Copy link
Contributor Author

mckillo commented Oct 6, 2024

My assignment of id in some smilies (in my initial code) is different from the 4.0.33.sql update.

mckillo added a commit to mckillo/Jcomments-4 that referenced this issue Oct 6, 2024
Fix #_jcomments_smilies table contains all entries in the image field with a the files into smilies folder (29 png files + 1 gif file),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants