/**
  * @see Console\Command\Command
  */
 protected function execute(Input\InputInterface $input, Output\OutputInterface $output)
 {
     $schemaFile = $input->getArgument('schema-file');
     $configFile = $input->getArgument('config-file');
     $dataSource = $input->getOption('datasource');
     $ignoreConstraints = $input->getOption('ignore-constraints');
     // initialize propel
     \Propel::init($configFile);
     // get xml representation of schema file
     $schemaXml = simplexml_load_file($schemaFile);
     // intitialize doctrine DBAL with data from propel
     $config = \PropelCli\Configuration::getDataSourceConfiguration($dataSource, \Propel::getConfiguration());
     $conn = DBAL\DriverManager::getConnection($config->toArray(), new DBAL\Configuration());
     $sm = $conn->getSchemaManager();
     // create a schema of the existing db
     $fromSchema = $sm->createSchema();
     // initialize a schema for the updated db
     $toSchema = new \Doctrine\DBAL\Schema\Schema();
     // generate the schema object
     $generator = new \PropelCli\Schema\Generator($schemaXml);
     $generator->generate($toSchema);
     // generate the sql to migrate from fromSchema to toSchema
     $sql = $fromSchema->getMigrateToSql($toSchema, $conn->getDatabasePlatform());
     if ($input->getOption('dump-sql')) {
         foreach ($sql as $stmt) {
             if ($ignoreConstraints && preg_match('/CONSTRAINT/', $stmt)) {
                 continue;
             }
             $output->write($stmt . ';' . PHP_EOL);
         }
     }
 }
 protected function tearDown()
 {
     if ($this->con) {
         $this->con->rollback();
     }
     parent::tearDown();
     Propel::init(dirname(__FILE__) . '/../../../../fixtures/bookstore/build/conf/bookstore-conf.php');
 }
Example #3
0
 public function CI_Propel()
 {
     define('DS', DIRECTORY_SEPARATOR);
     //EDIT for Virtual hosts
     set_include_path(get_include_path() . PATH_SEPARATOR . APPPATH . 'models/');
     require dirname(__FILE__) . DS . "propel" . DS . 'Propel.php';
     Propel::init(APPPATH . DS . "config" . DS . "cpu-conf.php");
 }
Example #4
0
 public function testPhpNamingMethod()
 {
     set_include_path(get_include_path() . PATH_SEPARATOR . "fixtures/bookstore/build/classes");
     Propel::init('fixtures/bookstore/build/conf/bookstore-conf.php');
     $bookTmap = Propel::getDatabaseMap(BookPeer::DATABASE_NAME)->getTable(BookPeer::TABLE_NAME);
     $this->assertEquals('AuthorId', $bookTmap->getColumn('AUTHOR_ID')->getPhpName(), 'setPhpName() uses the default phpNamingMethod');
     $pageTmap = Propel::getDatabaseMap(PagePeer::DATABASE_NAME)->getTable(PagePeer::TABLE_NAME);
     $this->assertEquals('LeftChild', $pageTmap->getColumn('LEFTCHILD')->getPhpName(), 'setPhpName() uses the configured phpNamingMethod');
 }
 protected function initPropel(Application $app)
 {
     if (!class_exists('Propel')) {
         require_once $this->guessPropel($app);
     }
     $modelPath = $this->guessModelPath($app);
     $config = $this->guessConfigFile($app);
     \Propel::init($config);
     set_include_path($modelPath . PATH_SEPARATOR . get_include_path());
     $this->alreadyInit = true;
 }
Example #6
0
 public function index()
 {
     $user = UserQuery::create();
     $this->usuarios = $user->find();
     // Initialize Propel with the runtime configuration
     Session::set('myDbName', 'dokeos_0001');
     Propel::init(APP_PATH . 'config/propel/dokeos-conf.php');
     $foro = ForumForumQuery::create();
     $this->foros = $foro->find();
     Session::set('myDbName', 'dokeos_main');
     Propel::init(APP_PATH . 'config/propel/dokeos-conf.php');
     $user = UserQuery::create();
     $this->usuarios2 = $user->find();
 }
