Page 1 of 1

Plugin could not be activated because it triggered a fatal error.

Posted: Tue Feb 14, 2017 3:19 pm
by uyasar
Hello, I do not know if this is a bug or not but when I try to activate the plugin I get this message:

Plugin could not be activated because it triggered a fatal error.

Fatal error: Uncaught exception 'DhtmlChessPgnNotFoundException' with message 'Unable to locate pgn' in /home/mobilderslik/eders.org/wp-content/plugins/dhtml-chess-wordpress/api/php/wordpress/DhtmlChessPgn.php:72 Stack trace: #0 /home/mobilderslik/eders.org/wp-content/plugins/dhtml-chess-wordpress/api/php/wordpress/DhtmlChessPgnUtil.php(58): DhtmlChessPgn::instanceById(0) #1 /home/mobilderslik/eders.org/wp-content/plugins/dhtml-chess-wordpress/api/php/wordpress/DhtmlChessImportPgn.php(59): DhtmlChessPgnUtil->create('Great Games') #2 /home/mobilderslik/eders.org/wp-content/plugins/dhtml-chess-wordpress/api/php/wordpress/DhtmlChessInstaller.php(74): DhtmlChessImportPgn->createFromPgnString('Great Games', '[Event "4th mat...') #3 /home/mobilderslik/eders.org/wp-content/plugins/dhtml-chess-wordpress/api/php/wordpress/DhtmlChessInstaller.php(68): DhtmlChessInstaller->importDefaultPgn() #4 /home/mobilderslik/eders.org/wp-content/plugins/dhtml-chess-wordpress/includes/class-dhtml_chess-activator.php(37): DhtmlChessInstaller->ins in /home/mobilderslik/eders.org/wp-content/plugins/dhtml-chess-wordpress/api/php/wordpress/DhtmlChessPgn.php on line 72

Re: Plugin could not be activated because it triggered a fatal error.

Posted: Tue Feb 14, 2017 3:44 pm
by alf
Thanks for providing the stack trace. That's really helpful, and I appreciate that :)

I have a working version my self, so I haven't discovered this bug yet. Do you know which WordPress version you are using?

From the stack trace, it seems that the databases aren't created properly

The bug occurs inside the file

dhtml_chess/api/php/wordpress/DhtmlChessInstaller.php

where it created the databases and puts some default games and databases into it. It fails when it tries to put these games into the database.

What you can try to do is to open that file

DhtmlChessInstaller.php

in a code editor or Notepad and change line 68 from

$this->importDefaultPgn();

to

// $this->importDefaultPgn();

and see if you're able to activate the plugin.

I will look more into this tonight, do some debugging and hopefully post an updated zip file here.

Re: Plugin could not be activated because it triggered a fatal error.

Posted: Tue Feb 14, 2017 5:04 pm
by uyasar
my wordpress version is 4.7.2. And yes, it worked, i was able to activate the plugin but:
Image

Re: Plugin could not be activated because it triggered a fatal error.

Posted: Tue Feb 14, 2017 6:14 pm
by alf
I have managed to reproduce this problem on my Hostgator site. It did work locally, so I didn't catch that error earlier. It's not creating all the database tables during install.

I have uploaded a new dhtml-chess-wordpress.zip file now which takes care of some of the problem. Just download it and overwrite your existing wp-content/plugins/dhtml_chess folder

But there's still some database issues to solve. I will look more at them in a while.

If you have access to MySql, you may try to create the tables manually:

create table dhtml_chess_pgn(id int auto_increment not null primary key,pgn_name varchar(255),tmp varchar(255),archived char(1) default '0', hidden char(1) default '0' ,updated timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
create table dhtml_chess_game(id int auto_increment not null primary key,pgn_id int,sort int,dhtml_chess_id int,game mediumtext, updated timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
create table dhtml_chess_cache(id int auto_increment not null primary key,cache_key varchar(255),updated timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,cache_val mediumtext);;
create table dhtml_chess_game_draft(id int auto_increment not null primary key,title varchar(1024), game mediumtext, updated timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);;
create index wp_index_dhtml_chess_pgn_arc on dhtml_chess_pgn(archived);
create index wp_index_dhtml_chess_game_did on dhtml_chess_game(dhtml_chess_id);
create index wp_index_dhtml_chess_game_pgn on dhtml_chess_game(pgn_id);
create index wp_index_dhtml_chess_cache_key on dhtml_chess_cache(cache_key);

Re: Plugin could not be activated because it triggered a fatal error.

Posted: Tue Feb 14, 2017 9:53 pm
by alf
I think this issue has been resolved now in the latest zip

http://www.dhtml-chess.com/api/zip/dhtm ... dpress.zip

Follow the same procedure

1) delete your existing wp-content/plugins/dhtml_chess folder
2) unzip the zip file and copy the dhtml_chess folder from the zip into wp-content/plugins
3) From the plugins page, select activate for the plugin(if it's already activated, select deactivate followed by activate).