本文整理汇总了PHP中CF_Authentication类的典型用法代码示例。如果您正苦于以下问题:PHP CF_Authentication类的具体用法?PHP CF_Authentication怎么用?PHP CF_Authentication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CF_Authentication类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: doRackspaceUploadNewDeleteOld
function doRackspaceUploadNewDeleteOld($RS_USERNAME, $RS_KEY)
{
//get the most recent grouping of files.
$arrRecentFiles = getMostRecentFiles();
sort($arrRecentFiles);
if (count($arrRecentFiles > 0)) {
//============================================ get our rackspace auth, connection, and container set up =====================================
//Create the authentication instance
$auth = new CF_Authentication($RS_USERNAME, $RS_KEY);
//Perform authentication request
$auth->authenticate();
//Create a connection to the storage/cdn system(s) and pass in the validated CF_Authentication instance.
$conn = new CF_Connection($auth);
//get the "salesforce_backups" container
$cont = $conn->get_container('salesforce_backups');
//============================================ end get our rackspace auth, connection, and container set up =====================================
//get the date prefix off of the most recent grouping of local files
$recentFileDate = getDatePrefix($arrRecentFiles[0]);
//get the listing of files from rackspace cloud files
$arrRackspaceFiles = $cont->list_objects();
sort($arrRackspaceFiles);
//get a distinct listing off all the rackspace prefixes (Dates)
$arrRackspaceDistinctPrefixes = filterDistinctPrefixes($arrRackspaceFiles);
//see if the most recent local date is in rackspace or not
if (!in_array($recentFileDate, $arrRackspaceDistinctPrefixes)) {
//we haven't uploaded our most recent local files yet to rackspace. Let's do it.
uploadToRackspace($cont, $arrRecentFiles);
}
//refresh our container and objects so we are sure the newly included files are in them
$cont = $conn->get_container('salesforce_backups');
//if we have more than 4 distinct date range prefixes (more than 4 weekly backups), delete the older ones so we are just left with the 4 most recent.
deleteOlderBackups($conn, $cont);
}
}
开发者ID:robertjustjones,项目名称:salesforceDataBackup,代码行数:34,代码来源:getData.php
示例2: wmfGetSwiftThumbContainer
/**
* Get the Swift thumbnail container for this wiki.
*
* @param $site string
* @param $lang string
* @param $relPath string Path relative to container
* @return CF_Container|null
*/
function wmfGetSwiftThumbContainer($site, $lang, $relPath)
{
global $wmfSwiftConfig;
// from PrivateSettings.php
$auth = new CF_Authentication($wmfSwiftConfig['user'], $wmfSwiftConfig['key'], NULL, $wmfSwiftConfig['authUrl']);
try {
$auth->authenticate();
} catch (Exception $e) {
wfDebugLog('swiftThumb', "Could not establish a connection to Swift.");
return null;
}
$conn = new CF_Connection($auth);
$wikiId = "{$site}-{$lang}";
// Get the full swift container name, including any shard suffix
$name = "{$wikiId}-local-thumb";
if (in_array($wikiId, array('wikipedia-commons', 'wikipedia-en'))) {
// Code stolen from FileBackend::getContainerShard()
if (preg_match("!^(?:[^/]{2,}/)*[0-9a-f]/(?P<shard>[0-9a-f]{2})(?:/|\$)!", $relPath, $m)) {
$name .= '.' . $m['shard'];
} else {
throw new MWException("Can't determine shard of path '{$relPath}' for '{$wikiId}'.");
}
}
try {
$container = $conn->get_container($name);
} catch (NoSuchContainerException $e) {
// container not created yet
$container = null;
wfDebugLog('swiftThumb', "Could not access `{$name}`; container does not exist.");
}
return $container;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:40,代码来源:swift.php
示例3: _init
/**
* Init connection object
*
* @param string $error
* @return boolean
*/
function _init(&$error)
{
if (empty($this->_config['user'])) {
$error = 'Empty username.';
return false;
}
if (empty($this->_config['key'])) {
$error = 'Empty API key.';
return false;
}
if (empty($this->_config['location'])) {
$error = 'Empty API key.';
return false;
}
switch ($this->_config['location']) {
default:
case 'us':
$host = US_AUTHURL;
break;
case 'uk':
$host = UK_AUTHURL;
break;
}
try {
$this->_auth = new CF_Authentication($this->_config['user'], $this->_config['key'], null, $host);
$this->_auth->ssl_use_cabundle();
$this->_auth->authenticate();
$this->_connection = new CF_Connection($this->_auth);
$this->_connection->ssl_use_cabundle();
} catch (Exception $exception) {
$error = $exception->getMessage();
return false;
}
return true;
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:41,代码来源:Rscf.php
示例4: connect
public function connect()
{
App::import('Vendor', 'rackspace-php-cloudfiles-5b45176/cloudfiles');
$auth = new CF_Authentication(Configure::read('Cloudfiles.username'), Configure::read('Cloudfiles.apikey'));
$auth->authenticate();
$conn = new CF_Connection($auth);
return $conn;
}
开发者ID:justinmc,项目名称:justinmccandless.com,代码行数:8,代码来源:Photo.php
示例5: initContainer
protected function initContainer()
{
if (!$this->containerInitiated) {
$auth = new \CF_Authentication($this->username, $this->apiKey);
$auth->authenticate();
$conn = new \CF_Connection($auth, $this->serviceNet);
$container = $conn->get_container($this->name);
parent::__construct($container->cfs_auth, $container->cfs_http, $container->name, $container->object_count, $container->bytes_used);
}
$this->containerInitiated = true;
}
开发者ID:geoffreytran,项目名称:zym,代码行数:11,代码来源:Container.php
示例6: __construct
public function __construct($config)
{
$return = parent::__construct($config);
require_once 'cloudfiles.php';
$auth = new CF_Authentication($this->config['rsc-username'], $this->config['rsc-apikey']);
$auth->authenticate();
$this->conn = new CF_Connection($auth);
if ($this->config['rsc-ssl_use_cabundle']) {
$this->conn->ssl_use_cabundle();
}
return $return;
}
开发者ID:radumargina,项目名称:webstyle-antcr,代码行数:12,代码来源:filemanager.rsc.class.php
示例7: authconn
public function authconn($use_servicenet)
{
$auth = new CF_Authentication($this->authname, $this->authkey);
try {
$auth->authenticate();
} catch (AuthenticationException $e) {
//for some reason this returns two error msgs. one is echo'd even without the below echo
echo $e->getMessage();
return false;
}
$this->conn = new CF_Connection($auth, $servicenet = $use_servicenet);
}
开发者ID:TheReaCompany,项目名称:pooplog,代码行数:12,代码来源:loader.php
示例8: getConnection
function getConnection()
{
require_once 'modulos/cdn/clases/cloudfiles.php';
$username = "netor27";
$api_key = "a4958be56757129de44332626cb0594b";
$auth = new CF_Authentication($username, $api_key);
$auth->authenticate();
//Creamos una conexión
//Si esta en el servidor con true
//$conn = new CF_Connection($auth, TRUE);
$conn = new CF_Connection($auth);
return $conn;
}
开发者ID:netor27,项目名称:Unova,代码行数:13,代码来源:cdnModelo.php
示例9: createSynchronizer
public function createSynchronizer()
{
$username = sfConfig::get('app_rackspace_username');
$key = sfConfig::get('app_rackspace_key');
$containerName = sfConfig::get('app_rackspace_container');
$webDir = sfConfig::get('sf_web_dir');
$ttl = sfConfig::get('app_rackspace_ttl');
$mimeTypeResolver = $this->get('mime_type_resolver');
$dispatcher = $this->get('dispatcher');
$this->logSection("rackspace", "Connecting '{$username}' to '{$containerName}'");
$auth = new CF_Authentication($username, $key);
$auth->authenticate();
$conn = new CF_Connection($auth);
$container = $conn->create_container($containerName);
$synchronizer = new knpDmRackspaceSynchronizer($container, $webDir, $ttl, $mimeTypeResolver, $dispatcher);
return $synchronizer;
}
开发者ID:KnpLabs,项目名称:knpDmRackspacePlugin,代码行数:17,代码来源:knpDmRackspaceSyncFilesTask.class.php
示例10: getAuth
private static function getAuth()
{
global $wgMemc;
$cacheKey = wfMemcKey('rscloudauth');
$auth = new CF_Authentication(WH_RSCLOUD_USERNAME, WH_RSCLOUD_API_KEY);
$creds = $wgMemc->get($cacheKey);
if (!$creds) {
# $auth->ssl_use_cabundle(); # bypass cURL's old CA bundle
$auth->authenticate();
// makes a call to a remote web server
$creds = $auth->export_credentials();
$wgMemc->set($cacheKey, $creds);
} else {
$auth->load_cached_credentials($creds['auth_token'], $creds['storage_url'], $creds['cdnm_url']);
}
return $auth;
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:17,代码来源:sync_images_to_rscf.php
示例11: createSynchronizer
protected function createSynchronizer()
{
require_once dirname(__FILE__) . '/../vendor/rackspace/cloudfiles.php';
$username = sfConfig::get('app_rackspace_username');
$key = sfConfig::get('app_rackspace_key');
$containerName = sfConfig::get('app_rackspace_container');
$webDir = sfConfig::get('sf_web_dir');
$ttl = sfConfig::get('app_rackspace_ttl');
$mimeTypeResolver = $this->container->getService('mime_type_resolver');
$dispatcher = $this->container->getService('dispatcher');
$auth = new CF_Authentication($username, $key);
$auth->authenticate();
$conn = new CF_Connection($auth);
$container = $conn->create_container($containerName);
$synchronizer = new knpDmRackspaceSynchronizer($container, $webDir, $ttl, $mimeTypeResolver, $dispatcher);
return $synchronizer;
}
开发者ID:KnpLabs,项目名称:knpDmRackspacePlugin,代码行数:17,代码来源:knpDmRackspacePluginConfiguration.class.php
示例12: connect
public function connect()
{
static $bConnected = false;
if ($bConnected === true) {
return;
}
require_once PHPFOX_DIR_LIB . 'rackspace/cloudfiles.php';
$oAuth = new CF_Authentication(Phpfox::getParam('core.rackspace_username'), Phpfox::getParam('core.rackspace_key'));
try {
$oAuth->authenticate();
} catch (Exception $e) {
Phpfox_Error::trigger('Rackspace error: ' . $e->getMessage(), E_USER_ERROR);
}
$this->_oObject = new CF_Connection($oAuth);
$this->_sBucket = Phpfox::getParam('core.rackspace_container');
$this->_oContainer = $this->_oObject->get_container($this->_sBucket);
$bConnected = true;
}
开发者ID:laiello,项目名称:kr-indian,代码行数:18,代码来源:rackspace.class.php
示例13: process_rackspace_copy
function process_rackspace_copy($rs_backup, $rs_username, $rs_api_key, $rs_container, $rs_server)
{
pb_backupbuddy::set_greedy_script_limits();
require_once pb_backupbuddy::plugin_path() . '/lib/rackspace/cloudfiles.php';
$auth = new CF_Authentication($rs_username, $rs_api_key, NULL, $rs_server);
$auth->authenticate();
$conn = new CF_Connection($auth);
// Set container
$container = $conn->get_container($rs_container);
// Get file from Rackspace
$rsfile = $container->get_object($rs_backup);
$destination_file = ABSPATH . 'wp-content/uploads/backupbuddy_backups/' . $rs_backup;
if (file_exists($destination_file)) {
$destination_file = str_replace('backup-', 'backup_copy_' . pb_backupbuddy::random_string(5) . '-', $destination_file);
}
$fso = fopen(ABSPATH . 'wp-content/uploads/backupbuddy_backups/' . $rs_backup, 'w');
$rsfile->stream($fso);
fclose($fso);
}
开发者ID:sonnetmedia,项目名称:otherpress.com,代码行数:19,代码来源:cron.php
示例14: auth
/**
* Creates a singleton connection handle
*
* @return CF_Connection
*/
private function auth()
{
if (is_null($this->conn)) {
$username = Mage::getStoreConfig('imagecdn/rackspace/username');
$api_key = Mage::getStoreConfig('imagecdn/rackspace/api_key');
$auth = new CF_Authentication($username, $api_key);
$auth->ssl_use_cabundle();
$auth->authenticate();
if ($auth->authenticated()) {
$this->conn = new CF_Connection($auth);
$this->conn->ssl_use_cabundle();
return $this->conn;
} else {
return false;
}
} else {
return $this->conn;
}
}
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:24,代码来源:Rackspace.php
示例15: connect
public static function connect($settings = array())
{
require_once dirname(__FILE__) . '/lib/rackspace/cloudfiles.php';
$auth = new CF_Authentication($settings['username'], $settings['api_key'], NULL, $settings['server']);
try {
$auth->authenticate();
} catch (Exception $e) {
global $pb_backupbuddy_destination_errors;
$message = 'Error #238338: Unable to authenticate to Rackspace Cloud Files. Details: `' . $e->getMessage() . '`.';
pb_backupbuddy::status('error', $message);
$pb_backupbuddy_destination_errors[] = $message;
return false;
}
//error_log( print_r( $auth, true ) );
if (isset($settings['service_net']) && '1' == $settings['service_net']) {
$sn_url = 'https://snet-' . substr($auth->storage_url, strlen('https://'));
$auth->storage_url = $sn_url;
}
$conn = new CF_Connection($auth);
return $conn;
}
开发者ID:Offirmo,项目名称:base-wordpress,代码行数:21,代码来源:init.php
示例16: setup
/**
* Set up Rackspace cloud files - used by rackspace:initialise task as well as constructor
*
* @see rackspaceInitialiseTask::execute()
* @var array $options Passed through from __construct
* @return CF_Container
*/
public static function setup($options)
{
$required_fields = array('container', 'api_key', 'username');
$adapter_options = $options['options'];
foreach ($required_fields as $f) {
if (!array_key_exists($f, $adapter_options)) {
throw new InvalidArgumentException(sprintf("Missing option '%s' is required", $f));
}
}
$adapter_options = array_merge(self::$adapter_options, $adapter_options);
$auth = new CF_Authentication($adapter_options['username'], $adapter_options['api_key'], null, 'UK' == $adapter_options['auth_host'] ? UK_AUTHURL : US_AUTHURL);
$auth->authenticate();
$conn = new CF_Connection($auth);
try {
$container = $conn->get_container($adapter_options['container']);
} catch (NoSuchContainerException $e) {
// Container doesn't already exist so create it
$container = $conn->create_container($adapter_options['container']);
$container->make_public();
}
return $container;
}
开发者ID:nixilla,项目名称:sfImagePoolPlugin,代码行数:29,代码来源:sfImagePoolRackspaceCloudFilesCache.class.php
示例17: wmfGetSwiftThumbContainer
/**
* Get the Swift thumbnail container for this wiki.
*
* @param $site string
* @param $lang string
* @return CF_Container|null
*/
function wmfGetSwiftThumbContainer( $site, $lang ) {
global $wmfSwiftConfig; // PrivateSettings.php
$auth = new CF_Authentication(
$wmfSwiftConfig['user'],
$wmfSwiftConfig['key'],
NULL,
$wmfSwiftConfig['authUrl']
);
$auth->authenticate();
$conn = new CF_Connection( $auth );
$name = "{$site}-{$lang}-media-thumb"; // swift container name
try {
$container = $conn->get_container( $name );
} catch ( NoSuchContainerException $e ) { // container not created yet
$container = null;
wfDebugLog( 'swiftThumb', "Could not access `{$name}`; container does not exist." );
}
return $container;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:30,代码来源:swift.php
示例18: connect
/**
* Connect to the CloudFiles Service
* @return boolean success
* @throws CloudFilesException
* @throws AuthenticationException
* @throws InvalidResponseException
*/
protected static function connect()
{
if ($server = self::$server_to_auth_map[self::getConfig('server')]) {
self::$Authentication = new CF_Authentication(self::getConfig('username'), self::getConfig('api_key'), null, $server);
self::$Authentication->ssl_use_cabundle();
self::$Authentication->authenticate();
$hostname = gethostname();
// Check to see if this is a rackspace node
if (stripos($hostname, 'rackspace') === FALSE) {
$serviceNet = FALSE;
} else {
$serviceNet = TRUE;
}
self::$Connection = new CF_Connection(self::$Authentication, $serviceNet);
}
$retval = !!self::$Connection;
if (!$retval) {
self::error("Unable to connect to rackspace, check your settings.");
}
return $retval;
}
开发者ID:rnavarro,项目名称:CakePHP-CloudFiles-Plugin,代码行数:28,代码来源:CloudFiles.php
示例19: authenticate
public function authenticate()
{
/** @var Host $host */
foreach ($this->hosts as $host) {
$config = $host->getAuthConfig();
$auth = new \CF_Authentication($config['swiftUser'], $config['swiftKey'], null, $config['swiftAuthUrl']);
$auth->authenticate();
$credentials = $auth->export_credentials();
$host->setCredentials($credentials['auth_token'], $credentials['storage_url']);
}
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:11,代码来源:Net.php
示例20: test_rackspace
function test_rackspace($rs_username, $rs_api_key, $rs_container, $rs_server)
{
if (empty($rs_username) || empty($rs_api_key) || empty($rs_container)) {
return __('Missing one or more required fields.', 'it-l10n-backupbuddy');
}
require_once pb_backupbuddy::plugin_path() . '/lib/rackspace/cloudfiles.php';
$auth = new CF_Authentication($rs_username, $rs_api_key, NULL, $rs_server);
if (!$auth->authenticate()) {
return __('Unable to authenticate. Verify your username/api key.', 'it-l10n-backupbuddy');
}
$conn = new CF_Connection($auth);
// Set container
$container = @$conn->get_container($rs_container);
// returns object on success, string error message on failure.
if (!is_object($container)) {
return __('There was a problem selecting the container:', 'it-l10n-backupbuddy') . ' ' . $container;
}
// Create test file
$testbackup = @$container->create_object('backupbuddytest.txt');
if (!$testbackup->load_from_filename(pb_backupbuddy::plugin_path() . '/readme.txt')) {
return __('BackupBuddy was not able to write the test file.', 'it-l10n-backupbuddy');
}
// Delete test file from Rackspace
if (!$container->delete_object('backupbuddytest.txt')) {
return __('Unable to delete file from container.', 'it-l10n-backupbuddy');
}
return true;
// Success
}
开发者ID:verbazend,项目名称:AWFA,代码行数:29,代码来源:core.php
注:本文中的CF_Authentication类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论