WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

You are not logged in.

#1 03.11.2018 20:48:42

robkiel
Member

Try to install the LeafletMaps module

Hello,

When trying to instal the LeafletMaps module I get following Errors in the backend:

Fatal error: Uncaught Error: Call to a member function fetchRow() on null in /var/www/vhosts/domain.com/httpdocs/modules/LeafletMaps/inc/class.LeafletMaps.php:391
Stack trace:
#0 /var/www/vhosts/domain.com/httpdocs/modules/LeafletMaps/inc/class.LeafletMaps.php(446): LeafletMaps::fetchall(NULL)
#1 /var/www/vhosts/domain.com/httpdocs/modules/LeafletMaps/inc/class.LeafletMaps.php(115): LeafletMaps::markers('840', true)
#2 /var/www/vhosts/domain.com/httpdocs/modules/LeafletMaps/modify.php(28): LeafletMaps::modify('840')
#3 /var/www/vhosts/domain.com/httpdocs/admin/pages/modify.php(170): require('/var/www/vhosts...')
#4 {main} thrown in /var/www/vhosts/domain.com/httpdocs/modules/LeafletMaps/inc/class.LeafletMaps.php on line 391

System details:
WBCE Version: 1.3.2
Tag: 1.3.2
PHP Version: 7.2.11

Does anybody has a solution for this?
Thanks in advance.

Offline

#2 04.11.2018 07:22:39

florian
Administrator

Re: Try to install the LeafletMaps module

hm, that looks like an error which should have been fixed, see https://forum.wbce.org/viewtopic.php?pid=14013#p14013
which version of leaflet maps do you use?


Sorgen sind wie Nudeln: man macht sich meist zu viele.

Offline

#3 04.11.2018 17:42:12

robkiel
Member

Re: Try to install the LeafletMaps module

Hello florian,

Thanks for the suggestion to the topic.
I have downloaded the version from the WBCE AOR (version 1.1.2)

With reading the other topic, I did the following:

  • In the same DB there was running another WBCE site (with different suffix), I deleted this one.

  • In the DB where also still tables present from the old Mapbaker module, I also deleted these tables.

  • I found on the server in the modules directory a Mapbaker directory, what I deleted (So the old module was not properly deleted, but I think everything is rectified now).

  • In the template I have this in the <head> of the index file:

    // automatically include optional WB module files (frontend.css, frontend.js)
        if (function_exists('register_frontend_modfiles')) {
            register_frontend_modfiles('css');
            register_frontend_modfiles('jquery');
            register_frontend_modfiles('js');
        }

    I think this is correct?
    On the other hand the posted errors in my first post are in the back-end, so I think this is independent from the template.

The errors still exist, so any other ideas are welcome.

Thanks in advance.

Offline

#4 04.11.2018 18:03:14

florian
Administrator

Re: Try to install the LeafletMaps module

Can you please have a look in your database and check if the following tables were created:
YOURPREFIX_mod_leafletmaps_icons
YOURPREFIX_mod_leafletmaps_iconsets
YOURPREFIX_mod_leafletmaps_markers

if not, please run the following SQL

