Ejemplo n.º 1
0
    # Truncate the current collections tables, and reset all collection id's
    if (SpotCommandline::get('clean')) {
        $dbConnection = $daoFactory->getConnection();
        echo "Cleaning up all existing collections, ";
        $dbConnection->rawExec('UPDATE spots SET collectionid = NULL WHERE collectionid IS NOT NULL');
        $dbConnection->rawExec('TRUNCATE collections');
        $dbConnection->rawExec('TRUNCATE mastercollections');
        echo "done." . PHP_EOL;
    }
    // if
    /* Load the complete collection cache in memory */
    echo "Loading all existing collections in memory, ";
    $daoFactory->getCollectionsDao()->loadCollectionCache(array());
    echo "done" . PHP_EOL;
    /* And start creating ocllections */
    $svcCreateColl = new Services_Collections_Create($daoFactory);
    $svcCreateColl->createCollections(0, 'displayProgress');
    /*
     * And actually start updating or creating the schema and settings
     */
    echo "Done creating collections" . PHP_EOL;
} catch (Exception $x) {
    echo PHP_EOL . PHP_EOL;
    echo 'SpotWeb crashed' . PHP_EOL . PHP_EOL;
    echo "Creation of collections failed:" . PHP_EOL;
    echo "   " . $x->getMessage() . PHP_EOL;
    echo PHP_EOL . PHP_EOL;
    echo $x->getTraceAsString();
    die(1);
}
# catch
Ejemplo n.º 2
0
  * Actually retrieve spots from the server
  */
 $currentMaxSpotId = $spotDao->getMaxSpotId();
 $retriever = new Services_Retriever_Spots($daoFactory, $settings, $forceMode, $retroMode);
 $newSpotCount = $retriever->perform();
 # Show the cumulative timings of the spotsretrieval
 if ($showTiming) {
     SpotTiming::displayCumul();
     SpotTiming::clear();
 }
 # if
 ## Create collections, if enabled
 if ($settings->get('create_collections')) {
     echo "Creating collections starting from " . $currentMaxSpotId . ", ";
     $svcPrvCreateColl = new Services_Collections_Create($daoFactory);
     $svcPrvCreateColl->createCollections($currentMaxSpotId, null);
     echo ", done" . PHP_EOL;
 }
 // if
 ## Creating filter counts
 if ($newSpotCount > 0) {
     $svcPrv_cacheSpotCount = new Services_Actions_CacheNewSpotCount($daoFactory->getUserFilterCountDao(), $daoFactory->getUserFilterDao(), $daoFactory->getSpotDao(), new Services_Search_QueryParser($daoFactory->getConnection()));
     echo 'Calculating how many spots are new';
     $notifyNewArray = $svcPrv_cacheSpotCount->cacheNewSpotCount();
     echo ', done.' . PHP_EOL;
     # Show the cumulative timings of the caching of these spots
     if ($showTiming) {
         SpotTiming::displayCumul();
         SpotTiming::clear();
     }
     # if