Jump to content
benday

[Solved] Cannot save changes with Platform 5.1.8

Recommended Posts

benday

I've got PL Platform 5.1.8 installed on WordPress 4.9.1.  I'm trying to get my website working with the PL Section Adventure 6.0.4 extension.

The PL editor comes up fine and appears to work.  I can make edits in the editor.  When I click the Save Changes button, it appears to work but changes aren't getting saved.  I've tried it from Chrome running on the web server.  I've tried it with Chrome and Edge running on my developer workstation.  No luck.  

I ran a debug window in my browser and traced the network traffic.  When I click save changes, it makes a call to /wp-admin/admin-ajax.php, posts a bunch of json, and the server returns HTTP 200.  No messages in the browser console.  

Any ideas?  Is there a debug mode for the javascript "save" call that I can enable?

Thanks,
-Ben

 

Share this post


Link to post
Share on other sites
edgarcheverier

Hi Ben,

I just test the Extension in MAMP and also on my personal website, and it's working without problems,

Did you try to deactivate all the other plugins? 

Can you put the URL of your website?

Thank you! 

 

Share this post


Link to post
Share on other sites
benday

I deactivated all the plugins except for "PageLines Platform 5.1.8", "PageLines Section Adventure 6.0.4", and "PageLines Section Boxes 5.0.17".  Ran the editor.  Tried modifying.  It says that it saves but when I reload the page, it hasn't saved anything.  It's still broken.

I've run this workflow with Fiddler (https://www.telerik.com/fiddler) running.  It sends a plausible-looking POST to the server with a whole bunch of json in it.  The server happily returns HTTP 200.  I've attached the raw request and response for the save call.  

Interestingly enough, the response sends back a json document that has the changes in it...they just don't seem to get persisted to storage for some reason.  

Here's the URL for the dev version of my site. http://bendaydevblog.eastus.cloudapp.azure.com 

Any suggestions would be greatly appreciated.

-Ben

1_Request.txt

1_Response.txt

Share this post


Link to post
Share on other sites
benday

I did a little more debugging this morning.  Ultimately, it looks like an error in the INSERT statement to MySQL.

I turned on query logging in MySQL using the following command

SET GLOBAL log_output = 'TABLE';
SET GLOBAL general_log = 'ON';

And then ran the save on the website editor.  Then I ran this query to get back the history of SQL queries. 

 
select event_time, user_host, command_type, CONVERT(argument USING utf8) as query
from mysql.general_log
order by event_time DESC

