Exemplo n.º 1
0
function article_custom($atts)
{
    return parseArticles($atts, '1');
}
Exemplo n.º 2
0
function article_custom($atts, $thing = null)
{
    return parseArticles($atts, '1', $thing);
}
$script->initialize();

$cli->output( 'Process update tags' );

try
{
    if (!isset($options['tags']) || $options['tags'] == '')
    {
        throw new Exception('Tags must be setted');
    }

    //connect to merck model
    $db = MMSynchDb::instance();

    //get all articles
    $articlesTags = parseArticles($options['tags']);

    $selectArticleQuery = 'SELECT id, language FROM article WHERE publisher_internal_id = "%s"';
    $updateArticleQuery = 'UPDATE article SET tags = "%s" WHERE id = %d';
    $selectImportStatusQuery = 'SELECT id FROM import_status WHERE article_id = %d ORDER BY version DESC LIMIT 1';
    $updateImportStatusQuery = 'UPDATE import_status SET status_mdd_ez = 0 WHERE id = %d';

    foreach ($articlesTags as $publisher_internal_id => $tags)
    {
        $cli->output( '[' . $publisher_internal_id . '] : ' . $tags );

        //get all articles with publisher_internal_id
        $articles = $db->arrayQuery(sprintf($selectArticleQuery, $publisher_internal_id));

        if(count($articles) > 0)
        {