From d2f13f90e9ec74ea015ad8a6a0c2223eb4b8f603 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 8 May 2008 00:27:09 +0000 Subject: [PATCH] API CHANGE Removed import() and generateProductGroups() from DatabaseAdmin - custom code for ecommerce module git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@54162 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/DatabaseAdmin.php | 177 ----------------------------------- 1 file changed, 177 deletions(-) diff --git a/core/model/DatabaseAdmin.php b/core/model/DatabaseAdmin.php index 3aaa78ce1..887de84d6 100644 --- a/core/model/DatabaseAdmin.php +++ b/core/model/DatabaseAdmin.php @@ -262,183 +262,6 @@ class DatabaseAdmin extends Controller { } - /** - * Imports objects based on a specified CSV file in $_GET['FileName'] - */ - function import(){ - $FileName = $_GET['FileName']; - $FileName = $_SERVER['DOCUMENT_ROOT'] . - substr($_SERVER['PHP_SELF'], 0, strlen($_SERVER['PHP_SELF'])-18) . - "/assets/" . $FileName; - - if(file_exists($FileName)) { - $handle = fopen($FileName,'r'); - - if($handle){ - while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { - $num = count($data); - $row++; - - if($row == 1){ - for ($c=0; $c < $num; $c++) { - $ColumnHeaders[] = str_replace(' ','',$data[$c]); - // Have to add code here to remove unsafe chars.. - } - - } else { - $Product = new Product(); - - for ($c=0; $c < $num; $c++) { - $Product->$ColumnHeaders[$c] = trim($data[$c]); - } - - $MainCategory = DataObject::get("ProductGroup", - "URLSegment LIKE '" . $Product->generateURLSegment( - $Product->Category) ."'"); - - if(!$MainCategory) { - // if we can't find a main category, create all three sub - // categories, as they must be unique. - - $ProductGroup = new ProductGroup(); - $ProductGroup->Title = $Product->Category; - print_r("