Esempio n. 1
0
Zotero_DB::addCallback("commit", array(Z_Core::$MC, "commit"));
Zotero_DB::addCallback("reset", array(Z_Core::$MC, "reset"));
//
// Set up AWS service factory
//
$awsConfig = ['region' => !empty(Z_CONFIG::$AWS_REGION) ? Z_CONFIG::$AWS_REGION : 'us-east-1', 'version' => 'latest', 'signature' => 'v4'];
// IAM role authentication
if (empty(Z_CONFIG::$AWS_ACCESS_KEY)) {
    // If APC cache is available, use that to cache temporary credentials
    if (function_exists('apc_store')) {
        $cache = new \Doctrine\Common\Cache\ApcCache();
    } else {
        $cache = new \Doctrine\Common\Cache\FilesystemCache(Z_ENV_BASE_PATH . 'tmp/cache');
    }
    $awsConfig['credentials'] = new \Aws\DoctrineCacheAdapter($cache);
} else {
    $awsConfig['credentials'] = ['key' => Z_CONFIG::$AWS_ACCESS_KEY, 'secret' => Z_CONFIG::$AWS_SECRET_KEY];
}
Z_Core::$AWS = new Aws\Sdk($awsConfig);
unset($awsConfig);
// Elastica
Z_Core::$Elastica = new \Elastica\Client(array('connections' => array_map(function ($hostAndPort) {
    preg_match('/^([^:]+)(:[0-9]+)?$/', $hostAndPort, $matches);
    return ['host' => $matches[1], 'port' => isset($matches[2]) ? $matches[2] : 9200];
}, Z_CONFIG::$SEARCH_HOSTS)));
require 'interfaces/IAuthenticationPlugin.inc.php';
require 'log.inc.php';
Z_Core::$debug = !empty(Z_CONFIG::$DEBUG_LOG);
// Load in functions
require 'functions/string.inc.php';
require 'functions/array.inc.php';
Esempio n. 2
0
Zotero_NotifierObserver::init();
// Memcached
require 'Memcached.inc.php';
Z_Core::$MC = new Z_MemcachedClientLocal(Z_CONFIG::$SYNC_DOMAIN, array('disabled' => !Z_CONFIG::$MEMCACHED_ENABLED, 'servers' => Z_CONFIG::$MEMCACHED_SERVERS));
Zotero_DB::addCallback("begin", array(Z_Core::$MC, "begin"));
Zotero_DB::addCallback("commit", array(Z_Core::$MC, "commit"));
Zotero_DB::addCallback("reset", array(Z_Core::$MC, "reset"));
//
// Set up AWS service factory
//
$awsConfig = ['region' => !empty(Z_CONFIG::$AWS_REGION) ? Z_CONFIG::$AWS_REGION : 'us-east-1'];
// IAM role authentication
if (empty(Z_CONFIG::$AWS_ACCESS_KEY)) {
    $awsConfig['credentials.cache'] = new Guzzle\Cache\DoctrineCacheAdapter(new Doctrine\Common\Cache\FilesystemCache(Z_ENV_BASE_PATH . 'tmp/cache'));
} else {
    $awsConfig['key'] = Z_CONFIG::$AWS_ACCESS_KEY;
    $awsConfig['secret'] = Z_CONFIG::$AWS_SECRET_KEY;
}
Z_Core::$AWS = \Aws\Common\Aws::factory($awsConfig);
unset($awsConfig);
// Elastica
Z_Core::$Elastica = new \Elastica\Client(array('connections' => array_map(function ($hostAndPort) {
    preg_match('/^([^:]+)(:[0-9]+)?$/', $hostAndPort, $matches);
    return ['host' => $matches[1], 'port' => isset($matches[2]) ? $matches[2] : 9200];
}, Z_CONFIG::$SEARCH_HOSTS)));
require 'interfaces/IAuthenticationPlugin.inc.php';
require 'log.inc.php';
Z_Core::$debug = !empty(Z_CONFIG::$DEBUG_LOG);
// Load in functions
require 'functions/string.inc.php';
require 'functions/array.inc.php';