{"action":"created","issue":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/9332","repository_url":"https://api.github.com/repos/joomla/joomla-cms","labels_url":"https://api.github.com/repos/joomla/joomla-cms/issues/9332/labels{/name}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/9332/comments","events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/9332/events","html_url":"https://github.com/joomla/joomla-cms/pull/9332","id":139030025,"number":9332,"title":"Make installer handle comments and utf8mb4 downgrade in sql queries from files","user":{"login":"richard67","id":7413183,"avatar_url":"https://avatars.githubusercontent.com/u/7413183?v=3","gravatar_id":"","url":"https://api.github.com/users/richard67","html_url":"https://github.com/richard67","followers_url":"https://api.github.com/users/richard67/followers","following_url":"https://api.github.com/users/richard67/following{/other_user}","gists_url":"https://api.github.com/users/richard67/gists{/gist_id}","starred_url":"https://api.github.com/users/richard67/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richard67/subscriptions","organizations_url":"https://api.github.com/users/richard67/orgs","repos_url":"https://api.github.com/users/richard67/repos","events_url":"https://api.github.com/users/richard67/events{/privacy}","received_events_url":"https://api.github.com/users/richard67/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/joomla/joomla-cms/labels/PR-staging","name":"PR-staging","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-03-07T16:51:07Z","updated_at":"2016-03-07T17:40:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/9332","html_url":"https://github.com/joomla/joomla-cms/pull/9332","diff_url":"https://github.com/joomla/joomla-cms/pull/9332.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/9332.patch"},"body":"Pull Request for Issue #9331 , but not only for this.\r\n\r\n#### Summary of Changes\r\n\r\nThis PR makes libraries/cms/installer/installer.php handle correctly comment lines and query downgrade from utf8mb4 to utf8 in sql statements read from schema update files or other sql files.\r\n\r\nBecause the database driver in use may still be the old one, it has local implementations of functions for this purpose, same as it was done by @wilsonge in his PR #9297 for administrator/components/com_admin/script.php.\r\n\r\n**This PR does not solve the problem that after update with Extension Installer, the utf8(mb4) conversion is not done and has to be done using the database \"Fix\" button.**\r\n\r\n#### Testing Instructions\r\n\r\n**Update to Beta 5** using one of the following custom URLs for the **Joomla! Update component**, depending on the version to be updated:\r\n\r\n- 3.x to 3.5.0-beta5: [https://downloads.joomla.org/updates/cms/test/list_test.xml](https://downloads.joomla.org/updates/cms/test/list_test.xml)\r\n- 2.5.x to 3.5.0-beta5: [https://downloads.joomla.org/updates/cms/test/list_test_25to3x.xml](https://downloads.joomla.org/updates/cms/test/list_test_25to3x.xml)\r\n\r\nAfter successful update, check in log/joomla_update.php the log entry containing the text \"update\tRan query from file 3.5.0-2016-02-26\". It shows the start of an sql statement beginning with comment lines as follows:\r\n\r\n> Query text: -- -- Create a table for UTF-8 Multibyte (utf8mb4) conversion for MySQL in -- or.\r\n\r\nNow check \"Extensions -> Manage -> Database\". It should look as follows:\r\n\r\n> Database table structure is up to date. \r\n\r\n> Database schema version (in #__schemas): 3.5.0-2016-03-01.\r\nUpdate version (in #__extensions): 3.5.0-beta5.\r\nDatabase driver: mysqli.\r\n93 database changes were checked successfully.\r\n145 database changes did not alter table structure and were skipped.\r\n\r\nIn case of a MySQL database server not supporting utf8mb4, no SQL error message about invalid character set was shown.\r\n\r\nNow repeat the same procedure with following custom URLs for **updating to Beta 5 + this PR with Joomla! Update component**:\r\n\r\n- 3.x to 3.5.0-beta5 + this PR: [http://test5.richard-fath.de/list_test1.xml](http://test5.richard-fath.de/list_test1.xml)\r\n- 2.5.x to 3.5.0-beta5 + this PR: [http://test5.richard-fath.de/list_test1_j25.xml](http://test5.richard-fath.de/list_test1_j25.xml)\r\n\r\n**Result:**\r\n\r\nThe logged sql query start with text \"Ran query from file 3.5.0-2016-02-26\" looks now like following, comment lines have been removed\r\n\r\n> Query text: CREATE TABLE IF NOT EXISTS `#__utf8_conversion` (   `converted` tinyint(4) NOT N.\r\n\r\nDatabase structure is up do date as shown for test with unpatched Beta 5.\r\n\r\nIn case of a MySQL database server not supporting utf8mb4, no SQL error message about invalid character set was shown.\r\n\r\nNow test **update to Beta 5 + this PR using the Extension installer**.\r\n\r\nThe patched package you can find here: [http://test5.richard-fath.de/Joomla_3.5.0-beta5-Beta-Update_Package_test1.zip](http://test5.richard-fath.de/Joomla_3.5.0-beta5-Beta-Update_Package_test1.zip \"http://test5.richard-fath.de/Joomla_3.5.0-beta5-Beta-Update_Package_test1.zip\")\r\n\r\nAfter successful update, go to \"Extensions -> Manage -> Database\".\r\n\r\n**Result:**\r\n\r\nThe utf8mb4 or utf8 conversion is shown as to be done.\r\n\r\nUse the \"Fix\" button to perform the conversion.\r\n\r\n**Result:**\r\n\r\nDatabase is up to date as shown above for the tests before.\r\n\r\n**Hint on which database serves not support utf8mb4:**\r\n\r\nEither server version lower than 5.5.3,\r\n\r\nor if mysqlnd client, this has a version lower than 5.0.9, or\r\n\r\nother client has version lower than 5.5.3."},"comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments/193364519","html_url":"https://github.com/joomla/joomla-cms/pull/9332#issuecomment-193364519","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/9332","id":193364519,"user":{"login":"richard67","id":7413183,"avatar_url":"https://avatars.githubusercontent.com/u/7413183?v=3","gravatar_id":"","url":"https://api.github.com/users/richard67","html_url":"https://github.com/richard67","followers_url":"https://api.github.com/users/richard67/followers","following_url":"https://api.github.com/users/richard67/following{/other_user}","gists_url":"https://api.github.com/users/richard67/gists{/gist_id}","starred_url":"https://api.github.com/users/richard67/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richard67/subscriptions","organizations_url":"https://api.github.com/users/richard67/orgs","repos_url":"https://api.github.com/users/richard67/repos","events_url":"https://api.github.com/users/richard67/events{/privacy}","received_events_url":"https://api.github.com/users/richard67/received_events","type":"User","site_admin":false},"created_at":"2016-03-07T17:40:17Z","updated_at":"2016-03-07T17:40:17Z","body":"ahhh these ... yes!!! I was in the other sql file in mind :smile: I add this to my pr and update my zip, stay tuned until i report here done."}}