Esempio n. 1
0
<?php

include 'config.php';
//this script rebuilds search indexes
$coll_ascii_id = 'what_jane_saw';
$coll_ascii_id = 'cola_images';
$coll = new Dase_DBO_Collection($db);
$coll->orderBy('item_count ASC');
if ($coll_ascii_id) {
    $coll->ascii_id = $coll_ascii_id;
}
foreach ($coll->find() as $c) {
    $start = Dase_Util::getTime();
    print "working on " . $c->collection_name . "(" . $c->item_count . " items)\n";
    $c->buildSearchIndex('');
    $end = Dase_Util::getTime();
    $total = $end - $start;
    print $total . " seconds\n";
}
Esempio n. 2
0
 public function getElapsed()
 {
     $now = Dase_Util::getTime();
     return round($now - START_TIME, 4);
 }
Esempio n. 3
0
if ($config->getAppSettings('force_https')) {
    if ('on' != $_SERVER['HTTPS']) {
        $secure_url = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
        header("Location:{$secure_url}");
    }
}
//imagemagick
define('CONVERT', $config->getAppSettings('convert'));
//log file
define('LOG_FILE', $config->getLogDir() . '/dase.log');
define('FAILED_SEARCH_LOG', $config->getLogDir() . '/failed_searches.log');
define('DEBUG_LOG', $config->getLogDir() . '/debug.log');
//log level
define('LOG_LEVEL', $config->getAppSettings('log_level'));
//media directory
define('MEDIA_DIR', $config->getMediaDir());
//db table prefix
define('TABLE_PREFIX', $config->getDb('table_prefix'));
//cache type
define('CACHE_TYPE', $config->getCacheType());
define('SMARTY_CACHE_DIR', $config->getCacheDir());
//max items diplayed per page
define('MAX_ITEMS', $config->getAppSettings('max_items'));
//main title
define('MAIN_TITLE', $config->getAppSettings('main_title'));
//custom page logo
define('PAGE_LOGO_LINK_TARGET', $config->getLocalSettings('page_logo_link_target'));
define('PAGE_LOGO_SRC', $config->getLocalSettings('page_logo_src'));
//timer
define('START_TIME', Dase_Util::getTime());
Esempio n. 4
0
 function __destruct()
 {
     //see http://bugs.php.net/bug.php?id=34206
     // if strange 'failed to open stream' messages appear
     $now = Dase_Util::getTime();
     $elapsed = round($now - START_TIME, 4);
     Dase_Log::debug(LOG_FILE, 'finished request ' . $elapsed);
 }
Esempio n. 5
0
 public function postToSolr($item, $commit = true)
 {
     $start_check = Dase_Util::getTime();
     $start_get_doc = Dase_Util::getTime();
     $check_elapsed = round($start_get_doc - $start_check, 4);
     Dase_Log::debug(LOG_FILE, 'post to SOLR: ' . $this->solr_update_url . ' item ' . $item->getUnique());
     $solr_doc = $this->buildItemSolrDoc($item);
     //return $solr_doc;
     $start_index = Dase_Util::getTime();
     $get_doc_elapsed = round($start_index - $start_get_doc, 4);
     $resp = Dase_Http::post($this->solr_update_url, $solr_doc, null, null, 'text/xml');
     if ($commit) {
         Dase_Http::post($this->solr_update_url, '<commit/>', null, null, 'text/xml');
     }
     $end = Dase_Util::getTime();
     $index_elapsed = round($end - $start_index, 4);
     return $resp . ' check: ' . $check_elapsed . ' get_doc: ' . $get_doc_elapsed . ' index: ' . $index_elapsed;
 }
Esempio n. 6
0
 function __destruct()
 {
     $now = Dase_Util::getTime();
     $elapsed = round($now - START_TIME, 4);
     Dase_Log::debug(LOG_FILE, 'finished templating ' . $elapsed);
 }