$total = 0; $xmlFile = date("Ymd") . "_Wazzup_" . MIG_POLYTONE . "_asset.xml"; $zipFile = date("Ymd") . "_Wazzup_" . MIG_POLYTONE . ".zip"; if (!is_writable(TMP_DIR_PT)) { die("ERROR: " . TMP_DIR_PT . " is not writable\n"); } else { $log .= "borrando tmp dir\n"; exec("rm -rf " . TMP_DIR_PT . "/*"); } 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"; $tone = new migRealtone($dbc, $debug, $catLvl, $webCat, true); try { $tone->loadContent($contentId); } catch (Exception $e) { $log .= "loadContent: " . $e->getMessage() . "\n"; } try { $content_download = FALSE; $tone->setTag($catmig); // descargo contenido por FTP $log .= "\tdescargando contenido full...\n"; $ftpCon = new Ftp(); $conectado = $ftpCon->login(); if ($conectado !== TRUE) { $conectado = $ftpCon->login(); }
$existe = FALSE; } } // zipeo y muevo a carpeta de "envios" $shellCmd = "cd " . $tmpDir . "; zip -r ../../../" . ZIP_DIR . "/{$zipFile} * "; $log .= exec($shellCmd); $log .= "\tZip " . ZIP_DIR . "/{$zipFile} generado exitosamente\n"; } else { if ($tipoCarga == "update") { //------------------------ // si es update //------------------------ foreach ($listaIds as $i => $contentId) { $contentId = trim($contentId); $log .= "\tprocessando {$contentId} \n"; $realtone = new migRealtone($dbc, $debug, "", "", $isPoly); try { $realtone->loadContent($contentId); } catch (Exception $e) { $log .= "loadContent: " . $e->getMessage() . "\n"; } try { $realtone->setLangs(array_keys($idiomas_elegidos)); $realtone->setMerchants(array_keys($paises_elegidos)); $realtone->setTag($catmig); $realtone->setSubTag($subcatmig); $realtone->setTag($catmigen, 'en'); $realtone->setSubTag($subcatmigen, 'en'); $xmlContent = $realtone->updateXML(); $arrayMuestra[] = $realtone->getArraySubForm(); $total++;
$existe = FALSE; } } // zipeo y muevo a carpeta de "envios" $shellCmd = "cd " . $tmpDir . "; zip -r ../../../" . ZIP_DIR . "/{$zipFile} * "; $log .= exec($shellCmd); $log .= "\tZip " . ZIP_DIR . "/{$zipFile} generado exitosamente\n"; } else { if ($tipoCarga == "update") { //------------------------ // si es update //------------------------ foreach ($listaIds as $i => $contentId) { $contentId = trim($contentId); $log .= "\tprocessando {$contentId}\n"; $tone = new migRealtone($dbc, $debug, $catLvl, $webCat, true, $rating, $marca, $festivo); try { $tone->loadContent($contentId); } catch (Exception $e) { $log .= "loadContent: " . $e->getMessage() . "\n"; } try { $xmlContent = $realtone->updateXML(); $arrayMuestra[] = $realtone->getArraySubForm(); $total++; $d2 = $tmpDir . "/metadata_update/"; $realtone->setDirToWrite($d2); if (!file_exists($d1)) { exec("mkdir {$d1}"); } if (!file_exists($d2)) {
exec("mkdir {$sessDir}"); } $tmpDir = $sessDir; if (!is_writable($tmpDir)) { die("ERROR: " . $tmpDir . " is not writable\n"); } else { $log .= "borrando tmp dir\n"; exec("rm -rf " . $tmpDir . "/*"); } if (!is_writable(ZIP_DIR)) { die("ERROR: " . ZIP_DIR . " is not writable\n"); } foreach ($listaIds as $i => $contentId) { $contentId = trim($contentId); $log .= "\tprocessando {$contentId} con rating {$rating} \n"; $realtone = new migRealtone($dbc, $debug, $catLvl, $webCat, $isPoly, $rating); try { $realtone->loadContent($contentId); } catch (Exception $e) { $log .= "loadContent: " . $e->getMessage() . "\n"; } $realtone->setTag($catmig); $realtone->setSubTag($subcatmig); //$realtone->setKeywords($keywords[$i]); // $realtone->setShortDesc($shortDesc[$i]); // $realtone->setLongDesc($longDesc[$i]); try { $content_download = FALSE; $log .= "\tdescargando contenido...\n"; $ftpCon = new Ftp(); $conectado = $ftpCon->login_r(null, null, FTP_CONN_RETRIES);