/**
  * @see sfPluginConfiguration
  */
 public function initialize()
 {
     sfConfig::set('sf_orm', 'propel');
     if (!sfConfig::get('sf_admin_module_web_dir')) {
         sfConfig::set('sf_admin_module_web_dir', '/sfPropelPlugin');
     }
     sfToolkit::addIncludePath(array(sfConfig::get('sf_root_dir'), sfConfig::get('sf_propel_runtime_path', realpath(dirname(__FILE__) . '/../lib/vendor'))));
     require_once 'propel/Propel.php';
     if (!Propel::isInit()) {
         if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) {
             Propel::setLogger(new sfPropelLogger($this->dispatcher));
         }
         $propelConfiguration = new PropelConfiguration();
         Propel::setConfiguration($propelConfiguration);
         $this->dispatcher->notify(new sfEvent($propelConfiguration, 'propel.configure'));
         Propel::initialize();
     }
     $this->dispatcher->connect('user.change_culture', array('sfPropel', 'listenToChangeCultureEvent'));
     if (sfConfig::get('sf_web_debug')) {
         $this->dispatcher->connect('debug.web.load_panels', array('sfWebDebugPanelPropel', 'listenToAddPanelEvent'));
     }
     if (sfConfig::get('sf_test')) {
         $this->dispatcher->connect('context.load_factories', array($this, 'clearAllInstancePools'));
     }
 }
 public function __construct()
 {
     $this->wwwPath = Curry_Core::$config->curry->wwwPath;
     Propel::disableInstancePooling();
     Propel::setLogger(null);
     if ($this->debug) {
         $this->con = Propel::getConnection(PagePeer::DATABASE_NAME);
         $this->con->useDebug(true);
     }
     $this->setupLogger();
 }
 /**
  * Initialize this data source.
  *
  * @param      AgaviContext The current application context.
  * @param      array        An associative array of initialization parameters.
  *
  * @throws     <b>AgaviInitializationException</b> If an error occurs while
  *                                                 initializing.
  *
  */
 public function initialize(AgaviContext $context, array $parameters = array())
 {
     parent::initialize($context, $parameters);
     $pdo = $this->context->getDatabaseConnection($this->getParameter('database_name'));
     if ($pdo instanceof DebugPDO) {
         $pdo->setLogger($this);
     } else {
         $this->log('NOTICE: The PDO connection might not support query logging. Refer to Propel documentation on how to enable full query logging.');
     }
     Propel::setLogger($this);
 }