I found the query that represented the change that I made.  (BTW, I've been doing a simple change of just hiding the logo in the adventure header bar.)  Here's the sql query to turn off the logo in the adventure header bar.  The key change here is the hide_logo = 1.  

INSERT INTO wp_pl_data_sections (uid, json)
VALUES ( 'u06acda8', '{\"pl_adv_header_content\":\"\",\"hide_logo\":\"1\",\"logo\":\"http:\\/\\/bendaydevblog.eastus.cloudapp.azure.com\\/wp-content\\/plugins\\/pl-section-adventure\\/images\\/pl-leaf-outline.png\",\"logo_height\":\"\",\"logo_height_min\":\"\",\"navpos\":\"Over On Top\",\"menu\":\"\",\"saved\":1}')
ON DUPLICATE KEY UPDATE
json = VALUES(json)

After that ran, I tried to get back the record for that uid value.

select * from wp_pl_data_sections where uid = 'u06acda8'

There's no row in that table for that uid value.  (DOH!)

I ran that same "INSERT INTO wp_pl_data_sections" query (see above) and go the following error.

Error Code: 1364. Field 'id' doesn't have a default value

I ran a "DESCRIBE wp_pl_data_sections" to get the schema for that table.  Here's what I get:

-- DESCRIBE wp_pl_data_sections
Field Type Null Key Default Extra
id mediumint(9) NO PRI NULL 
uid varchar(50) NO UNI NULL 
draft longtext NO  NULL 
live longtext NO  NULL 
json longtext NO  NULL 

At this point, it looks like there's some kind of database issue happening.  Either the query that's being generated is wrong or the database schema for that table is wrong. 

What is the schema of wp_pl_data_sections table supposed to be?  

Thanks,
-Ben

Share this post


Link to post
Share on other sites
benday

And just a little more debugging...

I modified the query and added my own value for 'id' and ran the modified query.  The query that's being generated is missing required values for the 'draft' column and 'live' column.  After I modified the query to provide values for those other missing columns, the query works and when I reload the site, the change appears.  

So.  There's *definitely* a problem with either the query generation and/or the db schema.  

Here's my modified query:

INSERT INTO wp_pl_data_sections (id, uid, json, draft, live)
VALUES ( 100000, 'u06acda8',
'{\"pl_adv_header_content\":\"\",\"hide_logo\":\"1\",\"logo\":\"http:\\/\\/bendaydevblog.eastus.cloudapp.azure.com\\/wp-content\\/plugins\\/pl-section-adventure\\/images\\/pl-leaf-outline.png\",\"logo_height\":\"\",\"logo_height_min\":\"\",\"navpos\":\"Over On Top\",\"menu\":\"\",\"saved\":1}',
'{\"pl_adv_header_content\":\"\",\"hide_logo\":\"1\",\"logo\":\"http:\\/\\/bendaydevblog.eastus.cloudapp.azure.com\\/wp-content\\/plugins\\/pl-section-adventure\\/images\\/pl-leaf-outline.png\",\"logo_height\":\"\",\"logo_height_min\":\"\",\"navpos\":\"Over On Top\",\"menu\":\"\",\"saved\":1}',
'{\"pl_adv_header_content\":\"\",\"hide_logo\":\"1\",\"logo\":\"http:\\/\\/bendaydevblog.eastus.cloudapp.azure.com\\/wp-content\\/plugins\\/pl-section-adventure\\/images\\/pl-leaf-outline.png\",\"logo_height\":\"\",\"logo_height_min\":\"\",\"navpos\":\"Over On Top\",\"menu\":\"\",\"saved\":1}'
)
ON DUPLICATE KEY UPDATE
json = VALUES(json)

Any idea what the fix is for this?  

Thanks,
-Ben

Share this post


Link to post
Share on other sites
edgarcheverier

Yeah looks like a problem with the database 

Let me check this issue and I will respond as soon as possible.

Share this post


Link to post
Share on other sites
benday

Thanks!  Looking forward to hearing about what you find.

-Ben

Share this post


Link to post
Share on other sites
edgarcheverier

Hi,

The field id requires the AUTO_INCREMENT attribute. Otherwise, it is undefined and that is what the error message says.
If you want to modify an already existing table, use the following command:
ALTER TABLE test_table CHANGE id id INT(8) AUTO_INCREMENT PRIMARY KEY;

  • Thanks 1

Share this post


Link to post
Share on other sites
benday

@edgarcheverier -- That looks like it'll probably take care of the ID field but then there are two other fields that don't have default values ("draft", "live")?

Two questions:

1) Could you run a "DESCRIBE wp_pl_data_sections" and post the results?
2)
I'm concerned that there will be an update that knocks out these manual schema changes.  How does PageLines manage schema changes?  Any theories on why the schema that's in MySQL doesn't match what PageLines needs?

Thanks,
-Ben

Share this post


Link to post
Share on other sites
edgarcheverier

Hi Ben,

ID is the primary key, you cannot have different rows with the same value.

try to return to the default value of the column

mysql> UPDATE t SET i = DEFAULT(i)+1 WHERE id < 100;

 

Share this post


Link to post
Share on other sites
benday

Hi Edgar --

Yes, I understand about the ID column being the primary key.  Thank you.

The ID column fix is only the beginning of the answer.  There are two other columns that are causing errors in that INSERT statement.  The other two columns that are causing errors also do not have default values. 

-- DESCRIBE wp_pl_data_sections
Field Type Null Key Default Extra
id mediumint(9) NO PRI NULL 
uid varchar(50) NO UNI NULL 
draft longtext NO  NULL 
live longtext NO  NULL 

json longtext NO  NULL 
 
Could you run a "DESCRIBE wp_pl_data_sections" and post the results?  I'd like to find out what the schema is on your database.  If I run the INSERT command that is generated by PL, it'll error because there isn't a value provided for 'draft' and 'live'.  
 
Thanks,
-Ben

Share this post


Link to post
Share on other sites
benday

Hi Edgar --

I'm looking for the schema definition.  Could you open a Query window in MySQL and run the following command?

DESCRIBE wp_pl_data_sections

Thanks,
-Ben

Share this post


Link to post
Share on other sites
edgarcheverier

UPDATE `wp_pl_data_sections` SET `id`=[value-1],`uid`=[value-2],`draft`=[value-3],`live`=[value-4],`json`=[value-5] WHERE 1

Share this post


Link to post
Share on other sites
benday

Thanks for the help!

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×