WordPress.org

Ready to get started?Download WordPress

Forums

CSS & JavaScript Toolbox
[resolved] SQL Error after Migration to new server (4 posts)

  1. newtonwp
    Member
    Posted 1 year ago #

    After moving our website to a new server, CSS Javascript Toolbox stopped working. I tracked it down to an error being thrown in the PHP Error Logs. The PHP version is 5.3.2-1ubuntu4.19.

    The error is:
    WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; /* for query SELECT blocks.id,blocks.name,blocks.pinPoint,blocks.code,blocks.location,blocks.links,blocks.expressions,(blocks.pinPoint & 50331648) blocksGroup FROM wp_cjtoolbox_blocks blocks\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN wp_cjtoolbox_block_pins pins\n\t\t\t\t\t\t\t\t\t\t\tON blocks.id = pins.blockId WHERE (((backupId IS NULL) AND (blocks.code != '') AND (state = 'active')) AND \n\t\t\t\t\t\t\t\t\t\t\t((blocks.pinPoint & 50331648)));; /* From [/wp-content/plugins/css-javascript-toolbox/framework/db/mysql/queue-driver.inc.php:330] */ made by require('wp-blog-header.php'), wp, WP->main, do_action_ref_array, call_user_func_array, CJTBlocksCouplingController->initCoupling, CJTBlocksCouplingController->getBlocks, CJTCouplingModel->getPinsBlocks, CJTPinsBlockSQLView->exec, CJTMYSQLQueueDriver->select

    Based on the error, I found the extra semicolon was causing the problem. So, I added the following line:

    queue-driver.inc.php:329 - 332
    		if ($query && empty($resultSet)) {
    			$query = str_replace(';;',';',$query);
    			$resultSet = $this->wpdb->get_results($query, $returnType);
    		}

    That seems to stop the error.

    Any suggestions or is this the proper bug fix?

    The plugin is still not loading the code blocks when visiting the website, still trying to figure out why.

    http://wordpress.org/extend/plugins/css-javascript-toolbox/

  2. newtonwp
    Member
    Posted 1 year ago #

    I was not able to figure out why it was not loading the code blocks. When running the sql query, it found the code blocks, but they were not being output to the html when viewing the page.

    I had to ultimately disable the plugin and migrate my code blocks to the "Specific Files" plugin which worked perfectly.

    I really liked CSS & Javascript Toolbox, but unfortunately it's not working for any of the WP sites I've migrated to our new server.

    Any insight would be great.

  3. wipeoutmedia
    Member
    Plugin Author

    Posted 1 year ago #

    Hello,

    Thanks for reporting!

    I'll check it out and let you know what caused this issue.

    Regards,
    Ahmed

  4. wipeoutmedia
    Member
    Plugin Author

    Posted 1 year ago #

    Hello,

    Thanks for your informative message. Also please accept my apologize as we were busy working on the next release.

    You've just did a great job for replacing ;; with a ;! The query you submit is a valid query and worked with me too however there're another query you didn't know about and its responsible for retrieving other code blocks.

    I'll describe the method of querying the code blocks by the CJT plugin.

    There're two queries to be done for the code blocks to be retrieved:

    1. Querying blocks associated with the current WordPress request object (page, post, custom post, category, ALL PAGES, ALL POSTS, etc...) as selected from the block assignment panel. CJT will used any block returned with this query.

    2. Select all blocks that has 'link' or 'expression' added from the block assignment panel advanced tab. CJT will try to check if any of the returned blocks (links and expressions) is matching the current request URI. So this query might has a result however non of those has a matched link or expression to associated with the current request!!

    Procedures:

    - Please make sure that you've at least single code block that assigned to a the requested page by checking the block assignment panel/
    - Please also check if the block is activate.
    - Also CJT won't use any empty code blocks.
    - Are you sure that the database posts (pages, posts, categories, etc...) still has the same ids after you migrate the servers? CJT use posts/pages/categories ids for associating the block with them (see cjtoolbox_block_pins table)! If you felt that the ids might changed please deselect any assignment panel selected object, save block, select it again and save it again.
    - you can add the following lines (for debugging) in tables/pins-blocks-view.php file @ line 79 you'll see both queries when loading a page.

    echo "{$query}<br>";

    I know I might be overloading you with many procedures however I cannot see the issue and I'm just trying to imagine, also we've no similar issue reported! So please as you can to let me know what happened. Please start with the sample procedures like creating new block, assign it to a page/post, save the block and click on that page from the assignment panel.

    Hope that helps.

    Waiting your response!

    Regards,
    Ahmed

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags