@@ -31,24 +31,7 @@ class GedcomParser
3131
3232 public function parse ($ conn , string $ filename , string $ slug , bool $ progressBar = false )
3333 {
34- unset($ GLOBALS );
35- unset($ _SERVER );
36- unset($ _GET );
37- unset($ _POST );
38- unset($ _FILES );
39- unset($ _REQUEST );
40- unset($ _ENV );
41- unset($ _COOKIE );
42- unset($ HTTP_RAW_POST_DATA );
43- unset($ http_response_header );
44- unset($ argc );
45- unset($ argv );
46- gc_collect_cycles ();
47- $ startMemoryUse = round (memory_get_usage () / 1048576 , 2 );
48- //start calculating the time
49- $ time_start = microtime (true );
5034 $ this ->conn = $ conn ;
51- error_log ("\nMemory Usage: " .round (memory_get_usage () / 1048576 , 2 ).'' .' MB ' );
5235 error_log ('PARSE LOG : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ' .$ conn );
5336 $ parser = new \PhpGedcom \Parser ();
5437 $ gedcom = @$ parser ->parse ($ filename );
@@ -75,6 +58,7 @@ public function parse($conn, string $filename, string $slug, bool $progressBar =
7558 $ c_repo = count ($ repo );
7659 $ c_obje = count ($ obje );
7760 if ($ subn != null ) {
61+ //
7862 $ c_subn = 1 ;
7963 }
8064
@@ -111,8 +95,9 @@ public function parse($conn, string $filename, string $slug, bool $progressBar =
11195 }
11296 }
11397
114- // store informaithttps://www.php.net/manual/en/function.memory-get-usage.phpon about all the submitters to the GEDCOM file.
98+ // store information about all the submitters to the GEDCOM file.
11599 foreach ($ subm as $ item ) {
100+ // $this->getSubm($item);
116101 if ($ item ) {
117102 $ _subm_id = $ item ->getSubm ();
118103 $ subm_id = \GenealogiaWebsite \LaravelGedcom \Utils \Importer \Subm::read ($ this ->conn , $ item , null , null , $ this ->obje_ids );
@@ -229,13 +214,6 @@ public function parse($conn, string $filename, string $slug, bool $progressBar =
229214 }
230215
231216 if ($ progressBar === true ) {
232- //Record end time and calculate total execution time
233- $ time_end = microtime (true );
234- $ endMemoryUse = round (memory_get_usage () / 1048576 , 2 );
235- $ execution_time = ($ time_end - $ time_start );
236- $ memory_usage = $ endMemoryUse - $ startMemoryUse ;
237- error_log ("\nTotal Execution Time: " .round ($ execution_time ).' Seconds ' );
238- error_log ("\nMemory Usage: " .$ memory_usage .'' .' MB ' );
239217 $ bar ->finish ();
240218 }
241219 }
@@ -254,6 +232,7 @@ private function getPerson($individual)
254232 $ name = '' ;
255233 $ givn = '' ;
256234 $ surn = '' ;
235+
257236 $ name = '' ;
258237 $ npfx = '' ;
259238 $ givn = '' ;
@@ -289,6 +268,7 @@ private function getPerson($individual)
289268 $ rin = $ individual ->getRin ();
290269 $ rfn = $ individual ->getRfn ();
291270 $ afn = $ individual ->getAfn ();
271+
292272 $ attr = $ individual ->getAllAttr ();
293273 $ events = $ individual ->getAllEven ();
294274 $ note = $ individual ->getNote ();
@@ -312,10 +292,8 @@ private function getPerson($individual)
312292 $ givn = $ name ;
313293 }
314294 $ config = json_encode (config ('database.connections. ' .$ this ->conn ));
315-
316295 $ person = Person::on ($ this ->conn )->updateOrCreate (compact ('name ' , 'givn ' , 'surn ' , 'sex ' ), compact ('name ' , 'givn ' , 'surn ' , 'sex ' , 'uid ' , 'rin ' , 'resn ' , 'rfn ' , 'afn ' ));
317296 $ this ->persons_id [$ g_id ] = $ person ->id ;
318-
319297 if ($ events !== null ) {
320298 foreach ($ events as $ event ) {
321299 if ($ event && count ($ event ) > 0 ) {
@@ -341,15 +319,13 @@ private function getPerson($individual)
341319 }
342320 }
343321 }
344-
345322 if ($ note != null && count ($ note ) > 0 ) {
346323 foreach ($ note as $ item ) {
347324 if ($ item ) {
348325 \GenealogiaWebsite \LaravelGedcom \Utils \Importer \NoteRef::read ($ this ->conn , $ item , $ _group , $ _gid );
349326 }
350327 }
351328 }
352-
353329 if ($ indv_sour != null && count ($ indv_sour ) > 0 ) {
354330 foreach ($ indv_sour as $ item ) {
355331 if ($ item ) {
@@ -553,4 +529,4 @@ private function getFamily($family)
553529 \GenealogiaWebsite \LaravelGedcom \Utils \Importer \Chan::read ($ this ->conn , $ chan , 'family ' , $ family ->id );
554530 }
555531 }
556- }
532+ }
0 commit comments