Jump to content

Script seems to just Stop!


Recommended Posts

Hello comrades,

 

I have been using a script provided by someone else, but it just seems to stop and I can't find why.  Can anyone take a look and see what my problem might be, thanks :

<?php

if (version_compare(PHP_VERSION,'5','>=')) require_once('includes/domxml-php4-to-php5.php');

require 'includes/configure.php';
require DIR_WS_FUNCTIONS.'database.php';
require 'includes/database_tables.php';

$icecat_product_list 	= 'data.icecat.biz/export/freeurls/export_urls.txt';//'data.icecat.biz/export/freexml.int/INT/files.index.csv';
$icecat_refs_xml			=	'data.icecat.biz/export/freexml.int/EN/refs.xml';
echo "<br />";

tep_db_connect() or trigger_error('<br />Unable to connect to database server!', E_USER_ERROR);

$product_list  = DIR_FS_DOWNLOAD.'product.list';

################################################
#
# processing refs.xml
#
echo "Wgetting supplier list<br />";
$refs_xml = DIR_FS_DOWNLOAD.'refs.xml';
echo 'http://'.ICECAT_LOGIN.':'.ICECAT_PASSWORD.'@'.$icecat_refs_xml."<br />";

echo "parsing<br />";  // It seems to stop here !!

if(!$dom = domxml_open_file($refs_xml)) {
	//echo "No Dom<br />";
	return trigger_error("<br />!!:: error parsing $refs_xml <br />:: exiting<br />", E_USER_ERROR);
}

$root = $dom->document_element();
if(!$root){
	echo "No Root<br />";
	return trigger_error("<br />!!:: error parsing(root) $refs_xml <br />!!:: exiting<br />", E_USER_ERROR);
}

echo "Processing suppliers<br />";
$supp_list = $root->get_elements_by_tagname('SuppliersList');
$supp_list = $supp_list[0];
$suppliers = $supp_list->get_elements_by_tagname('Supplier');

$supplirs_dump	= DIR_FS_DOWNLOAD.'suppliers_dump.csv';
$file_handle		= fopen($supplirs_dump,"a") or trigger_error(" error opening - $supplirs_dump <br />", E_USER_ERROR);

foreach($suppliers as $supp){
	if($supp->has_attribute('ID'))		{		$supp_id		=	$supp->get_attribute('ID');				}
	if($supp->has_attribute('Name'))	{		$supp_name	=	$supp->get_attribute('Name');			}
	fwrite($file_handle,"$supp_id\t$supp_name\n");
}

unset($suppliers);
fclose($file_handle) or trigger_error(" error closing $supplirs_dump", E_USER_ERROR);
echo "inloading suppliers to database<br />";
tep_db_query("DROP TABLE IF EXISTS temp_ice_supplier");
tep_db_query("CREATE TABLE temp_ice_supplier(
									icecat_supplier_id int(11)  primary key,
									supplier_name varchar(255) not null default '',
									KEY (icecat_supplier_id))");
tep_db_query("LOAD DATA LOCAL INFILE '$supplirs_dump' INTO TABLE temp_ice_supplier");
echo "updating supplier info<br />";
tep_db_query("UPDATE temp_ice_product_list tp , temp_ice_supplier ts
								SET tp.manufacturers_name	 = ts.supplier_name
								WHERE tp.supplier_id = ts.icecat_supplier_id");
tep_db_query("DROP TABLE IF EXISTS temp_ice_supplier");
tep_db_query("ALTER TABLE temp_ice_product_list DROP COLUMN supplier_id");
tep_db_query("DELETE FROM temp_ice_product_list WHERE manufacturers_name IS NULL");
tep_db_query("DROP TABLE IF EXISTS ".ICECAT_AVALIABLE_PRODUCTS);
tep_db_query("ALTER TABLE temp_ice_product_list RENAME TO ".ICECAT_AVALIABLE_PRODUCTS);
echo "supplier info ready <br />";

###############################################
#
#	Processing products images
#

if (USE_ICECAT_IMAGES == 1) {
	echo "Updating images data<br /> ";
	tep_db_query("ALTER TABLE ".ICECAT_AVALIABLE_PRODUCTS." ADD COLUMN manufacturers_id int(11) not null");
	tep_db_query("UPDATE ".ICECAT_AVALIABLE_PRODUCTS." ice , ".TABLE_MANUFACTURERS." m
									SET ice.manufacturers_id = m.manufacturers_id
									WHERE ice.manufacturers_name = m.manufacturers_name");
	tep_db_query("UPDATE ".TABLE_PRODUCTS." p , ".ICECAT_AVALIABLE_PRODUCTS." ice
									SET p.products_image = ice.thumbnail_img
									WHERE p.products_model = ice.products_model AND p.manufacturers_id=ice.manufacturers_id");
	tep_db_query("ALTER TABLE ".ICECAT_AVALIABLE_PRODUCTS." DROP COLUMN manufacturers_id");
	echo "Images data updated <br />";
}

?>

I receive no errors at all.  P.S. I'm using php v4.4.8 on Apache 2.0.64 Win XP

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/157065-script-seems-to-just-stop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.