Example #4
0
 public static function initialize()
 {
     $dbConfigs = array();
     $pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaDatabaseConfig');
     foreach ($pluginInstances as $pluginInstance) {
         $dbConfigs[] = $pluginInstance->getDatabaseConfig();
     }
     foreach ($dbConfigs as $dbConfig) {
         self::addExtraConfiguration($dbConfig);
     }
     Propel::setConfiguration(self::$config);
     Propel::setLogger(KalturaLog::getInstance());
     Propel::initialize();
 }
 public static function initialize()
 {
     $dbConfigs = self::getExtraDatabaseConfigs();
     foreach ($dbConfigs as $dbConfig) {
         self::addExtraConfiguration($dbConfig);
     }
     Propel::setConfiguration(self::$config);
     Propel::setLogger(KalturaLog::getInstance());
     try {
         Propel::initialize();
     } catch (PropelException $pex) {
         KalturaLog::alert($pex->getMessage());
         throw new PropelException("Database error");
     }
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function boot()
 {
     require_once $this->container->getParameter('propel.path') . '/runtime/lib/Propel.php';
     if (0 === strncasecmp(PHP_SAPI, 'cli', 3)) {
         set_include_path($this->container->getParameter('propel.phing_path') . '/classes' . PATH_SEPARATOR . get_include_path());
     }
     if (!\Propel::isInit()) {
         \Propel::setConfiguration($this->container->get('propel.configuration'));
         if ($this->container->getParameter('propel.logging')) {
             $this->container->get('propel.configuration')->setParameter('debugpdo.logging.details', array('time' => array('enabled' => true), 'mem' => array('enabled' => true)));
             \Propel::setLogger($this->container->get('propel.logger'));
         }
         \Propel::initialize();
     }
 }
 /**
  * {@inheritdoc}
  */
 public function boot()
 {
     require_once $this->container->getParameter('propel.path') . '/runtime/lib/Propel.php';
     if (0 === strncasecmp(PHP_SAPI, 'cli', 3)) {
         set_include_path($this->container->getParameter('kernel.root_dir') . '/..' . PATH_SEPARATOR . $this->container->getParameter('propel.phing_path') . PATH_SEPARATOR . $this->container->getParameter('propel.phing_path') . '/classes' . PATH_SEPARATOR . get_include_path());
     }
     if (!\Propel::isInit()) {
         \Propel::setConfiguration($this->container->get('propel.configuration'));
         if ($this->container->getParameter('propel.logging')) {
             $config = $this->container->get('propel.configuration');
             $config->setParameter('debugpdo.logging.methods', array('PropelPDO::exec', 'PropelPDO::query', 'PropelPDO::prepare', 'DebugPDOStatement::execute'), false);
             $config->setParameter('debugpdo.logging.details', array('time' => array('enabled' => true), 'mem' => array('enabled' => true), 'connection' => array('enabled' => true)));
             \Propel::setLogger($this->container->get('propel.logger'));
         }
         \Propel::initialize();
     }
 }
Example #8
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct();
     // Override and increase max execution time if set
     $timeLimit = ini_get('max_execution_time');
     if ($timeLimit && $timeLimit < 250) {
         @set_time_limit(250);
     }
     Propel::disableInstancePooling();
     Propel::setLogger(null);
     // make sure all classes are included
     foreach (Curry_Propel::getModels() as $classes) {
         foreach ($classes as $clazz) {
             class_exists($clazz . 'Peer', true);
         }
     }
 }
Example #9
0
 /**
  * {@inheritdoc}
  */
 public function boot()
 {
     trigger_error("The PropelBundle uses a new branching model, you should switch to the 1.1 branch (1.1.x versions). For more information, please read: https://github.com/propelorm/PropelBundle/wiki", E_USER_DEPRECATED);
     require_once $this->container->getParameter('propel.path') . '/runtime/lib/Propel.php';
     if (0 === strncasecmp(PHP_SAPI, 'cli', 3)) {
         set_include_path($this->container->getParameter('kernel.root_dir') . '/..' . PATH_SEPARATOR . $this->container->getParameter('propel.phing_path') . PATH_SEPARATOR . $this->container->getParameter('propel.phing_path') . '/classes' . PATH_SEPARATOR . get_include_path());
     }
     if (!\Propel::isInit()) {
         \Propel::setConfiguration($this->container->get('propel.configuration'));
         if ($this->container->getParameter('propel.logging')) {
             $config = $this->container->get('propel.configuration');
             $config->setParameter('debugpdo.logging.methods', array('PropelPDO::exec', 'PropelPDO::query', 'PropelPDO::prepare', 'DebugPDOStatement::execute'), false);
             $config->setParameter('debugpdo.logging.details', array('time' => array('enabled' => true), 'mem' => array('enabled' => true), 'connection' => array('enabled' => true)));
             \Propel::setLogger($this->container->get('propel.logger'));
         }
         \Propel::initialize();
     }
 }
