User tests: Successful: Unsuccessful:
Currently the conversion to utf8mb4 or utf8 (because of changing standard do unicode sorting in collations) is executed on every run of the database schema fix, i.e. every time when in "Extensions -> Manage -> Database" the "Fix" button is clicked, regardless if there is anything shown to be fixed or not and regardless if the conversionalready has been preformed with success.
This PR changes that so the conversion is only run if the saved conversion status is not equal to what is expected according to the actual utf8mb4 support, which is also the condition to show the conversio to be done as a database problem, so if nothing shown nothing will be done, and if nothing to be done nothing shown.
Step 1: On a latest staging, edit file "administrator/components/com_installer/models/database.php" and go to the end of function "convertTablesToUtf8mb4". You will see following code as last statement in this function:
// Set flag in database if the update is done.
$db->setQuery('UPDATE ' . $db->quoteName('#__utf8_conversion')
. ' SET ' . $db->quoteName('converted') . ' = ' . $converted . ';')->execute();
Below this statement, means at the end of the function as last statement, add followng code:
JFactory::getApplication()->enqueueMessage('TEST', 'info');
Step 2: Go to "Extentions -> Manage -> Database". There should be no database problems shown.
Step 3: Click the "Fix" button.
Result: At the top an blue info box appears, showing the "TEST" message.
Step 4: Important: Close this info box (x button on top right corner of the message).
Repeat steps 3 and 4 a few times.
Result: Obviously function convertTablesToUtf8mb4 is performed with every click on the "Fix" button.
Step 5: Now apply this patch by replacing the file from edited in step 1 by the same file from this patch.
I am not sure if patchtester will correctly apply the patch after the editing in step 1, but you can try. Otherwise either undo the edit before using the patchtester, or exchange this 1 file "manually".
Step 6: Edit again the file edited in step 1, and again add this "TEST" message code line.
Step 7: Go again to "Extentions -> Manage -> Database", or if still there from previous test steps, refresh the page.
Step 8: Click the "Fix" button.
Result: The blue info message "TEST" does not appear.
Step 9: Execute following statement in sql for the tested database, e.g. in phpMyAdmin:
UPDATE
#__utf8_conversion
SETconverted
= 0;
(Replace "#__" by your db prefix.)
Step 10: Click the "Fix" button in "Extentions -> Manage -> Database".
Result: The blue info message "TEST" is shown at the top, i.e. if necessary the conversion is still performed with this patch.
At the end remove the hack for the "TEST" message if necessary from the restored file after reverting this patch.
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Labels |
Added:
?
|
I have tested this item successfully on f450688
Works as described.
@richard67 just a hint you can add markdown to prettify php/sql/javascript/etc code in github (see https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code)
Examples:
echo "php code";
JFactory::getApplication()->enqueueMessage('TEST', 'info');
UPDATE `#__utf8_conversion` SET `converted`= 0;
@andrepereiradasilva Thanks for test and hint. Regarding markdown: Well, I am just too lazy for learning that. Maybe another day.
I have tested this item successfully on f450688
Thanks for testing.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-03-06 20:37:25 |
Closed_By | ⇒ | wilsonge |
Milestone |
Added: |
Merged
Labels |
Removed:
?
|
Added testing instructions
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9312.