Example #7
0
 /**
  * Initialise the database (we don't always want this, so it's offered separately)
  */
 public static function initialiseDb($testMode = false)
 {
     $projectRoot = self::getProjectRoot();
     // Include system models
     set_include_path($projectRoot . self::getPaths()->getPathModelsSystem() . PATH_SEPARATOR . get_include_path());
     require_once $projectRoot . self::getPaths()->getFilePropelRuntime();
     Propel::init($projectRoot . self::getPaths()->getPathConnsSystem() . '/database-conf.php');
     // If we're in test mode, autoload the non-test system models
     if ($testMode) {
         $path = $projectRoot . self::getPaths()->getPathConnsSystem(false) . '/classmap-database-conf.php';
         $map = (include $path);
         $loader = PropelAutoloader::getInstance();
         $loader->addClassPaths($map);
     }
     // Not normally needed, but the tests use this connection approach even for node schemas
     self::autoloadMeshingClasses($testMode);
 }
Example #8
0
 /**
  *
  * Makes all initialization.
  */
 protected function init()
 {
     /* Checking if HTTPS needed */
     if ($this->isSecure() && !isset($_SERVER['HTTPS'])) {
         /* Redirecting to HTTPS */
         header('Location: https://' . $_SERVER["SERVER_NAME"] . $_SERVER['REQUEST_URI']);
         /* Further processing is not necessary */
         die;
     }
     /* Propel Initialization */
     if (defined('DS_CONFIGFILE')) {
         require_once DIR_LIB_PROTECTED . 'propel/runtime/lib/Propel.php';
         Propel::init(DIR_SITE . 'build/conf/' . DS_CONFIGFILE . '.php');
         set_include_path(DIR_SITE . 'build/classes' . PATH_SEPARATOR . get_include_path());
     }
     /* Twig Initialization */
     require_once DIR_LIB_PROTECTED . 'twig/lib/Twig/Autoloader.php';
     Twig_Autoloader::register();
 }
Example #9
0
 /**
  *  Read the config file which contains info on the Propel database to work with. Initialize things.
  */
 function readConfig()
 {
     // load config file
     include_once 'autoweb.config';
     // load the proper propel stuff -- this should be moved to a config file
     ini_set('include_path', ini_get('include_path') . ":{$__autowebConfig['propelOutputDir']}");
     require_once $__autowebConfig['propelConfFile'];
     // walk propel directory for a list of contents
     $propelClassesDir = $__autowebConfig['propelOutputDir'] . "/{$__autowebConfig['propelDatabaseName']}";
     foreach (new DirectoryIterator($propelClassesDir) as $item) {
         if (!(preg_match('/^[^\\.].*\\.php$/', $item) == 1)) {
             continue;
         }
         // skip everything buy PHP classs, skip invisible files
         $propelFile = $propelClassesDir . '/' . $item;
         require_once $propelFile;
         // include everything
     }
     // start up propel; this will load the database map including info for all included files
     Propel::init($__autowebConfig['propelConfFile']);
     // load databaseMap into inst var
     $this->propelDBMap = Propel::getDatabaseMap($__autowebConfig['propelDatabaseName']);
 }
Example #10
0
function autoSuggest($query)
{
    Propel::init("..\\..\\config\\build\\conf\\bookingspace-conf.php");
    set_include_path("..\\..\\config\\build\\classes" . PATH_SEPARATOR . get_include_path());
    $players = PlayerQuery::create()->where('Player.firstName like ?', '%' . $query . '%')->orWhere('Player.lastName like ?', '%' . $query . '%')->find();
    $totalRows = $players->count();
    if ($totalRows > 0) {
        $items = '<ul class="div-table">';
        //  var_dump($players->toArray());
        foreach ($players->toArray() as $row) {
            $items .= '<li><div class="div-table-row">';
            $items .= '<div class="div-table-col col-img"><img src="' . PATH_PICS . $row['Photo'] . '" width="90" height="90" /> </div>';
            $items .= '<div class="div-table-col">' . $row['LastName'] . ' - ' . $row['FirstName'] . '<br />';
            $items .= 'Τηλ. Επικοιν' . $row['Phone'] . '<br />';
            $items .= 'Κινητο:' . $row['Mobile'] . '</div>';
            $items .= '</div></li>';
        }
        $items .= '</ul>';
        // echo $items;
    } else {
        $items = "Δεν υπάρχουν εγγραφές";
    }
    echo $items;
}
Example #11
0
<?php