Example #10
0
 /**
  * Initialize sfymfony propel
  *
  * @param sfEventDispatcher $dispatcher
  * @param string $culture
  */
 public static function initialize(sfEventDispatcher $dispatcher, $culture = null)
 {
     if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) {
         // add propel logger
         Propel::setLogger(new sfPropelLogger($dispatcher));
     }
     // propel initialization
     $configuration = sfPropelDatabase::getConfiguration();
     if ($configuration) {
         Propel::setConfiguration($configuration);
         if (!Propel::isInit()) {
             Propel::initialize();
         }
     }
     $dispatcher->connect('user.change_culture', array('sfPropel', 'listenToChangeCultureEvent'));
     if (!is_null($culture)) {
         self::setDefaultCulture($culture);
     } else {
         if (class_exists('sfContext', false) && sfContext::hasInstance() && ($user = sfContext::getInstance()->getUser())) {
             self::setDefaultCulture($user->getCulture());
         }
     }
     self::$initialized = true;
 }
Example #11
0
    $oPluginRegistry->unSerializeInstance(file_get_contents($sSerializedFile));
}
// setup propel definitions and logging
require_once "propel/Propel.php";
require_once "creole/Creole.php";
if (defined('DEBUG_SQL_LOG') && DEBUG_SQL_LOG) {
    define('PM_PID', mt_rand(1, 999999));
    require_once 'Log.php';
    // register debug connection decorator driver
    Creole::registerDriver('*', 'creole.contrib.DebugConnection');
    // initialize Propel with converted config file
    Propel::init(PATH_CORE . "config/databases.php");
    // unified log file for all databases
    $logFile = PATH_DATA . 'log' . PATH_SEP . 'propel.log';
    $logger = Log::singleton('file', $logFile, 'wf ' . SYS_SYS, null, PEAR_LOG_INFO);
    Propel::setLogger($logger);
    // log file for workflow database
    $con = Propel::getConnection('workflow');
    if ($con instanceof DebugConnection) {
        $con->setLogger($logger);
    }
    // log file for rbac database
    $con = Propel::getConnection('rbac');
    if ($con instanceof DebugConnection) {
        $con->setLogger($logger);
    }
    // log file for report database
    $con = Propel::getConnection('rp');
    if ($con instanceof DebugConnection) {
        $con->setLogger($logger);
    }
Example #12
0
 protected function _initDatabase()
 {
     if (Zend_Loader::isReadable(Dfi_App_Config::get('db.config'))) {
         try {
             $logger = Zend_Registry::get('propelLogger');
             $adapter = new Dfi_Log_Adapter_Propel2Zend($logger);
             require_once 'Propel.php';
             Propel::setLogger($adapter);
             Propel::init(Dfi_App_Config::get('db.config'));
         } catch (Exception $e) {
             throw new Exception('Can\'t setup database: ' . $e->getMessage());
         }
     } else {
         throw new Exception('database config read failed');
     }
 }
Example #13
0
}

//on prend une date le lundi matin à 9h40
$now = date('Y-m-d H:i',strtotime("next Monday 9:40"));
$edtCoursTest = $eleve->getEdtEmplacementCours($now);
echo ($logger->getDisplay());
if ($edtCoursTest != null && $edtCoursTest->getIdDefiniePeriode() == $edtCours2->getIdDefiniePeriode()) {
    echo('test 3 recuperation emplacement de cours d\'un eleve a reussi<br/><br/>');
} else {
    echo('test 3 recuperation emplacement de cours d\'un eleve  a <font color="red">echoue</font> <br><br/>');
}

echo("<br/>");

purgeDonneesTest($logger);
Propel::setLogger(null);

