$xmlFile = "metada.xml"; $zipFile = date("Ymd") . "_Wazzup_" . MIG_WALLPAPER . ".zip"; if (!is_writable(TMP_DIR_WP)) { die("ERROR: " . TMP_DIR_WP . " is not writable\n"); } else { $log .= "borrando tmp dir\n"; exec("rm -f " . TMP_DIR_WP . "/*"); } if (!is_writable(ZIP_DIR)) { die("ERROR: " . ZIP_DIR . " is not writable\n"); } $xmlContent = XMl_HEADER; foreach ($listaIds as $contentId) { $contentId = trim($contentId); $log .= "\tprocesando {$contentId}\n"; $wallpaper = new migWallpaper($dbc, $debug); try { $wallpaper->loadContent($contentId); } catch (Exception $e) { $log .= "loadContent: " . $e->getMessage() . "\n"; } try { $content_download = FALSE; $wallpaper->setTag($catmig); // descargo contenido por FTP $log .= "\tdescargando contenido...\n"; $ftpCon = new Ftp(); $retries = 0; $conectado = $ftpCon->login_r(null, null, FTP_CONN_RETRIES); if ($conectado === TRUE) { $to = TMP_DIR_WP . "/" . $wallpaper->getContentFilename();
//$xmlFile = date("Ymd")."_Wazzup_".MIG_WALLPAPER."_asset.xml"; $xmlFile = "metadata.xml"; $zipFile = "Wazzup_" . MIG_WALLPAPER . "_" . date("Ymd") . ".zip"; if (!is_writable(TMP_DIR_WP)) { die("ERROR: " . TMP_DIR_WP . " is not writable\n"); } else { $log .= "borrando tmp dir\n"; exec("rm -rf " . TMP_DIR_WP . "/*"); } if (!is_writable(ZIP_DIR)) { die("ERROR: " . ZIP_DIR . " is not writable\n"); } foreach ($listaIds as $i => $contentId) { $contentId = trim($contentId); $log .= "\tprocesando {$contentId}\n"; $wallpaper = new migWallpaper($dbc, $debug, $catLvl, $webCat, $rating); try { $wallpaper->loadContent($contentId); } catch (Exception $e) { $log .= "loadContent: " . $e->getMessage() . "\n"; } $wallpaper->setTag($catmig); $wallpaper->setSubTag($subcatmig); //$wallpaper->setKeywords($keywords[$i]); //$wallpaper->setShortDesc($shortDesc[$i]); // $wallpaper->setLongDesc($longDesc[$i]); try { $content_download = FALSE; // descargo contenido por FTP $log .= "\tdescargando contenido...\n"; $ftpCon = new Ftp();
$shellCmd = "cd " . $tmpDir . "; zip -r ../../../" . ZIP_DIR . "/{$zipFile} * "; $log .= exec($shellCmd); $log .= "\tZip " . ZIP_DIR . "/{$zipFile} generado exitosamente\n"; //$log .= exec("rm -fr ".$tmpDir . "/*"); if (!$todos) { echo "<div style=\"margin: 0 auto; text-align: center; font-size: 24px; color: red; font-weight: bold;\">Faltaron formatos de imagenes por bajar, revisar log</div><br />"; } } else { if ($tipoCarga == "update") { //------------------------ // si es update //------------------------ foreach ($listaIds as $i => $contentId) { $contentId = trim($contentId); $log .= "\tprocessando {$contentId} \n"; $wallpaper = new migWallpaper($dbc, $debug, $catLvl, $webCat, $rating, $marca, $festivo); try { $wallpaper->loadContent($contentId); } catch (Exception $e) { $log .= "loadContent: " . $e->getMessage() . "\n"; } try { $wallpaper->setLangs(array_keys($idiomas_elegidos)); $wallpaper->setMerchants(array_keys($paises_elegidos)); $wallpaper->setTag($catmig); $wallpaper->setSubTag($subcatmig); $wallpaper->setTag($catmigen, 'en'); $wallpaper->setSubTag($subcatmigen, 'en'); $xmlContent = $wallpaper->updateXML(); $arrayMuestra[] = $wallpaper->getArraySubForm(); $total++;