Merge pull request #10439 from jitendrapurohit/CRM-20657
[civicrm-core.git] / bin / cli.class.php
index dbcc5e9caf01268e28dc77b6e38b980b31863dbb..195792554074fd8994f34c275613579a1ecc05c0 100644 (file)
@@ -418,9 +418,6 @@ class civicrm_cli_csv_file extends civicrm_cli {
       $this->separator = ";";
       rewind($handle);
       $header = fgetcsv($handle, 0, $this->separator);
-      if (count($header) == 1) {
-        die("Invalid file format for " . $this->_file . ". It must be a valid csv with separator ',' or ';'\n");
-      }
     }
 
     $this->header = $header;
@@ -430,6 +427,10 @@ class civicrm_cli_csv_file extends civicrm_cli {
         continue;
       }
       $this->row++;
+      if ($this->row % 1000 == 0) {
+        // Reset PEAR_DB_DATAOBJECT cache to prevent memory leak
+        CRM_Core_DAO::freeResult();
+      }
       $params = $this->convertLine($data);
       $this->processLine($params);
     }