function purgeDonneesTest($logger) {
	echo "Purge des données<br/><br/>";
	//purge de l'utilisateur
	echo "<br/>Purge de l'utilisateur : <br/>";
	$utilisateurProfessionnel = UtilisateurProfessionnelPeer::retrieveByPK(UnitTestUtilisateurProfessionnel::getUtilisateurProfessionnel()->getLogin());
	if ($utilisateurProfessionnel != null)	{
		$utilisateurProfessionnel->delete();
	}
	$logger->getDisplay();

	//purge du groupe
	echo "<br/>Purge du groupe : <br/>";
	$criteria = new Criteria();
	$criteria->add(GroupePeer::NAME, UnitTestGroupe::getGroupe()->getName());
Example #14
0
 /**
  * Initializes Propel.
  */
 private static function initPropel()
 {
     if (!file_exists(self::$config->curry->propel->conf)) {
         self::log("Propel configuration missing, skipping propel initialization.");
         return;
     }
     // Use Composer autoloader instead of the built-in propel autoloader
     Propel::configure(self::$config->curry->propel->conf);
     $config = Propel::getConfiguration(PropelConfiguration::TYPE_OBJECT);
     $classmap = array();
     $projectClassPath = self::$config->curry->propel->projectClassPath;
     foreach ($config['classmap'] as $className => $file) {
         $classmap[$className] = $projectClassPath . DIRECTORY_SEPARATOR . $file;
     }
     $level = error_reporting(error_reporting() & ~E_USER_WARNING);
     Propel::initialize();
     PropelAutoloader::getInstance()->unregister();
     self::getAutoloader()->addClassMap($classmap);
     error_reporting($level);
     // Initialize debugging/logging
     if (self::$config->curry->propel->debug) {
         Propel::getConnection()->useDebug(true);
         if (self::$logger && self::$config->curry->propel->logging) {
             Propel::setLogger(self::$logger);
         }
     }
 }
Example #15
0
 /**
  * Initializes Propel.
  */
 protected function initPropel()
 {
     if (!file_exists($this['propel.conf'])) {
         $this->logger->notice("Propel configuration missing, skipping propel initialization.");
         return;
     }
     // Use Composer autoloader instead of the built-in propel autoloader
     \Propel::configure($this['propel.conf']);
     $config = \Propel::getConfiguration(\PropelConfiguration::TYPE_OBJECT);
     $classmap = array();
     $projectClassPath = $this['propel.projectClassPath'];
     foreach ($config['classmap'] as $className => $file) {
         $classmap[$className] = $projectClassPath . DIRECTORY_SEPARATOR . $file;
     }
     $level = error_reporting(error_reporting() & ~E_USER_WARNING);
     \Propel::initialize();
     \PropelAutoloader::getInstance()->unregister();
     $this->autoloader->addClassMap($classmap);
     error_reporting($level);
     // Initialize debugging/logging
     if ($this['propel.debug']) {
         \Propel::getConnection()->useDebug(true);
         if ($this['propel.logging']) {
             \Propel::setLogger($this->logger);
         }
     }
 }
Example #16
0
 public static function disablePropelLogging()
 {
     $con = Propel::getConnection();
     $con->useDebug(false);
     Propel::setLogger(null);
 }
Example #17
0
 public function initPropel($sys = '')
 {
     if (empty($sys)) {
         if (!defined(SYS_SYS)) {
             throw new Exception("Error: Undefined syemtem env. constant 'SYS_SYS'");
         }
         $sys = SYS_SYS;
     }
     // setup propel definitions and logging
     if (defined('DEBUG_SQL_LOG') && DEBUG_SQL_LOG) {
         define('PM_PID', mt_rand(1, 999999));
         // register debug connection decorator driver
         Creole::registerDriver('*', 'creole.contrib.DebugConnection');
         // initialize Propel with converted config file
         Propel::init(PATH_CORE . "config/databases.php");
         // unified log file for all databases
         $logFile = PATH_DATA . 'log' . PATH_SEP . 'propel.log';
         $logger = Log::singleton('file', $logFile, 'wf ' . $sys, null, PEAR_LOG_INFO);
         Propel::setLogger($logger);
         // log file for workflow database
         $con = Propel::getConnection('workflow');
         if ($con instanceof DebugConnection) {
             $con->setLogger($logger);
         }
         // log file for rbac database
         $con = Propel::getConnection('rbac');
         if ($con instanceof DebugConnection) {
             $con->setLogger($logger);
         }
         // log file for report database
         $con = Propel::getConnection('rp');
         if ($con instanceof DebugConnection) {
             $con->setLogger($logger);
         }
     } else {
         Propel::init(PATH_CORE . "config/databases.php");
     }
     Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
 }