Egnarts94 / JEM-Project

JEM - an Event Manager for Joomla
0 stars 2 forks source link

Way to Joomla 4 - JError #45

Closed Egnarts94 closed 5 years ago

Egnarts94 commented 5 years ago

One of the first problems on installing JEM on J4 is the JError Class. It does not exist anymore, we need to replace all JError calls. See: https://joomla.stackexchange.com/questions/15973/how-to-catch-an-error-in-joomla-3-5-alternative-to-jerror and https://api.joomla.org/cms-3/classes/JError.html#method_raiseError -> raiseError, raiseNotice and raiseWarning - there you can find what is the suggested way to replace JError.

@depebo would you like to begin replacing JError in a correct (Joomla-like) way? Eventually we can find some information what other components did for that.

depebo commented 5 years ago

@Egnarts94 ok, working on JError replacement next using my branch.

depebo commented 5 years ago

Replaced all JError:: instances with either \Joomla\CMS\Factory::getApplication()->enqueueMessage(JText::_('COMJEM'), 'notice'); or \Joomla\CMS\Factory::getApplication()->enqueueMessage(JText::_('COMJEM'), 'warning'); or \Joomla\CMS\Factory::getApplication()->enqueueMessage(JText::_('COMJEM'), 'error'); or throw new Exception($msg, $code); based on content. Also, replaced JString with \Joomla\String\StringHelper and JArrayHelper with \Joomla\Utilities\ArrayHelper

depebo commented 5 years ago

@Egnarts94 @jojo12 could you please test and let me know if you come across any issues. Install can be downloaded from here http://wikisend.com/download/667320/pkg_jem_v2.3.0-dev4.7.zip

jojo12 commented 5 years ago

@depebo: installed on Joomla! 3.9.8 over JEM_v.2.3-dev4.1, installation ok, quick going through: no problem! installed on Joomla! 4.0 alpha 9:

depebo commented 5 years ago

@jojo12 thanks. It is the version check in pkg_install.php, will update it tomorrow. If you have time you can change line 35 in file pkg_install.php from '4.0' => '', // Not supported to '4.0' => '4.0.0-alpha9', // Not supported save inside zip and try install again.

depebo commented 5 years ago

@jojo12 please try this build, I have not uploaded the changes to git https://filebin.net/dzq4on2lv2h046lx

jojo12 commented 5 years ago

tried to install pkg_jem_v2.3.0-dev4.8.zip on a clean 4.0.0 alpha 9: got the following: jemalpha9test

depebo commented 5 years ago

Thanks @jojo12 It would have been too easy if updated JEM would install on version 4 straight away. There is clearly more work needs to be done (in addition to replacing deprecated classes/functions) before JEM can run on version 4. This is what I was talking about few months ago on forum - JEM for version 4 needs to be properly architectured. Might need to start from scratch? I will install version 4 later today and see if I can debug those errors, will post an update here.

depebo commented 5 years ago

@jojo12 @Egnarts94 update...

I have spent few hours today on this: by disabling preflight check I have manged to bring com_jem into version 4 alpha 9. None of JEM forms would open due to various errors:

Control Panel, Help An error has occurred. 500 JHtml sliders not found. JROOT/administrator/components/com_jem/views/main/tmpl/default.php:102

Events, Venues, Categories, Groups An error has occurred. 0 Call to undefined method Joomla\CMS\Access\Access::getActions() JROOT/administrator/components/com_jem/views/events/view.html.php:100

Settings An error has occurred. 500 JHtml tabs not found. JROOT/administrator/components/com_jem/views/settings/tmpl/default.php:399

Have made changes to 3 views: Settings, Event, Control Panel, so they at least open, would not save anything though.

Tried to implement same changes back to version 3.9.8 - errors due to those methods from version 4 not available in 3.9.8. If this will be the same in 3.10 - then to maintain backward compatibility we'll have to keep 2 code bases (v3. and v4.).

Here is a link for install (com_jem only, no modules or plugins) if you want to install on your version 4 alpha: http://wikisend.com/download/348612/com_jem_only_v2_3_0_dev4.8.zip

Comments and views are welcome, there is a decision to be made on how to proceed with JEM for Joomla! 4.

jojo12 commented 5 years ago

Many thanks for your works! EDIT: I installed your com_jem on Joomla 4 alpha 9, installation ok. Will go through, when I have time!

jojo12 commented 5 years ago

Interesting what happens:

Load sampledata: 0 Class 'JArchive' not found Help: 500 JHtml sliders not found. Settings: ok Housekeeping: ok Updatecheck: ok Importdata: 1146 Table 'joomla40.q5rjm_eventlist_attachments' doesn't exist Exportdata: 0 Call to undefined method Joomla\Database\Mysqli\MysqliDriver::getErrorNum() Css-Manager: 0 Call to undefined method Joomla\CMS\Access\Access::getActions() Categories: 0 Call to undefined method Joomla\CMS\Access\Access::getActions() Groups: 0 Call to undefined method Joomla\CMS\Access\Access::getActions() Venues: 0 Call to undefined method Joomla\CMS\Access\Access::getActions() Add Event: 0 Call to undefined method Joomla\Database\Mysqli\MysqliDriver::getErrorNum() Add Venue: 0 Call to undefined method Joomla\CMS\Access\Access::getActions() Add Categorie: 0 Call to undefined method Joomla\CMS\Access\Access::getActions() Add Group: 0 Call to undefined method Joomla\CMS\Access\Access::getActions()