/**
 * Todas las controladores heredan de esta clase en un nivel superior
 * por lo tanto los metodos aqui definidos estan disponibles para
 * cualquier controlador.
 *
 * @category Kumbia
 * @package Controller
 * */
// @see Controller nuevo controller
require_once CORE_PATH . 'kumbia/controller.php';
// Include the main Propel script
require_once APP_PATH . 'libs/propel/Propel.php';
// Initialize Propel with the runtime configuration
Propel::init(APP_PATH . 'config/propel/dokeos-conf.php');
// Add the generated 'classes' directory to the include path
set_include_path(APP_PATH . 'models');
class AppController extends Controller
{
    protected $my_auth;
    public $title = "mdokeos";
    protected final function initialize()
    {
        Session::delete('myDbName');
        $this->my_auth = new MyAuth();
        if (!$this->my_auth->check()) {
            Flash::warning($this->my_auth->getError());
            Input::delete('password');
            View::select(null, 'login');
        }
Example #12
0
 public function init(ModuleManager $moduleManager)
 {
     \Propel::init(__DIR__ . '/build/conf/hva-conf.php');
     set_include_path(__DIR__ . '/build/classes' . PATH_SEPARATOR . get_include_path());
 }
Example #13
0
 protected function tearDown()
 {
     parent::tearDown();
     Propel::init(dirname(__FILE__) . '/../../../fixtures/bookstore/build/conf/bookstore-conf.php');
 }
Example #14
0
require 'propel/Propel.php';
include_once 'Benchmark/Timer.php';
$timer = new Benchmark_Timer();
$timer->start();
// Some utility functions
function boolTest($cond)
{
    if ($cond) {
        return "[OK]\n";
    } else {
        return "[FAILED]\n";
    }
}
try {
    // Initialize Propel
    Propel::init($conf_path);
} catch (Exception $e) {
    die("Error initializing propel: " . $e->__toString());
}
function check_tables_empty()
{
    try {
        print "\nChecking to see that tables are empty\n";
        print "-------------------------------------\n\n";
        print "Ensuring that there are no records in [author] table: ";
        $res = AuthorPeer::doSelect(new Criteria());
        print boolTest(empty($res));
        print "Ensuring that there are no records in [publisher] table: ";
        $res2 = PublisherPeer::doSelect(new Criteria());
        print boolTest(empty($res2));
        print "Ensuring that there are no records in [book] table: ";
Example #15
0
/**
 * Includes classes and sets paths required by all applications.
 * @package diy-framework
 * @author	Martynas Jusevicius <*****@*****.**>
 * @link	http://www.xml.lt
 */
error_reporting(E_ALL);
//define("ROOT_DIR", getcwd()."/");
define("PROJECT_NAME", "test-project");
define("CLASSES_DIR", "classes/");
define("MAIN_DIR", CLASSES_DIR . PROJECT_NAME . "/");
define("MODEL_DIR", MAIN_DIR . "model/");
define("PROPEL_PROJECT", PROJECT_NAME . ".model");
// PROPEL
set_include_path("lib/propel/runtime/classes" . PATH_SEPARATOR . get_include_path());
set_include_path("lib/creole/classes" . PATH_SEPARATOR . get_include_path());
require "propel/Propel.php";
Propel::init(MODEL_DIR . "conf/" . PROPEL_PROJECT . "-conf.php");
$con = Propel::getConnection();
$con->executeQuery("SET NAMES utf8;");
$con->executeQuery("SET CHARACTER SET utf8;");
$con->executeQuery('SET character_set_client="utf8"');
$con->executeQuery('SET character_set_connection="utf8"');
$con->executeQuery('SET character_set_results="utf8"');
// DIY FRAMEWORK
set_include_path("lib/diy-framework/classes/diy-framework" . PATH_SEPARATOR . get_include_path());
require "propel/om/BaseObject.php";
// for Resource to extend
require "DIYFrameworkLoader.class.php";
// MODEL
set_include_path(CLASSES_DIR . PATH_SEPARATOR . get_include_path());
Example #16
0
                    break;
            }
            // initialize db
            $pro['datasources']['workflow']['connection'] = $dsn;
            $pro['datasources']['workflow']['adapter'] = $DB_ADAPTER;
            $pro['datasources']['rbac']['connection'] = $dsnRbac;
            $pro['datasources']['rbac']['adapter'] = $DB_ADAPTER;
            $pro['datasources']['rp']['connection'] = $dsnRp;
            $pro['datasources']['rp']['adapter'] = $DB_ADAPTER;
            // $pro['datasources']['dbarray']['connection'] =
            // 'dbarray://*****:*****@localhost/pm_os';
            // $pro['datasources']['dbarray']['adapter'] = 'dbarray';
            $oFile = fopen(PATH_CORE . 'config/_databases_.php', 'w');
            fwrite($oFile, '<?php global $pro;return $pro; ?>');
            fclose($oFile);
            Propel::init(PATH_CORE . 'config/_databases_.php');
            // Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
            eprintln("Processing workspace: " . $sObject, 'green');
            try {
                processWorkspace();
            } catch (Exception $e) {
                echo $e->getMessage();
                eprintln("Problem in workspace: " . $sObject . ' it was omitted.', 'red');
            }
            eprintln();
            unlink(PATH_CORE . 'config/_databases_.php');
        }
    }
} else {
    processWorkspace();
}
Example #17
0
    $info = explode('_', $classname);
    if (isset($info[1]) && isset($info[2])) {
        $filename = $info[2] . ".php";
        if ($info[1] == "Model") {
            $folderName = "models";
        } else {
            if ($info[1] == "Common") {
                $folderName = "common";
            }
        }
        require_once $CC_CONFIG['phpDir'] . '/application/' . $folderName . '/' . $filename;
    }
}
spl_autoload_register('my_autoload');
require_once 'propel/runtime/lib/Propel.php';
Propel::init($CC_CONFIG['phpDir'] . "/application/configs/airtime-conf-production.php");
//Zend framework
if (file_exists('/usr/share/php/libzend-framework-php')) {
    set_include_path('/usr/share/php/libzend-framework-php' . PATH_SEPARATOR . get_include_path());
}
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$infoArray = Application_Model_Preference::GetSystemInfo(true);
if (Application_Model_Preference::GetSupportFeedback() == '1') {
    $url = 'http://stat.sourcefabric.org/index.php?p=airtime';
    //$url = 'http://localhost:9999/index.php?p=airtime';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    $data = json_encode($infoArray);
Example #18
0
<?php

set_include_path(__DIR__ . '/..' . PATH_SEPARATOR . get_include_path());
set_include_path(__DIR__ . '/../../../library' . PATH_SEPARATOR . get_include_path());
require_once __DIR__ . '/../Show.php';
require_once __DIR__ . '/../StoredFile.php';
require_once __DIR__ . '/../Playlist.php';
require_once __DIR__ . '/../Schedule.php';
require_once __DIR__ . '/../Preference.php';
require_once __DIR__ . '/../RabbitMq.php';
require_once __DIR__ . '/../../configs/conf.php';
require_once __DIR__ . '/../../../install_minimal/include/AirtimeIni.php';
require_once __DIR__ . '/../../../install_minimal/include/AirtimeInstall.php';
require_once __DIR__ . '/../../../library/propel/runtime/lib/Propel.php';
Propel::init(__DIR__ . '/../../configs/airtime-conf.php');
AirtimeInstall::DbConnect(true);
$con = Propel::getConnection();
$sql = "DELETE FROM cc_show";
$con->exec($sql);
$sql = "DELETE FROM cc_show_days";
$con->exec($sql);
$sql = "DELETE FROM cc_show_instances";
$con->exec($sql);
/*
// Create a playlist
$playlist = new Application_Model_Playlist();
$playlist->create("Calendar Load test playlist ".uniqid());

// Add a file
$values = array("filepath" => __DIR__."/test10001.mp3");
$storedFile = Application_Model_StoredFile::Insert($values, false);
 * @license http://www.gnu.org/licenses/gpl.txt
 */
/*
 * In the future, most Airtime upgrades will involve just mutating the
 * data that is stored on the system. For example, The only data
 * we need to preserve between versions is the database, /etc/airtime, and
 * /srv/airtime. Everything else is just binary files that can be removed/replaced
 * with the new version of Airtime. Of course, the data may need to be in a new
 * format, and that's what this upgrade script will be for.
 */
set_include_path(__DIR__ . '/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
set_include_path(__DIR__ . '/../../../airtime_mvc/application/models' . PATH_SEPARATOR . get_include_path());
set_include_path(__DIR__ . '/../../../airtime_mvc/application/configs' . PATH_SEPARATOR . get_include_path());
require_once 'conf.php';
require_once 'propel/runtime/lib/Propel.php';
Propel::init(__DIR__ . "/../../../airtime_mvc/application/configs/airtime-conf.php");
require_once 'UpgradeCommon.php';
$bypassMigrations = array('20110312121200', '20110331111708', '20110402164819', '20110406182005', '20110629143017', '20110711161043', '20110713161043');
$targetMigration = '20110925171256';
/* All functions other than start() should be marked as
 * private.
 */
class AirtimeDatabaseUpgrade
{
    public static function start()
    {
        //self::doDbMigration();
    }
    private static function doDbMigration()
    {
        global $bypassMigrations, $targetMigration;
Example #20
0
 * @license http://www.gnu.org/licenses/gpl.txt
 */
/*
 * In the future, most Airtime upgrades will involve just mutating the
 * data that is stored on the system. For example, The only data
 * we need to preserve between versions is the database, /etc/airtime, and
 * /srv/airtime. Everything else is just binary files that can be removed/replaced
 * with the new version of Airtime. Of course, the data may need to be in a new
 * format, and that's what this upgrade script will be for.
 */
set_include_path(__DIR__ . '/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
set_include_path(__DIR__ . '/../../../airtime_mvc/application/models' . PATH_SEPARATOR . get_include_path());
set_include_path(__DIR__ . '/../../../airtime_mvc/application/configs' . PATH_SEPARATOR . get_include_path());
//require_once 'conf.php';
require_once 'propel/runtime/lib/Propel.php';
Propel::init(__DIR__ . "/propel/airtime-conf.php");
require_once 'UpgradeCommon.php';
class AirtimeStorWatchedDirsUpgrade
{
    public static function start()
    {
    }
}
/* This class deals with any modifications to config files in /etc/airtime
 * as well as backups. All functions other than start() should be marked
 * as private. */
class AirtimeConfigFileUpgrade
{
    public static function start()
    {
        echo "* Updating configFiles\n";
        // Pour les scripts situés dans un sous-sous-répertoire à l'intérieur d'une sous-répertoire de GEPI
    } else {
        if (isset($niveau_arbo) and $niveau_arbo == "3") {
            // Database configuration file
            require_once "../../../secure/connect.inc.php";
            //propel objects
            set_include_path("../../../orm/propel-build/classes" . PATH_SEPARATOR . "../../../orm/propel" . PATH_SEPARATOR . "../../../orm" . PATH_SEPARATOR . get_include_path());
            require_once "propel/Propel.php";
            Propel::init('../../../orm/propel-build/conf/' . $propel_conf_file_name);
            // Pour les scripts situés dans le sous-répertoire "public"
            // Ces scripts font appel au fichier /public/secure/connect.inc et non pas /secure/connect.inc
        } else {
            if (isset($niveau_arbo) and $niveau_arbo == "public") {
                // Database configuration file
                require_once "../secure/connect.inc.php";
                //propel objects
                set_include_path("../orm/propel-build/classes" . PATH_SEPARATOR . "../orm/propel" . PATH_SEPARATOR . "../orm" . PATH_SEPARATOR . get_include_path());
                require_once "propel/Propel.php";
                Propel::init('../orm/propel-build/conf/' . $propel_conf_file_name);
                // Pour les scripts situés dans un sous-répertoire GEPI
            } else {
                // Database configuration file
                require_once "../secure/connect.inc.php";
                //propel objects
                set_include_path("../orm/propel-build/classes" . PATH_SEPARATOR . "../orm/propel" . PATH_SEPARATOR . "../orm" . PATH_SEPARATOR . get_include_path());
                require_once "../orm/propel/Propel.php";
                Propel::init('../orm/propel-build/conf/' . $propel_conf_file_name);
            }
        }
    }
}
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
require_once 'src/data/IDataBase.php';
require_once 'propel/Propel.php';
Propel::init('conf/runtime-conf.php');
require_once 'src/model/whiteboard/ElementPeer.php';
require_once 'src/model/whiteboard/HistoryPeer.php';
require_once 'src/model/whiteboard/ProductionPeer.php';
require_once 'src/model/whiteboard/RoomPeer.php';
require_once 'src/model/whiteboard/UserPeer.php';
require_once 'src/model/whiteboard/User.php';
require_once 'src/model/whiteboard/PermissionPeer.php';
/**
 * MySQL DAO (Data Access Object)
 * 
 * @author rodrigoprestes@users.sourceforge.net
 * @version Out. 20, 2011
 */
class MySqlDataBaseDAO implements IDataBase
{
<?php

include __DIR__ . '/vendor/autoload.php';
include __DIR__ . '/../../bootstrap.php';
$debugbarRenderer->setBaseUrl('../../../src/DebugBar/Resources');
use DebugBar\Bridge\PropelCollector;
$debugbar->addCollector(new PropelCollector());
Propel::init('build/conf/demo-conf.php');
set_include_path("build/classes" . PATH_SEPARATOR . get_include_path());
PropelCollector::enablePropelProfiling();
$user = new User();
$user->setName('foo');
$user->save();
$firstUser = UserQuery::create()->findPK(1);
render_demo_page();
 /**
  * Load Propel config
  * 
  * @param      AgaviDatabaseManager The database manager of this instance.
  * @param      array                An assoc array of initialization params.
  *
  * @author     David Zülke <*****@*****.**>
  * @since      0.10.0
  */
 public function initialize(AgaviDatabaseManager $databaseManager, array $parameters = array())
 {
     parent::initialize($databaseManager, $parameters);
     $configPath = AgaviToolkit::expandDirectives($this->getParameter('config'));
     $datasource = $this->getParameter('datasource', null);
     $use_as_default = $this->getParameter('use_as_default', false);
     $config = (require $configPath);
     if ($datasource === null || $datasource == 'default') {
         if (isset($config['propel']['datasources']['default'])) {
             $datasource = $config['propel']['datasources']['default'];
         } elseif (isset($config['datasources']['default'])) {
             $datasource = $config['datasources']['default'];
         } else {
             throw new AgaviDatabaseException('No datasource given for Propel connection, and no default datasource specified in runtime configuration file.');
         }
     }
     if (!class_exists('Propel')) {
         include 'propel/Propel.php';
     }
     if (!Propel::isInit()) {
         Propel::init($configPath);
     }
     $is13 = version_compare(Propel::VERSION, '1.4', '<');
     // grab the configuration values and inject possibly defined overrides for this data source
     if ($is13) {
         // old-style config array; PropelConfiguration was added after 1.3.0, http://trac.agavi.org/ticket/1195
         $config = Propel::getConfiguration();
         $config['datasources'][$datasource]['adapter'] = $this->getParameter('overrides[adapter]', $config['datasources'][$datasource]['adapter']);
         $config['datasources'][$datasource]['connection'] = array_merge($config['datasources'][$datasource]['connection'], $this->getParameter('overrides[connection]', array()));
         // also the autoload classes
         $config['datasources'][$datasource]['classes'] = array_merge($config['datasources'][$datasource]['classes'], $this->getParameter('overrides[classes]', array()));
         // and init queries
         if (!isset($config['datasources'][$datasource]['connection']['settings']['queries']['query'])) {
             $config['datasources'][$datasource]['connection']['settings']['queries']['query'] = array();
         }
         // array cast because "query" might be a string if just one init query was given, http://trac.agavi.org/ticket/1194
         $config['datasources'][$datasource]['connection']['settings']['queries']['query'] = array_merge((array) $config['datasources'][$datasource]['connection']['settings']['queries']['query'], (array) $this->getParameter('init_queries'));
         // set the new config
         Propel::setConfiguration($config);
     } else {
         $config = Propel::getConfiguration(PropelConfiguration::TYPE_OBJECT);
         $overrides = (array) $this->getParameter('overrides');
         // set override values
         foreach ($overrides as $key => $value) {
             $config->setParameter($key, $value);
         }
         // handle init queries in a cross-adapter fashion (they all support the "init_queries" param)
         $queries = (array) $config->getParameter('datasources.' . $datasource . '.connection.settings.queries.query', array());
         // yes... it's one array, [connection][settings][queries][query], with all the init queries from the config, so we append to that
         $queries = array_merge($queries, (array) $this->getParameter('init_queries'));
         $config->setParameter('datasources.' . $datasource . '.connection.settings.queries.query', $queries);
     }
     if (true === $this->getParameter('enable_instance_pooling')) {
         Propel::enableInstancePooling();
     } elseif (false === $this->getParameter('enable_instance_pooling')) {
         Propel::disableInstancePooling();
     }
 }
Example #25
0
/**
 * @package Airtime
 * @subpackage StorageServer
 * @copyright 2010 Sourcefabric O.P.S.
 * @license http://www.gnu.org/licenses/gpl.txt
 */
if (posix_geteuid() != 0) {
    echo "Must be root user.\n";
    exit(1);
}
require_once __DIR__ . '/airtime-constants.php';
require_once __DIR__ . '/AirtimeIni.php';
require_once __DIR__ . '/AirtimeInstall.php';
require_once 'propel/runtime/lib/Propel.php';
Propel::init(AirtimeInstall::GetAirtimeSrcDir() . "/application/configs/db-conf.php");
Propel::init(AirtimeInstall::GetAirtimeSrcDir() . "/application/configs/airtime-conf-production.php");
function pause()
{
    /* Type "sudo -s" to change to root user then type "export AIRTIME_INSTALL_DEBUG=1" and then
     * start airtime-install to enable this feature. Is used to pause between upgrade scripts
     * to examine the state of the system and see if everything is as expected. */
    if (getenv("AIRTIME_INSTALL_DEBUG") === "1") {
        echo "Press Enter to Continue" . PHP_EOL;
        fgets(STDIN);
    }
}
AirtimeInstall::DbConnect(true);
$con = Propel::getConnection();
$version = AirtimeInstall::GetVersionInstalled();
echo "******************************** Upgrade Begin *********************************" . PHP_EOL;
global $CC_CONFIG;
Example #26
0
<?php

// LDAP
require_once 'UVMLdap.php';
// Initialize Propel
require_once 'vendor/propel/propel1/runtime/lib/Propel.php';
Propel::init('build/conf/cscrew-conf.php');
set_include_path("build/classes" . PATH_SEPARATOR . get_include_path());
function netid_info($netid)
{
    $ld = new UVMLdap();
    $results = array();
    $filter = $ld->makeFilter("uid", "=", $netid);
    $result = @ldap_search($ld->ldap, $ld->ldap_base, $filter);
    if ($result) {
        $entries = ldap_get_entries($ld->ldap, $result);
        if (count($entries) != 2 || array_key_exists("count", $entries) && $entries["count"] != 1) {
            return false;
        }
        $person = $entries["0"];
        return $person;
    } else {
        print ldap_error($ld->ldap);
    }
}
function get_user($netid)
{
    $q = new UserQuery();
    $user = $q->findOneByNetid($netid);
    // The user exists in the database
    if ($user) {
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd., 
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 * 
 */
$unitFilename = $_SERVER['PWD'] . '/test/bootstrap/unit.php';
require_once $unitFilename;
require_once PATH_THIRDPARTY . '/lime/lime.php';
require_once PATH_THIRDPARTY . 'lime/yaml.class.php';
require_once PATH_CORE . "config/databases.php";
require_once "propel/Propel.php";
Propel::init(PATH_CORE . "config/databases.php");
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('error');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('dbconnection');
G::LoadSystem('dbsession');
G::LoadSystem('dbrecordset');
G::LoadSystem('dbtable');
G::LoadSystem('testTools');
G::LoadClass('appDelegation');
require_once PATH_CORE . '/classes/model/AppDelegation.php';
$dbc = new DBConnection();
$ses = new DBSession($dbc);
$obj = new AppDelegation($dbc);
Example #28
0
 /**
  * Initialize Propel
  *
  */
 protected function _initPropel()
 {
     static $done = false;
     if ($done) {
         return;
     }
     $done = true;
     FWIncludePath::prepend(FW_DIR . '/lib/vendor/propel/runtime/classes');
     FWIncludePath::prepend(APP_DIR . '/model/build/classes/propel');
     FWIncludePath::prepend(APP_DIR . '/model/build/classes');
     require 'propel/Propel.php';
     Propel::init(APP_DIR . '/model/build/conf/propel-conf.php');
 }
Example #29
0
<?php

/**
 * This file is part of the Propel package.
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @license    MIT License
 */
require_once dirname(__FILE__) . '/../../../tools/helpers/BaseTestCase.php';
require_once dirname(__FILE__) . '/../../../../runtime/lib/query/Criteria.php';
Propel::init(dirname(__FILE__) . '/../../../fixtures/bookstore/build/conf/bookstore-conf.php');
/**
 * Test class for Join.
 *
 * @author     François Zaninotto
 * @version    $Id$
 * @package    runtime.query
 */
class JoinTest extends BaseTestCase
{
    /**
     * DB adapter saved for later.
     *
     * @var        DBAdapter
     */
    private $savedAdapter;
    protected function setUp()
    {
        parent::setUp();
        $this->savedAdapter = Propel::getDB(null);
Example #30
0
<?php

// Include all dependencies
require_once '../vendor/autoload.php';
// Include model
Propel::init("../build/conf/ginger-conf.php");
set_include_path("../build/classes" . PATH_SEPARATOR . get_include_path());
// Include config
require_once '../config.php';
require_once '../lib/Koala/Koala.class.php';
require_once '../class/Ginger.class.php';
class MyAuth extends \Koala\KoalaAuth
{
    public $ginger;
    public function auth($app)
    {
        parent::auth($app);
        $this->ginger = new Ginger($app->request()->params('key'));
    }
}
$myAuth = new MyAuth();
$app = new \Koala\Koala($myAuth, array('debug' => false, 'templates.path' => '../templates'));
/***********************************************************************
 *                             Routes
 ***********************************************************************/
// récupération des stats
$app->get('/v1/stats', function () use($app, $myAuth) {
    $r = $myAuth->ginger->getStats();
    $app->render('success.json.php', array('result' => $r));
});
// récupération d'un utilisateur