Page 1 of 1

Upgrade or rewrite Module for CMSMS 2

Posted: Wed Jul 10, 2019 11:28 pm
by chriszeu
Hey there,

it's been a (a very long) while, I wrote a module for a small non-profit-organisation. It ran under CMSMS 1.11.
I forgot about it, but now they upgraded to CMSMS 2 and wonder, why nothing works anymore ^-^
I didn't follow the changes around CMSMS all the years, but I want to help them by repairing the module.
Is there a way to get an overview about the necessary changes to the code?

Thanks a lot!

Re: Upgrade or rewrite Module for CMSMS 2

Posted: Wed Jul 10, 2019 11:58 pm
by calguy1000
There are several changes in the API's between CMSMS 1.11 and 2.2 (and more to come in the beta version)

Though you should be able to update your modules relatively easily with access to the error log.

The biggest changes are:
- We use multiple smarty templates, with scopes. So you cannot assume that a variable created in a module action template is available outside of that template.
- DON"T assume that $gCms is a global variable. though we do include it in scope for some things, you just can't assume that it's a global. Use cmsms() if you must.
- v2.0 removed the GetNotification... methods from the module API
- v2.0 removed a bunch of API methods that were deprecated in 1.12 or earlier. Even more stuff is deprecated now.
- v2.0 refactored the way that WYSIWYG and Syntax hilighter modules worked
- v2.0 broke admin themes.

i got this from the various threads in the announcements forum. Going as far back as the 2.0-beta1 announcement.

Note: The API documentation is reasonably up to date and lists most of the deprecated functions.

and to cover yourself for v2.3
- Make sure you aren't assuming paths to module files. Use GetModulePath() and GetModuleURLPath().
- Watch usage of $smarty->assign_by_ref()
- $this->smarty is gone out of the module api because of scopes.
- Modules that export content types cannot be lazy loaded.
- Prototypes to smarty plugins change because of newer versions of smarty.

---
if you have a specific question, just ask.

Re: Upgrade or rewrite Module for CMSMS 2

Posted: Thu Jul 11, 2019 9:27 am
by Rolf
Might help: viewforum.php?f=83

Re: Upgrade or rewrite Module for CMSMS 2

Posted: Thu Jul 11, 2019 9:08 pm
by chriszeu
Rolf wrote:Might help: viewforum.php?f=83
I know the forum - it is the one, we are writing in ;-)
But I didn't find I a topic addressing my question - did I miss something?

Re: Upgrade or rewrite Module for CMSMS 2

Posted: Thu Jul 11, 2019 9:17 pm
by chriszeu
calguy1000 wrote:There are several changes in the API's between CMSMS 1.11 and 2.2 (and more to come in the beta version)

Though you should be able to update your modules relatively easily with access to the error log.

The biggest changes are:
- We use multiple smarty templates, with scopes. So you cannot assume that a variable created in a module action template is available outside of that template.
- DON"T assume that $gCms is a global variable. though we do include it in scope for some things, you just can't assume that it's a global. Use cmsms() if you must.
- v2.0 removed the GetNotification... methods from the module API
- v2.0 removed a bunch of API methods that were deprecated in 1.12 or earlier. Even more stuff is deprecated now.
- v2.0 refactored the way that WYSIWYG and Syntax hilighter modules worked
- v2.0 broke admin themes.

i got this from the various threads in the announcements forum. Going as far back as the 2.0-beta1 announcement.

Note: The API documentation is reasonably up to date and lists most of the deprecated functions.

and to cover yourself for v2.3
- Make sure you aren't assuming paths to module files. Use GetModulePath() and GetModuleURLPath().
- Watch usage of $smarty->assign_by_ref()
- $this->smarty is gone out of the module api because of scopes.
- Modules that export content types cannot be lazy loaded.
- Prototypes to smarty plugins change because of newer versions of smarty.

---
if you have a specific question, just ask.

Thanks - that is a good point to start from!

Re: Upgrade or rewrite Module for CMSMS 2

Posted: Sat Jul 13, 2019 6:31 pm
by Rolf
chriszeu wrote:
Rolf wrote:Might help: viewforum.php?f=83
I know the forum - it is the one, we are writing in ;-)
But I didn't find I a topic addressing my question - did I miss something?

No, it is not the same board as the one we are in now...
It is a developers board in the CMSMS 2.0 beta board describing code updates to get modules ready for 2.0