Building menues: I can build Simple List Event Submission Venue Submission The rest gives an error

depebo commented 5 years ago

@jojo12 When you saying

Settings: ok

You mean that you can press menu JEM/Settings and view opens without errors, right? Because you cannot save any changes in it at the moment. There is alot of eventlist (J! versoin 1.x, 2.x) stuff that was kept for backward compatibility that begins triggering / kicking in (see your quote below),

Importdata: 1146 Table 'joomla40.q5rjm_eventlist_attachments' doesn't exist

that after few hours I gave up and considering now starting JEM for version 4 from scratch. As version 4 only. The current version will be ok for 3.x, but will not upgrade. Personally, all JEM pre-version 3 functionality should be deprecated (nobody should be running J1 v1 or v2 by now).

What do you think: between three of us (you, me and @Egnarts94) we should be able to create JEM V4, using principals of current JEM?

jojo12 commented 5 years ago

You're right. My question is: are the problems because JEM is always holding the version for Joomla! 2.5? Could there be a version which is (only for Joomla! 3 and Joomla! 4? My problem is: until now I was a very actif user, so I made a lot of proposals to make JEM better. And I have the grace to find a lot of hidden mistakes. But until now I am a very bad programmer. More an adapter!

depebo commented 5 years ago

@jojo12

are the problems because JEM is always holding the version for Joomla! 2.5?

Yes, some of errors I saw were directly related to JEM not understanding J!4 and falling back onto initial JEM version "eventlist".

Could there be a version which is (only for Joomla! 3 and Joomla! 4?

Currently, you will have maintain 2 versions in code base, as far I can see. There may be a compatibility layer in J!3.10 to assist, but I have nothing to confirm that. Personally, I think all JEM code supporting earlier J! version (J! < 3) should be dropped from the next JEM. Decision to be made whether we are going to have one JEM with 2 code bases (J!3.x and 4.x) or start JEM for version J!4 from fresh. If anyone wants to use JEM in J!3 they will use current version or upgrade to J!

And I have the grace to find a lot of hidden mistakes

This is very useful, thank you for your feedback. Testing is very underrated, but hugely appreciated activity. @Egnarts94 - any comment?

Egnarts94 commented 5 years ago

Sorry for my late response @depebo and @jojo12 . Thank you for hours of your freetime you have invested to get more information about upgrading to J4. Without testing you work myself, I am not a friend of doing it from scratch because you will always loose features and will also take a lot of time. My preferred way would be to remove <J3 compatibility and update JEM to be compatible to J3 and J4. As far as I understood in this discussion, this could be possible? Or do you think it needs more time to update JEM instead of building it new from scratch?

Thinking on Bluefox, who was creating a JEM for J3 but never gets finished... So I am scared this could happen in our project.

depebo commented 5 years ago

do you think it needs more time to update JEM instead of building it new from scratch?

I think yes: it will take more time to remove <J3 code from JEM models, views and controllers. And then clean it up, make it J3 & J4 compatible and test it. Hence my proposal to start J4 JEM as a separate project and only bug fix J3 JEM. Having said that, this should be a steering group's decision by people who will actually do the work. Personally, I am happy to assist, but have not got enough expertise to lead this J4 JEM development.

Thinking on Bluefox, who was creating a JEM for J3 but never gets finished... So I am scared this could happen in our project.

Agree, this a risk. The more people get involved the smaller this risk will be.

Egnarts94 commented 5 years ago

I think like you, I am neighter experienced enough to lead this development, nor I have the time for doing something more like bugfixes... So, what do we do?

depebo commented 5 years ago

I think for now we concentrate our efforts on bug fixes of current JEM, perhaps add feature or two, announce what is coming on forum and start making regular releases. There is a useful project on github called Joomla-Component-Builder, with help of which one can build J! components (well, at least all required MCV for front/back end). Once they convert to J4 we can use that to start on JEM for J4. We can spend current time (free from bug fixes and JEM2 features) to plan JEM J4 database and all required views, since we will have to do it in any case. This work can be done on in developers forum on jem site.

JKoelman commented 5 years ago

Thinking on Bluefox, who was creating a JEM for J3 but never gets finished... So I am scared this could happen in our project.

Nope, won't happen as you, @depebo, @jojo12 and Ernst are onboard. Next I'll assist where i can. Haven't been around much lately but think you've noticed a change lately.

Didn't finish as the decission was made to continue JEM2.x , so dropped my effort.. For JEM4.x i do like what @depebo meant. Meanwhile i've spend some time in adapting JEM2.3.0.-dev0.4.6 (component) to install in J4 and yep that's definately possible. As you've noticed a lot of code changes need to be made...

Another thing will be to track changes that are going to be made to JEM2.x. and see if it's relevant to include in JEM4.x. Also a goog thing will be to outline a roadmap (thing to be done, where to post, when to concentrate on what version etc...)