//------------------------ // 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++; $d2 = $tmpDir . "/{$contentId}/"; $realtone->setDirToWrite($d2); if (!file_exists($d1)) { exec("mkdir {$d1}"); } if (!file_exists($d2)) { exec("mkdir {$d2}"); } $written = file_put_contents($realtone->getDirToWrite() . $xmlFile, $xmlContent);
} 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(); } if ($conectado !== TRUE) { $conectado = $ftpCon->login(); } if ($conectado !== TRUE) { $conectado = $ftpCon->login(); } if ($conectado === TRUE) { $to = TMP_DIR_PT . "/" . $tone->getContentFilenameFull();
$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); if ($conectado === TRUE) { $content_download = $realtone->downloadContent($ftpCon); } else { echo "ERROR: no se puede loguear al ftp\n"; } if ($content_download === TRUE) {