Bläddra i källkod

remove original file after format, remove parsercompleto folder after inserts

Nermosis 3 år sedan
förälder
incheckning
5c1a762043
1 ändrade filer med 23 tillägg och 2 borttagningar
  1. 23 2
      application/controllers/ParserCompleto.php

+ 23 - 2
application/controllers/ParserCompleto.php Visa fil

64
             emailInicioProcesoDescarga($fechaImportacionLog, $files);
64
             emailInicioProcesoDescarga($fechaImportacionLog, $files);
65
 
65
 
66
             $this->parserfile->index($this->rutaDiariaFecha, $fechaCarpeta, $row, $idUltimaImportacion);
66
             $this->parserfile->index($this->rutaDiariaFecha, $fechaCarpeta, $row, $idUltimaImportacion);
67
+
68
+            $this->eliminarArchivosProcesoCompleto($this->rutaDiariaFecha);
67
         }
69
         }
68
 
70
 
69
         $this->tablasCalculadas($idUltimaImportacion);
71
         $this->tablasCalculadas($idUltimaImportacion);
99
             $attrHref = $row['@attributes']['href'];
101
             $attrHref = $row['@attributes']['href'];
100
 
102
 
101
             if ($attrNext === "next") {
103
             if ($attrNext === "next") {
102
-                $enlace = $attrHref;
104
+                if (!strpos($attrHref, "licitacionesPerfilesContratanteCompleto3_20220517_133815_1")) { //"20220127_")) {
105
+                    $enlace = $attrHref;
106
+                } else {
107
+                    $enlace = "";
108
+                }
109
+                /* $enlace = $attrHref;
103
             } else {
110
             } else {
104
-                $enlace = "";
111
+                $enlace = ""; */
105
             }
112
             }
106
         }
113
         }
107
 
114
 
136
     {
143
     {
137
         $openingFormat = $this->regExIniciosEsquema($xml);
144
         $openingFormat = $this->regExIniciosEsquema($xml);
138
         $closureFormat = $this->regExFinalesEsquema($openingFormat);
145
         $closureFormat = $this->regExFinalesEsquema($openingFormat);
146
+        unlink($this->rutaDiariaFecha . "/" . $fileName);
139
         file_put_contents($this->rutaDiariaFecha . "/format/" . $fileName, $closureFormat);
147
         file_put_contents($this->rutaDiariaFecha . "/format/" . $fileName, $closureFormat);
140
     }
148
     }
141
 
149
 
172
 
180
 
173
         insertBucleDuplicateOnKey($licitaciones['datos'], "vista_datos_licitacion", "");
181
         insertBucleDuplicateOnKey($licitaciones['datos'], "vista_datos_licitacion", "");
174
     }
182
     }
183
+
184
+    private function eliminarArchivosProcesoCompleto($ruta)
185
+    {
186
+        $files = glob($ruta . "format/*");
187
+        foreach ($files as $file) { // iterate files
188
+            if (is_file($file)) {
189
+                unlink($file); // delete file
190
+            }
191
+        }
192
+
193
+        rmdir($ruta . "format");
194
+        rmdir($ruta);
195
+    }
175
 }
196
 }
176
 
197
 
177
 /* End of file ParserCompleto.php */
198
 /* End of file ParserCompleto.php */