Page 1 of 1

News module not working after upgrade

Posted: Sun Nov 18, 2018 7:19 pm
by Daniel15
Hi,

I'm trying to upgrade a CMSMS installation for one of my old sites from 1.6.x to 2.x so that I can finally remove PHP 5 (it's one of the last sites that I haven't yet transitioned across to PHP 7). I followed the instructions in https://docs.cmsmadesimple.org/upgrading/old-versions to upgrade through 1.12.1, then I followed https://docs.cmsmadesimple.org/upgrading/to-cmsms-2.x to upgrade to the latest 2.x release.

Everything seems to have worked fine, except the "news" module isn't working properly. I see the news articles in the "news" section and they are all published with no expiry date. The page has this tag on it:

Code: Select all

{news number='5'}
And it's only rendering:

Code: Select all

<!-- Start News Display Template -->

<!-- End News Display Template -->
Any ideas?

----------------------------------------------

Cms Version: 2.2.8

Installed Modules:

AdminSearch: 1.0.4
CMSContentManager: 1.1.6
CMSMailer: 6.2.14
Captcha: 0.1.1
CmsJobManager: 0.1.3
Comments: 1.8.0
DesignManager: 1.1.4
FCKeditorX: 1.0.5
FileManager: 1.6.7
FilePicker: 1.0.3
MenuManager: 1.50.3
MicroTiny: 2.2.2
ModuleManager: 2.1.4
MovedPages: 0.1
Navigator: 1.0.9
News: 2.51.4
Printing: 1.1.2
Search: 1.51.5
ThemeManager: 1.1.8
TinyMCE: 2.8.4


Config Information:

php_memory_limit:
max_upload_size: 200000000
url_rewriting: mod_rewrite
page_extension: .htm
query_var: page
auto_alias_content: true
locale:
set_names: false
timezone: Australia/Melbourne
permissive_smarty: false


Php Information:

phpversion: 5.6.37-1~dotdeb+7.1
md5_function: On (True)
json_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_ALL: 22527
E_STRICT: 0
E_DEPRECATED: 0
test_file_timedifference: No time difference found
test_db_timedifference: No time difference found
create_dir_and_file: 1
memory_limit: 128M
max_execution_time: 30
register_globals: Off (False)
output_buffering: 4096
disable_functions: pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
open_basedir: /var/www/dansoftaustralia.net/:/tmp/
test_remote_url: Success
file_uploads: On (True)
post_max_size: 200M
upload_max_filesize: 200M
session_save_path: No check because open basedir active
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)
check_ini_set: On (True)
curl: On


Performance Information:

allow_browser_cache: Off (False)
browser_cache_expiry: 60
php_opcache: On (True)
smarty_cache: Off (False)
smarty_compilecheck: Off (False)
auto_clear_cache_age: Off (False)

Server Information:

Server Software: nginx/1.13.12
Server Api: fpm-fcgi
Server Os: Linux 4.17.0-1-amd64 On x86_64
Server Db Type: MySQL (mysqli)
Server Db Version: 10.1.29
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable

Re: News module not working after upgrade

Posted: Sun Nov 18, 2018 9:39 pm
by DIGI3
Try creating a new News Summary template, using the system default. If that works, then you can either modify it to include any customizations you had in your old one, or look through your old one to see what may have changed.

Re: News module not working after upgrade

Posted: Sun Nov 18, 2018 11:13 pm
by Daniel15
Thanks for the suggestion. I already restored everything from backup, but I'll try that the next time I attempt the upgrade.

Re: News module not working after upgrade

Posted: Mon Nov 19, 2018 5:42 am
by Daniel15
I just went through the upgrade process again. I tried creating new News::Summary and News::Detail templates, and unfortunately it didn't work. The news is still empty :(

Anything else I can try to debug this?

Re: News module not working after upgrade

Posted: Mon Nov 19, 2018 3:38 pm
by DIGI3
next steps I'd try are:
-check the error log for clues
-check the server time difference (see https://cmscanbesimple.org/blog/server-time-difference)
-put debug statements in between each section of the summary template, to see if it's failing on certain spots or just not returning anything from the variables (also to make sure you're editing the correct template)
-create a new news article

Re: News module not working after upgrade

Posted: Tue Nov 20, 2018 7:54 am
by Daniel15
Hey, thanks for the suggestion around using debug mode. That helped :)

I noticed this part of the SQL query was filtering out all my news articles:

Code: Select all

IF(start_time IS NULL AND end_time IS NULL,news_date <= NOW(),NOw() BETWEEN start_time AND end_time)
In my case, `start_date` was set to the same value as `news_date`, and `end_date` was null, so this was filtering everything out. I just unset `start_date` for all the news articles:

Code: Select all

UPDATE cms_module_news SET start_time = NULL 
And it worked!

I wonder if that code should actually be checking if start_time IS NULL OR end_time IS NULL, not AND?

Looking at the code, I guess I could have also passed in the "showall" param.