DROP TABLE IF EXISTS `YOURPREFIX_mod_leafletmaps_icons`;
CREATE TABLE `YOURPREFIX_mod_leafletmaps_icons` (
  `icon_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `class_id` int(10) unsigned NOT NULL DEFAULT '0',
  `iconUrl` varchar(50) NOT NULL DEFAULT '0',
  PRIMARY KEY (`icon_id`),
  KEY `FK_mod_leafletmaps_icons_mod_leafletmaps_iconclasses` (`class_id`),
  CONSTRAINT `FK_YOURPREFIX_mod_leafletmaps_icons_mod_leafletmaps_iconclasses` FOREIGN KEY (`class_id`) REFERENCES `YOURPREFIX_mod_leafletmaps_iconsets` (`class_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `YOURPREFIX_mod_leafletmaps_icons` (`icon_id`, `class_id`, `iconUrl`) VALUES
(1,	1,	'beige.png'),
(2,	1,	'blue.png'),
(3,	1,	'gold.png'),
(4,	1,	'gradient.png'),
(5,	1,	'green.png'),
(6,	1,	'grey.png'),
(7,	1,	'pink.png'),
(8,	1,	'red.png'),
(9,	2,	'marker-icon.png');

DROP TABLE IF EXISTS `YOURPREFIX_mod_leafletmaps_iconsets`;
CREATE TABLE `YOURPREFIX_mod_leafletmaps_iconsets` (
  `class_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `setName` varchar(50) DEFAULT NULL,
  `baseUrl` text NOT NULL,
  `shadowUrl` varchar(50) DEFAULT NULL,
  `iconWidth` int(3) unsigned DEFAULT NULL,
  `iconHeight` int(3) unsigned DEFAULT NULL,
  `iconAnchorLeft` int(3) DEFAULT NULL,
  `iconAnchorBottom` int(3) DEFAULT NULL,
  `shadowWidth` int(3) unsigned DEFAULT NULL,
  `shadowHeight` int(3) unsigned DEFAULT NULL,
  `shadowAnchorLeft` int(3) DEFAULT NULL,
  `shadowAnchorBottom` int(3) DEFAULT NULL,
  `popupAnchorLeft` int(3) DEFAULT NULL,
  `popupAnchorBottom` int(3) DEFAULT NULL,
  `glyphAnchorLeft` int(3) DEFAULT NULL,
  `glyphAnchorBottom` int(3) DEFAULT NULL,
  `glyphColor` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`class_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `YOURPREFIX_mod_leafletmaps_iconsets` (`class_id`, `setName`, `baseUrl`, `shadowUrl`, `iconWidth`, `iconHeight`, `iconAnchorLeft`, `iconAnchorBottom`, `shadowWidth`, `shadowHeight`, `shadowAnchorLeft`, `shadowAnchorBottom`, `popupAnchorLeft`, `popupAnchorBottom`, `glyphAnchorLeft`, `glyphAnchorBottom`, `glyphColor`) VALUES
(1,	'byteworker',	'/modules/LeafletMaps/icons/byteworker',	'shadow.png',	32,	50,	16,	49,	35,	26,	1,	26,	0,	-35,	0,	8,	'#fefefe'),
(2,	'LeafletJS Original',	'/modules/LeafletMaps/css/images',	'marker-shadow.png',	25,	41,	12,	40,	41,	41,	12,	41,	0,	0,	0,	3,	'#fff');

DROP TABLE IF EXISTS `YOURPREFIX_mod_leafletmaps_markers`;
CREATE TABLE `YOURPREFIX_mod_leafletmaps_markers` (
  `section_id` int(10) NOT NULL DEFAULT '0',
  `marker_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `icon_id` int(10) unsigned NOT NULL DEFAULT '0',
  `name` varchar(255) NOT NULL,
  `latitude` decimal(18,15) NOT NULL DEFAULT '0.000000000000000',
  `longitude` decimal(18,15) NOT NULL DEFAULT '0.000000000000000',
  `url` text,
  `description` text,
  `glyph` varchar(50) DEFAULT NULL,
  `active` int(1) NOT NULL DEFAULT '1',
  `pos` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`marker_id`),
  KEY `FK_mod_leafletmaps_markers_mod_leafletmaps_icons` (`icon_id`),
  CONSTRAINT `FK_YOURPREFIX_mod_leafletmaps_markers_mod_leafletmaps_icons` FOREIGN KEY (`icon_id`) REFERENCES `YOURPREFIX_mod_leafletmaps_icons` (`icon_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Important: Please replace YOURPREFIX_ with the actual prefix of your WBCE installation!


Sorgen sind wie Nudeln: man macht sich meist zu viele.

Offline

#5 04.11.2018 20:04:15

robkiel
Member

Re: Try to install the LeafletMaps module

Hello florian,

The markers table was not created in the database.
I've tried to run your queries but get the folowing errors:

Table:  PREFIX_mod_leafletmaps_icons
Fehler in der SQL-Abfrage (1059): Identifier name 'FK_PREFIX_mod_leafletmaps_icons_mod_leafletmaps_iconclasses' is too long

Table:  PREFIX_mod_leafletmaps_iconsets
OK

Table : PREFIX_mod_leafletmaps_markers
Fehler in der SQL-Abfrage (1005): Can't create table `iq_koor`.`PREFIX_mod_leafletmaps_markers` (errno: 150 "Foreign key constraint is incorrectly formed")

I've tried the same in a portable (USBwebserver) WBCE with more or less the same result

Table:  PREFIX_mod_leafletmaps_icons
Fout in query (1215): Cannot add foreign key constraint

Table:  PREFIX_mod_leafletmaps_iconsets
OK

Table : PREFIX_mod_leafletmaps_markers
Fout in query (1215): Cannot add foreign key constraint

I hope this information helps.

Offline

#6 05.11.2018 08:29:19

florian
Administrator

Re: Try to install the LeafletMaps module

no idea, sorry. I can't reproduce the error, neither on a real server, nor on the current WBCE portable.


Sorgen sind wie Nudeln: man macht sich meist zu viele.

Offline

#7 05.11.2018 12:05:23

colinax
Member

Re: Try to install the LeafletMaps module

Looks like strict mode error.

The primary key can not be "not null "

See case 4 & 5

https://www.rathishkumar.in/2016/01/sol … l?m=1#menu

Offline

#8 05.11.2018 14:26:22

webbird
Administrator

Re: Try to install the LeafletMaps module

'FK_PREFIX_mod_leafletmaps_icons_mod_leafletmaps_iconclasses' is too long

Identifier names are limited to 64 characters. Do you have a very long prefix? If this is the case, shorten the name of the foreign key name to 64 chars. (Without PREFIX, the name above has 52 characters. Does your PREFIX have more than 12 characters???)


Ich habe eine Amazon-Wishlist. wink Oder spende an das Projekt.
Ich kann, wenn ich will, aber wer will, dass ich muss, kann mich mal

Offline

#9 05.11.2018 14:55:40

robkiel
Member

Re: Try to install the LeafletMaps module

Hello colinax / florian,

I think strict mode was the solution.
On the production server I didn't had the rights to change the strict mode:
sql> set global sql_mode='';
gave:
Access denied; you need (at least one of) the SUPER privilege(s) for this operation

But I was able to change the settings on the portable one.
After installing the leaflet module I copied the tables to the production server and everything is up and running now.

Thanks for all you efforts.

Offline

#10 05.11.2018 15:01:41

robkiel
Member

Re: Try to install the LeafletMaps module

Hello webbird,

I red that error message, and my prefix is indeed a bit long (13 characters) but when I shortened it still gave the same error.
So it seems it was a strict mode problem.

Thanks for the reply, a very nice module since Google maps / Mapbaker is more or less not working anymore.

Offline

#11 05.11.2018 15:12:56

webbird
Administrator

Re: Try to install the LeafletMaps module

It should work in strict mode, too. I will check that in my environment.


Ich habe eine Amazon-Wishlist. wink Oder spende an das Projekt.
Ich kann, wenn ich will, aber wer will, dass ich muss, kann mich mal

Offline

#12 05.11.2018 15:15:49

webbird
Administrator

Re: Try to install the LeafletMaps module

I have

sql_mode = STRICT_ALL_TABLES

in my settings in WBCE portable (where I develop LeafletMaps, too). I will shorten the FK name anyway.


Ich habe eine Amazon-Wishlist. wink Oder spende an das Projekt.
Ich kann, wenn ich will, aber wer will, dass ich muss, kann mich mal

Offline

Board footer

up