protected function importPO($file) { $zip = new U\Zip(); $remove = false; if (is_file($file)) { if ($zip->isZipArchive($file)) { $pathToFile = $zip->extract($file); $remove = true; } else { $pathToFile = $file; } $process = new SI\ImportShipmentPoEem($pathToFile, $this->_container); $process->setDistinationPath($this->_distinationPath); $process->importPO(); if (true == $remove) { unlink($pathToFile); } return "File {$file} succesufully parsed. \n\r"; } else { return "File {$file} not found at server"; } }
/** * Одноразовая функция, которая служит для того, чтобы запихнуть все файлы * в очереди в zip-архив */ public function compact() { $events = $this->_repository->findAll(); $zip = new U\Zip(); foreach ($events as $event) { if (file_exists($event->getFilename())) { if ($zip->isZipArchive($event->getFilename())) { continue; } $pathToFile = $event->getFilename(); $zipFilename = $zip->pack($pathToFile); $event->setFilename($zipFilename); $this->_em->flush(); } } }