DbManager::setConfig($dbConf);
DbManager::initialize();
$c = new Criteria();
if ($argc > 1 && is_numeric($argv[1])) {
    $c->add(TagPeer::ID, $argv[1], Criteria::GREATER_EQUAL);
}
if ($argc > 2 && is_numeric($argv[2])) {
    $c->add(TagPeer::PARTNER_ID, $argv[2], Criteria::EQUAL);
}
$c->addAscendingOrderByColumn(TagPeer::ID);
$c->setLimit(10000);
$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
//$sphinxCon = DbManager::getSphinxConnection();
$tags = TagPeer::doSelect($c, $con);
$sphinx = new kSphinxSearchManager();
while (count($tags)) {
    foreach ($tags as $tag) {
        /* @var $tag Tag */
        KalturaLog::log('tag id ' . $tag->getId() . ' tag string [' . $tag->getTag() . '] crc id[' . $sphinx->getSphinxId($tag) . ']');
        try {
            $ret = $sphinx->saveToSphinx($tag, true);
        } catch (Exception $e) {
            KalturaLog::err($e->getMessage());
            exit - 1;
        }
    }
    $c->setOffset($c->getOffset() + count($tags));
    kMemoryManager::clearMemory();
    $tags = TagPeer::doSelect($c, $con);
}
KalturaLog::log('Done');
Пример #2
0
    $c->add(entryPeer::PARTNER_ID, $argv[2], Criteria::EQUAL);
}
if ($argc > 3 && is_numeric($argv[3])) {
    $c->add(entryPeer::INT_ID, $argv[3], Criteria::GREATER_EQUAL);
}
if ($argc > 4) {
    entryPeer::setUseCriteriaFilter((bool) $argv[4]);
}
$c->addAscendingOrderByColumn(entryPeer::UPDATED_AT);
$c->addAscendingOrderByColumn(entryPeer::ID);
$c->setLimit(10000);
$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
//$sphinxCon = DbManager::getSphinxConnection();
$entries = entryPeer::doSelect($c, $con);
$sphinx = new kSphinxSearchManager();
while (count($entries)) {
    foreach ($entries as $entry) {
        KalturaLog::log('entry id ' . $entry->getId() . ' int id[' . $entry->getIntId() . '] crc id[' . $sphinx->getSphinxId($entry) . '] updated at [' . $entry->getUpdatedAt(null) . ']');
        try {
            $ret = $sphinx->saveToSphinx($entry, true);
        } catch (Exception $e) {
            KalturaLog::err($e->getMessage());
            exit - 1;
        }
    }
    $c->setOffset($c->getOffset() + count($entries));
    kMemoryManager::clearMemory();
    $entries = entryPeer::doSelect($c, $con);
}
KalturaLog::log('Done. Cureent time: ' . time());
exit(0);
Пример #3
0
}
if ($argc > 3 && is_numeric($argv[3])) {
    $c->add(categoryPeer::ID, $argv[3], Criteria::GREATER_EQUAL);
}
if ($argc > 4) {
    categoryPeer::setUseCriteriaFilter((bool) $argv[4]);
}
$c->addAscendingOrderByColumn(categoryPeer::UPDATED_AT);
$c->addAscendingOrderByColumn(categoryPeer::ID);
$c->setLimit(10000);
$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
//$sphinxCon = DbManager::getSphinxConnection();
$categories = categoryPeer::doSelect($c, $con);
$sphinx = new kSphinxSearchManager();
while (count($categories)) {
    foreach ($categories as $category) {
        /* @var $category Category */
        KalturaLog::log('category id ' . $category->getId() . ' int id[' . $category->getIntId() . '] crc id[' . $sphinx->getSphinxId($category) . '] last updated at [' . $category->getUpdatedAt(null) . ']');
        try {
            $ret = $sphinx->saveToSphinx($category, true);
        } catch (Exception $e) {
            KalturaLog::err($e->getMessage());
            exit - 1;
        }
    }
    $c->setOffset($c->getOffset() + count($categories));
    kMemoryManager::clearMemory();
    $categories = categoryPeer::doSelect($c, $con);
}
KalturaLog::log('Done. Cureent time: ' . time());
exit(0);
Пример #4
0
$dbConf = kConf::getDB();
DbManager::setConfig($dbConf);
DbManager::initialize();
$c = new Criteria();
if ($argc > 1 && is_numeric($argv[1])) {
    $c->add(entryPeer::INT_ID, $argv[1], Criteria::GREATER_EQUAL);
}
$c->addAscendingOrderByColumn(entryPeer::INT_ID);
$c->setLimit(10000);
$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
//$sphinxCon = DbManager::getSphinxConnection();
$entries = entryPeer::doSelect($c, $con);
$sphinx = new kSphinxSearchManager();
while (count($entries)) {
    foreach ($entries as $entry) {
        KalturaLog::log('entry id ' . $entry->getId() . ' int id[' . $entry->getIntId() . '] crc id[' . $sphinx->getSphinxId($entry) . ']');
        try {
            $ret = $sphinx->saveToSphinx($entry, true);
        } catch (Exception $e) {
            KalturaLog::err($e->getMessage());
            exit - 1;
        }
    }
    $c->setOffset($c->getOffset() + count($entries));
    entryPeer::clearInstancePool();
    MetadataPeer::clearInstancePool();
    MetadataProfilePeer::clearInstancePool();
    MetadataProfileFieldPeer::clearInstancePool();
    $entries = entryPeer::doSelect($c, $con);
}
KalturaLog::log('Done');
    $c->add(CaptionAssetItemPeer::PARTNER_ID, $argv[2], Criteria::EQUAL);
}
if ($argc > 3 && is_numeric($argv[3])) {
    $c->add(CaptionAssetItemPeer::ID, $argv[3], Criteria::GREATER_EQUAL);
}
if ($argc > 4) {
    CaptionAssetItemPeer::setUseCriteriaFilter((bool) $argv[4]);
}
$c->addAscendingOrderByColumn(CaptionAssetItemPeer::CREATED_AT);
$c->addAscendingOrderByColumn(CaptionAssetItemPeer::ID);
$c->setLimit(10000);
$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
//$sphinxCon = DbManager::getSphinxConnection();
$captions = CaptionAssetItemPeer::doSelect($c, $con);
$sphinx = new kSphinxSearchManager();
while (count($captions)) {
    foreach ($captions as $caption) {
        KalturaLog::log('caption_asset_id ' . $caption->getId() . ' int id[' . $caption->getIntId() . '] crc id[' . $sphinx->getSphinxId($caption) . '] last updated at [' . $caption->getUpdatedAt(null) . ']');
        try {
            $ret = $sphinx->saveToSphinx($caption, true);
        } catch (Exception $e) {
            KalturaLog::err($e->getMessage());
            exit - 1;
        }
    }
    $c->setOffset($c->getOffset() + count($captions));
    kMemoryManager::clearMemory();
    $captions = CaptionAssetItemPeer::doSelect($c, $con);
}
KalturaLog::log('Done. Cureent time: ' . time());
exit(0);