exec("rm -rf " . TMP_DIR_VD . "/*"); } if (!is_writable(ZIP_DIR)) { die("ERROR: " . ZIP_DIR . " is not writable\n"); } foreach ($listaIds as $i => $contentId) { $contentId = trim($contentId); $log .= "\tprocessando {$contentId}\n"; $video = new migVideo($dbc, $debug, $catLvl, $webCat, $rating); try { $video->loadContent($contentId); } catch (Exception $e) { $log .= "loadContent: " . $e->getMessage() . "\n"; } $video->setTag($catmig); $video->setSubTag($subcatmig); //$video->setKeywords($keywords[$i]); //$video->setShortDescription($shortDesc[$i]); //$video->setLongDescription($longDesc[$i]); $todos = true; $alguno = false; try { $content_download = FALSE; $log .= "\tdescargando contenido...\n"; $ftpCon = new Ftp(); $conectado = $ftpCon->login_r(null, null, FTP_CONN_RETRIES); if ($conectado === TRUE) { $content_download = $video->downloadContent($ftpCon); foreach ($content_download as $formato => $bajado) { $todos = $todos && $bajado; if (!$bajado) {
// si es update //------------------------ foreach ($listaIds as $i => $contentId) { $contentId = trim($contentId); $log .= "\tprocessando {$contentId}\n"; $video = new migVideo($dbc, $debug, $catLvl, $webCat, $marca, $rating, $festivo, $tipoVideo); try { $video->loadContent($contentId); } catch (Exception $e) { $log .= "loadContent: " . $e->getMessage() . "\n"; } try { $video->setLangs(array_keys($idiomas_elegidos)); $video->setMerchants(array_keys($paises_elegidos)); $video->setTag($catmig); $video->setSubTag($subcatmig); $video->setTag($catmigen, 'en'); $video->setSubTag($subcatmigen, 'en'); $xmlContent = $video->updateXML(); $arrayMuestra[] = $video->getArraySubForm(); $total++; $d2 = $tmpDir . "/{$contentId}/"; $video->setDirToWrite($d2); if (!file_exists($d1)) { exec("mkdir {$d1}"); } if (!file_exists($d2)) { exec("mkdir {$d2}"); } $written = file_put_contents($video->getDirToWrite() . $xmlFile, $xmlContent); } catch (Exception $e) {