presslabs / toplytics

Plugin for displaying most viewed content using data from a Google Analytics account. Relieves the DB from writing every click.
https://www.presslabs.com/code/toplytics/
30 stars 9 forks source link

Option "toplytics_results_ranges" does not exist in the database #145

Closed mariusveltan closed 4 years ago

mariusveltan commented 5 years ago

If Toplytics is updated from an old version to the latest version, there is the risk of option "toplytics_results_ranges" not being created in the database. The option is created, with default data, at initial plugin activation.

If the option does not exist, fetching data from GA fails, with an error while running "getAnalyticsData" in Backend.php.

The fix would be to call the initialization of the option in case the option does not exist, prior to start using it within the function call.