We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41051
    • 11 Posts
    It's been so long since I exported to HTML - don't know if it's an 1.0.13 issue or earlier.

    Trying to export a batch of HTML pages -- nothing special just click the big button.

    Getting a parse error that seems to be Array centered. All the pages are cacheable and visible.



    MODX encountered the following error while attempting to parse the requested resource:

    « Execution of a query to the database failed - 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 'Array' at line 1 »

    SQL > SELECT count(id) FROM `[database name]`.`modx_site_content` WHERE deleted=0 AND ((published=1 AND type='document') OR (isfolder=1)) AND cacheable=1 Array



    ?? Any idea what this means or what I should do?
    >>>>PHP version is 5.2.17


    Also have this..

    Backtrace
    1 include_once()
    manager/index.php on line 828
    2 include_once()
    manager/actions/export_site.static.php on line 33
    3 DocumentParser->loadExtension()
    manager/processors/export_site.processor.php on line 10
    4 EXPORT_SITE->EXPORT_SITE()
    manager/includes/document.parser.class.inc.php on line 129
    5 EXPORT_SITE->getTotal()
    manager/includes/extenders/export.class.inc.php on line 25
    6 DBAPI->select()
    manager/includes/extenders/export.class.inc.php on line 71
    7 DBAPI->query()
    manager/includes/extenders/dbapi.mysql.class.inc.php on line 231 [ed. note: hollyvalero last edited this post 10 years ago.]
    • If thats giving you issues you can use this tool which works extremely well.

      Good luck.
        Benjamin Marte
        Interactive Media Developer
        Follow Me on Twitter | Visit my site | Learn MODX
        • 7253
        • 97 Posts
        This has just bitten me - pretty sure it's a bug in the export class. Changing the getTotal function in /manager/includes/extenders/export.class.php from this:

        	function getTotal($ignore_ids='', $noncache='0')
        	{
        		global $modx;
        		$tbl_site_content = $modx->getFullTableName('site_content');
        		
        		$ignore_ids = array_filter(array_map('intval', explode(',', $ignore_ids)));
        		if(count($ignore_ids)>0)
        		{
        			$ignore_ids = "AND NOT id IN ('".implode("','", $ignore_ids)."')";
        		}
        		
        		$this->ignore_ids = $ignore_ids;
        		
        		$noncache = $include_noncache==1 ? '' : 'AND cacheable=1';
        		$where = "deleted=0 AND ((published=1 AND type='document') OR (isfolder=1)) {$noncache} {$ignore_ids}";
        		$rs  = $modx->db->select('count(id)',$tbl_site_content,$where);
        		$this->total = $modx->db->getValue($rs);
        		return $this->total;
        	}
        


        to this fixes it for me:

        	function getTotal($ignore_ids='', $noncache='0')
        	{
        		global $modx;
        		$tbl_site_content = $modx->getFullTableName('site_content');
        		
        		if ($ignore_ids != '') {
        			$ignore_ids = array_filter(array_map('intval', explode(',', $ignore_ids)));
        			if(count($ignore_ids)>0)
        			{
        				$ignore_ids = "AND NOT id IN ('".implode("','", $ignore_ids)."')";
        			}
        			
        			$this->ignore_ids = $ignore_ids;
        		}
        		
        		$noncache = $noncache==1 ? '' : 'AND cacheable=1';
        		$where = "deleted=0 AND ((published=1 AND type='document') OR (isfolder=1)) {$noncache} {$ignore_ids}";
        		$rs  = $modx->db->select('count(id)',$tbl_site_content,$where);
        		$this->total = $modx->db->getValue($rs);
        		return $this->total;
        	}
        


        Also, I'm not sure where `$include_noncache` is supposed to be set? I think this line should be changed like that, but I didn't test that part too much.