protected function execute($arguments = array(), $options = array())
 {
     require sfConfig::get('sf_data_dir') . '/version.php';
     sfToolkit::addIncludePath(array(sfConfig::get('sf_lib_dir') . '/vendor/'));
     $pluginList = $this->getPluginList();
     foreach ($pluginList as $name => $info) {
         if (!preg_match('/^op[a-zA-Z0-9_\\-]+Plugin$/', $name)) {
             continue;
         }
         if (isset($info['install']) && false === $info['install']) {
             continue;
         }
         $option = array();
         if (isset($info['version'])) {
             $option[] = '--release=' . $info['version'];
         }
         if (isset($info['channel'])) {
             $option[] = '--channel=' . $info['channel'];
         }
         try {
             $task = new opPluginInstallTask($this->dispatcher, $this->formatter);
             $task->run(array('name' => $name), $option);
         } catch (sfCommandException $e) {
             $str = "Failed install";
             $this->logBlock($str, 'ERROR');
         }
     }
 }
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     /**
      * include path to propel generator
      */
     sfToolkit::addIncludePath(array(sfConfig::get('sf_propel_path') . '/generator/lib'));
     /**
      * first check the db connectivity for all connections
      */
     $this->logBlock('Checking Db Connectivity', "QUESTION");
     if (!$this->createTask('afs:db-connectivity')->run()) {
         return;
     }
     $this->logBlock('Creating specific AppFlower folders', "QUESTION");
     $this->createFolders();
     $this->logBlock('Setting Symfony project permissions', "QUESTION");
     $this->createTask('project:permissions')->run();
     $type_method = 'execute' . sfInflector::camelize($options['type']);
     if (!method_exists($this, $type_method)) {
         throw new sfCommandException("Type method '{$type_method}' not defined.");
     }
     call_user_func(array($this, $type_method), $arguments, $options);
     $this->logBlock('Creating models from current schema', "QUESTION");
     $this->createTask('propel:build-model')->run();
     $this->logBlock('Creating forms from current schema', "QUESTION");
     $this->createTask('propel:build-forms')->run();
     $this->logBlock('Setting AppFlower project permissions', "QUESTION");
     $this->createTask('afs:fix-perms')->run();
     $this->logBlock('Creating AppFlower validator cache', "QUESTION");
     $this->createTask('appflower:validator-cache')->run(array('frontend', 'cache', 'yes'));
     $this->logBlock('Clearing Symfony cache', "QUESTION");
     $this->createTask('cc')->run();
 }
 /**
  * @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 initialize()
 {
     sfToolkit::addIncludePath(array($this->rootDir . '/lib/vendor/Shindig/'));
     $this->dispatcher->connect('op_confirmation.list', array($this, 'getConfirmList'));
     $this->dispatcher->connect('op_confirmation.decision', array($this, 'processConfirm'));
     $this->dispatcher->connect('op_opensocial.addapp', array($this, 'processAddAppEvent'));
     $this->dispatcher->connect('op_opensocial.removeapp', array($this, 'processRemoveAppEvent'));
 }
 public function initialize()
 {
     sfToolkit::addIncludePath(array(realpath(dirname(__FILE__) . '/../lib/PHPExcel')));
     if ($this->configuration instanceof sfApplicationConfiguration) {
         if ($file = $this->configuration->getConfigCache()->checkConfig('config/phpexcel.yml', true)) {
             include $file;
         }
     }
 }
 public function initialize()
 {
     $pathToPlugin = sfConfig::get('sf_plugins_dir') . '/opPluginChannelServerPlugin';
     sfToolkit::addIncludePath(array($pathToPlugin . '/lib/vendor/PEAR/', $pathToPlugin . '/lib/vendor/ActiveResource/'));
     $this->dispatcher->connect('op_confirmation.list', array($this, 'listJoinConfirmation'));
     $this->dispatcher->connect('op_confirmation.decision', array($this, 'processJoinConfirmation'));
     $this->dispatcher->connect('response.filter_content', array($this, 'cacheOutput'));
     /*
     $this->dispatcher->connect('op_action.post_execute_friend_link', array('opMessagePluginObserver', 'listenToPostActionEventSendFriendLinkRequestMessage'));
     $this->dispatcher->connect('form.post_configure', array('opMessagePluginObserver', 'injectMessageFormField'));
     */
     $this->dispatcher->connect('op_action.post_execute_package_home', array(__CLASS__, 'appendHatenaStar'));
 }
 /**
  * @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_symfony_lib_dir'), realpath(dirname(__FILE__) . '/../lib/vendor')));
     if (sfConfig::get('sf_web_debug')) {
         require_once dirname(__FILE__) . '/../lib/debug/sfWebDebugPanelPropel.class.php';
         $this->dispatcher->connect('debug.web.load_panels', array('sfWebDebugPanelPropel', 'listenToAddPanelEvent'));
     }
     if (sfConfig::get('sf_test')) {
         $this->dispatcher->connect('context.load_factories', array('sfPropel', 'clearAllInstancePools'));
     }
 }
 protected function getGeneratorConfig($params = array())
 {
     $iniFile = sfConfig::get('sf_config_dir') . '/propel.ini';
     if (!$params && file_exists($iniFile)) {
         $params = parse_ini_file($iniFile);
     }
     $behaviorsMapping = array('timestampable' => 'TimestampableBehavior', 'alternative_coding_standards' => 'AlternativeCodingStandardsBehavior', 'soft_delete' => 'SoftDeleteBehavior', 'auto_add_pk' => 'AutoAddPkBehavior', 'nested_set' => 'nestedset.NestedSetBehavior', 'sortable' => 'sortable.SortableBehavior', 'sluggable' => 'sluggable.SluggableBehavior', 'concrete_inheritance' => 'concrete_inheritance.ConcreteInheritanceBehavior', 'query_cache' => 'query_cache.QueryCacheBehavior', 'aggregate_column' => 'aggregate_column.AggregateColumnBehavior', 'versionable' => 'versionable.VersionableBehavior', 'i18n' => 'i18n.I18nBehavior');
     foreach ($behaviorsMapping as $behavior => $value) {
         $key = 'propel.behavior.' . $behavior . '.class';
         if (!isset($params[$key])) {
             $params[$key] = 'behavior.' . $value;
         }
     }
     sfToolkit::addIncludePath(array(sfConfig::get('sf_propel_generator_path', realpath(dirname(__FILE__) . '/../vendor/propel/generator/lib'))));
     require_once 'config/GeneratorConfig.php';
     return new GeneratorConfig($params);
 }
 public function initialize()
 {
     sfToolkit::addIncludePath(dirname(__FILE__) . '/../lib/vendor');
 }
Example #10
0
<?php

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_symfony_lib_dir'), realpath(dirname(__FILE__) . '/../lib/vendor')));
if (sfConfig::get('sf_web_debug')) {
    require_once dirname(__FILE__) . '/../lib/debug/sfWebDebugPanelPropel.class.php';
    $this->dispatcher->connect('debug.web.load_panels', array('sfWebDebugPanelPropel', 'listenToAddPanelEvent'));
}
if (sfConfig::get('sf_test')) {
    $this->dispatcher->connect('context.load_factories', array('sfPropel', 'clearAllInstancePools'));
}
 public function initialize()
 {
     sfToolkit::addIncludePath(OPENPNE3_CONFIG_DIR . '/../lib/vendor');
 }
Example #12
0
$t->is(sfToolkit::getArrayValueForPath($arr, 'foobar'), 'foo', '::getArrayValueForPath() returns the value of the path if it exists');
$t->is(sfToolkit::getArrayValueForPath($arr, 'barfoo'), null, '::getArrayValueForPath() returns null if the path does not exist');
$t->is(sfToolkit::getArrayValueForPath($arr, 'barfoo', 'bar'), 'bar', '::getArrayValueForPath() takes a default value as its third argument');
$t->is(sfToolkit::getArrayValueForPath($arr, 'foo[bar][baz]'), 'foo bar', '::getArrayValueForPath() works with deep paths');
$t->is(sfToolkit::getArrayValueForPath($arr, 'foo[bar][bar]'), false, '::getArrayValueForPath() works with deep paths');
$t->is(sfToolkit::getArrayValueForPath($arr, 'foo[bar][bar]', 'bar'), 'bar', '::getArrayValueForPath() works with deep paths');
$t->is(sfToolkit::getArrayValueForPath($arr, 'foo[]'), array('bar' => array('baz' => 'foo bar')), '::getArrayValueForPath() accepts a [] at the end to check for an array');
$t->is(sfToolkit::getArrayValueForPath($arr, 'foobar[]'), null, '::getArrayValueForPath() accepts a [] at the end to check for an array');
$t->is(sfToolkit::getArrayValueForPath($arr, 'barfoo[]'), null, '::getArrayValueForPath() accepts a [] at the end to check for an array');
$t->is(sfToolkit::getArrayValueForPath($arr, 'foobar[]', 'foo'), 'foo', '::getArrayValueForPath() accepts a [] at the end to check for an array');
$t->is(sfToolkit::getArrayValueForPath($arr, 'bar[1]'), 'bar', '::getArrayValueForPath() can take an array indexed by integer');
$t->is(sfToolkit::getArrayValueForPath($arr, 'bar[2]'), null, '::getArrayValueForPath() can take an array indexed by integer');
$t->is(sfToolkit::getArrayValueForPath($arr, 'bar[2]', 'foo'), 'foo', '::getArrayValueForPath() can take an array indexed by integer');
$t->is(sfToolkit::getArrayValueForPath($arr, 'foo[bar][baz][booze]'), null, '::getArrayValueForPath() is not fooled by php mistaking strings and array');
// ::addIncludePath()
$t->diag('::addIncludePath()');
$path = get_include_path();
$t->is(sfToolkit::addIncludePath(__DIR__), $path, '::addIncludePath() returns the previous include_path');
$t->is(get_include_path(), __DIR__ . PATH_SEPARATOR . $path, '::addIncludePath() adds a path to the front of include_path');
sfToolkit::addIncludePath(__DIR__, 'back');
$t->is(get_include_path(), $path . PATH_SEPARATOR . __DIR__, '::addIncludePath() moves a path to the end of include_path');
sfToolkit::addIncludePath(array(__DIR__, __DIR__ . '/..'));
$t->is(get_include_path(), __DIR__ . PATH_SEPARATOR . __DIR__ . '/..' . PATH_SEPARATOR . $path, '::addIncludePath() adds multiple paths the the front of include_path');
sfToolkit::addIncludePath(array(__DIR__, __DIR__ . '/..'), 'back');
$t->is(get_include_path(), $path . PATH_SEPARATOR . __DIR__ . PATH_SEPARATOR . __DIR__ . '/..', '::addIncludePath() adds multiple paths the the back of include_path');
try {
    sfToolkit::addIncludePath(__DIR__, 'foobar');
    $t->fail('::addIncludePath() throws an exception if position is not valid');
} catch (Exception $e) {
    $t->pass('::addIncludePath() throws an exception if position is not valid');
}
Example #13
0
<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

define('SF_DIR', dirname(__FILE__).'/../../../../lib/vendor/symfony/');
require_once SF_DIR . 'test/bootstrap/unit.php';
require_once SF_DIR . 'lib/autoload/sfSimpleAutoload.class.php';

$autoload = sfSimpleAutoload::getInstance(sys_get_temp_dir().DIRECTORY_SEPARATOR.sprintf('sf_autoload_unit_propel_%s.data', md5(__FILE__)));
$autoload->addDirectory(realpath(dirname(__FILE__).'/../../lib'));
$autoload->addDirectory(realpath(dirname(__FILE__).'/../../lib/vendor/propel'));
$autoload->addDirectory(realpath(dirname(__FILE__).'/../../lib/vendor/phing/classes'));
$autoload->register();

$_test_dir = realpath(dirname(__FILE__).'/..');

sfToolkit::addIncludePath(dirname(__FILE__).'/../../lib/vendor');
sfToolkit::addIncludePath(dirname(__FILE__).'/../../lib/vendor/propel');
sfToolkit::addIncludePath(dirname(__FILE__).'/../../lib/vendor/phing/classes');
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
sfToolkit::addIncludePath(sfConfig::get('sf_symfony_lib_dir') . '/plugins/sfPropelPlugin/lib/vendor');
$t = new lime_test(1, new lime_output_color());
$configuration = array('propel' => array('datasources' => array('propel' => array('adapter' => 'mysql', 'connection' => array('dsn' => 'mysql:dbname=testdb;host=localhost', 'user' => 'foo', 'password' => 'bar', 'classname' => 'PropelPDO', 'options' => array('ATTR_PERSISTENT' => true, 'ATTR_AUTOCOMMIT' => false), 'settings' => array('charset' => array('value' => 'utf8'), 'queries' => array()))), 'default' => 'propel')));
$parametersTests = array('dsn' => 'mysql:dbname=testdb;host=localhost', 'username' => 'foo', 'password' => 'bar', 'encoding' => 'utf8', 'persistent' => true, 'options' => array('ATTR_AUTOCOMMIT' => false));
$p = new sfPropelDatabase($parametersTests);
$t->is($p->getConfiguration(), $configuration, 'initialize() - creates a valid propel configuration from parameters');
Example #15
0
// ::addIncludePath()
$t->diag('::addIncludePath()');
$path = get_include_path();
$t->is(sfToolkit::addIncludePath(dirname(__FILE__)), $path, '::addIncludePath() returns the previous include_path');
$t->is(get_include_path(), dirname(__FILE__).PATH_SEPARATOR.$path, '::addIncludePath() adds a path to the front of include_path');

sfToolkit::addIncludePath(dirname(__FILE__), 'back');
$t->is(get_include_path(), $path.PATH_SEPARATOR.dirname(__FILE__), '::addIncludePath() moves a path to the end of include_path');

sfToolkit::addIncludePath(array(
  dirname(__FILE__),
  dirname(__FILE__).'/..',
));
$t->is(get_include_path(), dirname(__FILE__).PATH_SEPARATOR.dirname(__FILE__).'/..'.PATH_SEPARATOR.$path, '::addIncludePath() adds multiple paths the the front of include_path');

sfToolkit::addIncludePath(array(
  dirname(__FILE__),
  dirname(__FILE__).'/..',
), 'back');
$t->is(get_include_path(), $path.PATH_SEPARATOR.dirname(__FILE__).PATH_SEPARATOR.dirname(__FILE__).'/..', '::addIncludePath() adds multiple paths the the back of include_path');

try
{
  sfToolkit::addIncludePath(dirname(__FILE__), 'foobar');
  $t->fail('::addIncludePath() throws an exception if position is not valid');
}
catch (Exception $e)
{
  $t->pass('::addIncludePath() throws an exception if position is not valid');
}
Example #16
0
 protected function callPhing($taskName, $checkSchema, $properties = array())
 {
     $schemas = sfFinder::type('file')->name('*schema.xml')->relative()->follow_link()->in(sfConfig::get('sf_config_dir'));
     if (self::CHECK_SCHEMA === $checkSchema && !$schemas) {
         throw new sfCommandException('You must create a schema.yml or schema.xml file.');
     }
     // Call phing targets
     sfToolkit::addIncludePath(array(sfConfig::get('sf_symfony_lib_dir'), sfConfig::get('sf_propel_generator_path', realpath(dirname(__FILE__) . '/../vendor/propel-generator/classes'))));
     $args = array();
     $bufferPhingOutput = null === $this->commandApplication || !$this->commandApplication->withTrace();
     $properties = array_merge(array('build.properties' => 'propel.ini', 'project.dir' => sfConfig::get('sf_config_dir'), 'propel.output.dir' => sfConfig::get('sf_root_dir')), $properties);
     foreach ($properties as $key => $value) {
         $args[] = "-D{$key}={$value}";
     }
     // Build file
     $args[] = '-f';
     $args[] = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'propel-generator' . DIRECTORY_SEPARATOR . 'build.xml');
     // Logger
     if (DIRECTORY_SEPARATOR != '\\' && (function_exists('posix_isatty') && @posix_isatty(STDOUT))) {
         $args[] = '-logger';
         $args[] = 'phing.listener.AnsiColorLogger';
     }
     // Add our listener to detect errors
     $args[] = '-listener';
     $args[] = 'sfPhingListener';
     // Add any arbitrary arguments last
     foreach ($this->additionalPhingArgs as $arg) {
         if (in_array($arg, array('verbose', 'debug'))) {
             $bufferPhingOutput = false;
         }
         $args[] = '-' . $arg;
     }
     $args[] = $taskName;
     // filter arguments through the event dispatcher
     $args = $this->dispatcher->filter(new sfEvent($this, 'propel.filter_phing_args'), $args)->getReturnValue();
     require_once dirname(__FILE__) . '/sfPhing.class.php';
     // enable output buffering
     Phing::setOutputStream(new OutputStream(fopen('php://output', 'w')));
     Phing::startup();
     Phing::setProperty('phing.home', getenv('PHING_HOME'));
     $this->logSection('propel', 'Running "' . $taskName . '" phing task');
     if ($bufferPhingOutput) {
         ob_start();
     }
     $m = new sfPhing();
     $m->execute($args);
     $m->runBuild();
     if ($bufferPhingOutput) {
         ob_end_clean();
     }
     chdir(sfConfig::get('sf_root_dir'));
     // any errors?
     $ret = true;
     if (sfPhingListener::hasErrors()) {
         $messages = array('Some problems occurred when executing the task:');
         foreach (sfPhingListener::getExceptions() as $exception) {
             $messages[] = '';
             $messages[] = preg_replace('/^.*build\\-propel\\.xml/', 'build-propel.xml', $exception->getMessage());
             $messages[] = '';
         }
         if (count(sfPhingListener::getErrors())) {
             $messages[] = 'If the exception message is not clear enough, read the output of the task for';
             $messages[] = 'more information';
         }
         $this->logBlock($messages, 'ERROR_LARGE');
         $ret = false;
     }
     return $ret;
 }
Example #17
0
define('SF_DIR', dirname(__FILE__) . '/../../../../lib/vendor/symfony/');
// we need SQLite for functional tests
if (!extension_loaded('SQLite') && !extension_loaded('pdo_SQLite')) {
    echo "SQLite extension is required to run unit tests\n";
    return false;
}
if (!isset($root_dir)) {
    $root_dir = realpath(dirname(__FILE__) . sprintf('/../%s/fixtures', isset($type) ? $type : 'functional'));
}
require_once $root_dir . '/config/ProjectConfiguration.class.php';
$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true);
sfContext::createInstance($configuration);
// FIXME
// for behavior inclusions
// this a bit dirty, but allow functionnal tests to work.
sfToolkit::addIncludePath(array(realpath(dirname(__FILE__) . '/../../')));
// remove all cache
sf_functional_test_shutdown();
register_shutdown_function('sf_functional_test_shutdown');
$configuration->initializePropel($app);
if (isset($fixtures)) {
    $configuration->loadFixtures($fixtures);
}
function sf_functional_test_shutdown_cleanup()
{
    sfToolkit::clearDirectory(sfConfig::get('sf_cache_dir'));
    sfToolkit::clearDirectory(sfConfig::get('sf_log_dir'));
}
function sf_functional_test_shutdown()
{
    // try/catch needed due to http://bugs.php.net/bug.php?id=33598
 public function setIncludePath()
 {
     sfToolkit::addIncludePath(array(dirname(__FILE__) . '/../vendor/PEAR/', dirname(__FILE__) . '/../vendor/OAuth/', dirname(__FILE__) . '/../vendor/simplepie/'));
 }
Example #19
0
<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../../../../test/bootstrap/unit.php';
require_once dirname(__FILE__) . '/../../../../autoload/sfSimpleAutoload.class.php';
$autoload = sfSimpleAutoload::getInstance(sys_get_temp_dir() . DIRECTORY_SEPARATOR . sprintf('sf_autoload_unit_propel_%s.data', md5(__FILE__)));
$autoload->addDirectory(realpath(dirname(__FILE__) . '/../../lib'));
$autoload->register();
$_test_dir = realpath(dirname(__FILE__) . '/..');
sfToolkit::addIncludePath(realpath(dirname(__FILE__) . '/../../lib/vendor'));