本文整理汇总了PHP中sfDatabaseManager::loadConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP sfDatabaseManager::loadConfiguration方法的具体用法?PHP sfDatabaseManager::loadConfiguration怎么用?PHP sfDatabaseManager::loadConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfDatabaseManager
的用法示例。
在下文中一共展示了sfDatabaseManager::loadConfiguration方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
<?php
require_once dirname(__FILE__) . '/../config/ProjectConfiguration.class.php';
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false);
sfContext::createInstance($configuration);
$databaseManager = new sfDatabaseManager($configuration);
$databaseManager->loadConfiguration();
if (!($conn = Doctrine_Manager::getInstance()->getCurrentConnection())) {
echo "Could not connect to Database.";
die;
}
GcrTrialTable::executeTrialCron();
GcrInstitutionTable::executeAccountingCron();
示例2: dirname
<?php
require_once dirname(__FILE__) . '/../../config/ProjectConfiguration.class.php';
$configuration = ProjectConfiguration::getApplicationConfiguration('platform', 'prod', true);
sfContext::createInstance($configuration);
$logger = sfContext::getInstance()->getLogger();
// Initialize database manager.
$dbManager = new sfDatabaseManager($configuration);
$dbManager->loadConfiguration();
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2004 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Antony Dovgal <tony2001@phpclub.net> |
| Mikael Johansson <mikael AT synd DOT info> |
| Harun Yayli <harunyayli at gmail.com> |
+----------------------------------------------------------------------+
*/
$VERSION = '$Id: memcache.php,v 0.2 2008/06/02 Exp $';
define('ADMIN_USERNAME', 'xx');
// Admin Username
示例3: loadSymfony
public static function loadSymfony()
{
require_once gcr::rootDir . 'config/ProjectConfiguration.class.php';
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false);
sfContext::createInstance($configuration);
$databaseManager = new sfDatabaseManager($configuration);
$databaseManager->loadConfiguration();
}
示例4: execute
protected function execute($arguments = array(), $options = array())
{
try {
sfContext::getInstance();
} catch (Exception $e) {
// aize the database connection
$configuration = ProjectConfiguration::getApplicationConfiguration($options['application'], $options['env'], true);
sfContext::createInstance($configuration);
}
$databaseManager = new sfDatabaseManager($this->configuration);
$databaseManager->loadConfiguration();
$connection = $databaseManager->getDatabase($options['connection'])->getConnection();
$originalPostToServicesValue = sfConfig::get('app_settings_post_to_services');
sfConfig::set('app_settings_post_to_services', 0);
$this->log("Using mongo host: " . sfConfig::get('app_mongodb_host'));
$lUserHugo = UserTable::retrieveByUsername('hugo');
$lHugoOis = $lUserHugo->getOnlineIdentitesAsArray();
$lUserJames = UserTable::retrieveByUsername('james');
$lJamesOis = $lUserJames->getOnlineIdentitesAsArray();
$lCommunityTwitter = CommunityTable::retrieveByCommunity('twitter');
$lCommunityFb = CommunityTable::retrieveByCommunity('facebook');
$lOiHugoTwitter = OnlineIdentityTable::retrieveByAuthIdentifier('http://twitter.com/account/profile?user_id=21092406', $lCommunityTwitter->getId());
$lOiJamesFacebook = OnlineIdentityTable::retrieveByAuthIdentifier('james_fb', $lCommunityFb->getId());
$urls = array('www.snirgel.de', 'notizblog.org', 'www.missmotz.de');
$tags = array('geekstuff', 'otherthings', 'schuhe');
$users = array($lUserHugo, $lUserJames);
$services = array('facebook', 'twitter', 'linkedin', 'google');
$deals = array('Campaign No. 1', 'Campaign No. 2', 'Campaign No. 3');
$dm = MongoManager::getDM();
for ($i = 0; $i < 100; $i++) {
$url = $this->oneOfThese($urls);
$tag = $this->oneOfThese($tags);
$user = $this->oneOfThese($users);
$cb_ref = $this->oneOfThese(array('', '', '', '', '', '', 'http://tierscheisse.de'));
$ra = $this->random(1000);
$theC = mt_rand(strtotime("3 days ago"), strtotime("today"));
$array = array('url' => "http://{$url}/{$ra}", 'url_hash' => "hash.{$ra}", 'u_id' => $user->getId(), 'oiids' => $user->getOnlineIdentitesAsArray(), 'tags' => $tag . $ra, 'title' => "{$url} title", 'descr' => "{$url} description", 'comment' => "{$url} comment", 'c' => $theC, 'cb' => $this->randBoolean() ? $this->random(30) : 0, 'cb_referer' => $cb_ref != '' ? $cb_ref : null, 'cb_service' => $cb_ref != '' ? $this->oneOfThese($services) : null);
$lActivity = new Documents\YiidActivity();
$lActivity->fromArray($array);
try {
$lActivity->skipUrlCheck = true;
$lActivity->save();
} catch (Exception $e) {
$this->log($e->getMessage());
}
}
// same for deals
for ($i = 0; $i < 100; $i++) {
$url = $this->oneOfThese($urls);
$tag = $this->oneOfThese($tags);
$user = $this->oneOfThese($users);
$cb_ref = $this->oneOfThese(array('', '', '', '', '', '', 'http://tierscheisse.de'));
$i_url = $this->oneOfThese(array('http://ard.de', 'http://bild.de', 'http://spiegel.de', 'http://tierscheisse.de'));
$ra = $this->random(1000);
$theC = mt_rand(strtotime("3 days ago"), strtotime("today"));
$deal = DealTable::getInstance()->findOneByName($this->oneOfThese($deals));
$array = array('url' => "http://{$url}/{$ra}", 'url_hash' => "hash.{$ra}", 'u_id' => $user->getId(), 'oiids' => $user->getOnlineIdentitesAsArray(), 'tags' => $tag . $ra, 'title' => "{$url} title", 'descr' => "{$url} description", 'comment' => "{$url} comment", 'c' => $theC, 'd_id' => $deal->getId(), 'cb' => $this->randBoolean() ? $this->random(30) : 0, 'cb_referer' => $cb_ref != '' ? $cb_ref : null, 'i_url' => $i_url, 'cb_service' => $cb_ref != '' ? $this->oneOfThese($services) : null);
$lActivity = new Documents\YiidActivity();
$lActivity->fromArray($array);
try {
$lActivity->skipUrlCheck = true;
$lActivity->save();
} catch (Exception $e) {
$this->log($e->getMessage());
}
}
$ds = new Documents\DomainSettings();
$ds->setDomain("blog.local");
$ds->setMute(0);
$ds->save();
$ds = new Documents\DomainSettings();
$ds->setDomain("pfefferle.org");
$ds->setDisableAds(true);
$ds->save();
$ad = new Documents\Advertisement();
$ad->setDomains(array("pfefferle.org", "notizblog.org", "www.spiegel.de", "blog.local"));
$ad->setAdCode('<script type="text/javascript" src="http://a.ligatus.com/?ids=34548&t=js"></script>');
$ad->setUpdatedAt(strtotime("now"));
$ad->setStartingAt(strtotime("now"));
$ad->setAdHeight(500);
$ad->setAdWidth(50);
$ad->save();
$ad = new Documents\Advertisement();
$ad->setDomains(array("blog.local"));
$ad->setAdCode("<script type='text/javascript' src='http://imagesrv.adition.com/js/adition.js'></script>\n<script type='text/javascript' src='http://ad4.adfarm1.adition.com/js?wp_id=744125'></script>");
$ad->setUpdatedAt(strtotime("now"));
$ad->setStartingAt(strtotime("now"));
$ad->setAdHeight(100);
$ad->setAdWidth(800);
$ad->save();
$ad = new Documents\Advertisement();
$ad->setDomains(array("pfefferle.org", "notizblog.org", "www.spiegel.de", "blog.local"));
$ad->setAdCode('<script type="text/javascript"><!--
google_ad_client = "ca-pub-1406192967534280";
/* spreadly */
google_ad_slot = "7458728780";
google_ad_width = 250;
google_ad_height = 250;
//-->
</script>
//.........这里部分代码省略.........