Author: ornicar2 Date: 2010-01-23 14:00:24 +0100 (Sat, 23 Jan 2010) New Revision: 27090
Added: plugins/diemPlugin/trunk/licenses/LICENSE.zend_framework Removed: plugins/diemPlugin/trunk/dmCorePlugin/lib/debug/dmWebDebugPanelDoctrine.php plugins/diemPlugin/trunk/dmCorePlugin/lib/widget/sfWidgetFormDmDbSelectDoubleList.php plugins/diemPlugin/trunk/dmCorePlugin/lib/widget/sfWidgetFormDmSelectDoubleList.class.php plugins/diemPlugin/trunk/licenses/LICENSE.zf Modified: plugins/diemPlugin/trunk/COPYRIGHT plugins/diemPlugin/trunk/dmCorePlugin/config/dm/services.yml plugins/diemPlugin/trunk/dmCorePlugin/lib/config/dmProjectConfiguration.php plugins/diemPlugin/trunk/dmCorePlugin/lib/debug/dmWebDebugPanelConfig.php plugins/diemPlugin/trunk/dmCorePlugin/lib/log/dmFileLog.php plugins/diemPlugin/trunk/dmCorePlugin/lib/log/event/dmEventLog.php plugins/diemPlugin/trunk/dmCorePlugin/lib/log/request/dmRequestLog.php plugins/diemPlugin/trunk/dmCorePlugin/lib/request/dmWebRequest.php plugins/diemPlugin/trunk/dmCorePlugin/lib/task/dmUpgradeTask.class.php plugins/diemPlugin/trunk/dmCorePlugin/lib/widget/sfWidgetFormDmInputFile.class.php plugins/diemPlugin/trunk/dmCorePlugin/test/project/config/ProjectConfiguration.class.php plugins/diemPlugin/trunk/dmCorePlugin/test/project/data/db.sqlite plugins/diemPlugin/trunk/dmCorePlugin/test/project/data/fresh_db.sqlite plugins/diemPlugin/trunk/dmCorePlugin/test/project/test/functional/dmRefreshFunctionalTestInclude.php Log: [Diem] - removed some deprecated classes - refactored dmEventLog, dmRequestLog and dmFileLog - changed Diem file log format - removed deprecated method useTidy on dmWebRequest Modified: plugins/diemPlugin/trunk/COPYRIGHT =================================================================== --- plugins/diemPlugin/trunk/COPYRIGHT 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/COPYRIGHT 2010-01-23 13:00:24 UTC (rev 27090) @@ -2,35 +2,27 @@ ======= Thibault Duplessis ------------------- -Lead developper +Lead developer Daniel Lohse ------------- German translation, dmAlternativeHelperPlugin Stéphane Girault ----------------- -PostGreSQL support, hudson installation +PostGreSQL support, Hudson installation Benjamin Rösch --------------- Spanish translation Marco Barberis --------------- Italian translation Matthieu Bontemps ------------------ Unit tests Vasiliy Ivanov --------------- Russian translation Bojan Jankuloski ----------------- Macedonian translation COPYRIGHTS @@ -48,7 +40,7 @@ Url: http://framework.zend.com/ Copyright: Zend Technologies USA, Inc. -License: new BSD license - see licenses/LICENSE.zf +License: new BSD license - see licenses/LICENSE.zend_framework jQuery ------ Modified: plugins/diemPlugin/trunk/dmCorePlugin/config/dm/services.yml =================================================================== --- plugins/diemPlugin/trunk/dmCorePlugin/config/dm/services.yml 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/dmCorePlugin/config/dm/services.yml 2010-01-23 13:00:24 UTC (rev 27090) @@ -101,7 +101,7 @@ file: 'data/dm/log/event.log' # where to save the log file, relative to project root directory entry_service_name: event_log_entry # service name for an entry of this log rotation: true # enable rotation on the log file ( strongly recommended ) - max_size_megabytes: 1 # max size for the log file before rotating + max_size_kilobytes: 1024 # max size for the log file before rotating ignore_models: [] # models not to log ignore_internal_actions: true # whether to ignore Diem internal actions @@ -113,7 +113,7 @@ file: 'data/dm/log/request.log' # where to save the log file, relative to project root directory entry_service_name: request_log_entry # service name for an entry of this log rotation: true # enable rotation on the log file ( strongly recommended ) - max_size_megabytes: 3 # max size for the log file before rotating + max_size_kilobytes: 1024 # max size for the log file before rotating request_log_entry.class: dmRequestLogEntry # An entry of the event log Modified: plugins/diemPlugin/trunk/dmCorePlugin/lib/config/dmProjectConfiguration.php =================================================================== --- plugins/diemPlugin/trunk/dmCorePlugin/lib/config/dmProjectConfiguration.php 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/dmCorePlugin/lib/config/dmProjectConfiguration.php 2010-01-23 13:00:24 UTC (rev 27090) @@ -80,10 +80,6 @@ 'baseTableClassName' => 'myDoctrineTable', 'suffix' => '.class.php' )); - - $this->dispatcher->disconnect('debug.web.load_panels', array('sfWebDebugPanelDoctrine', 'listenToAddPanelEvent')); - - $this->dispatcher->connect('debug.web.load_panels', array('dmWebDebugPanelDoctrine', 'listenToAddPanelEvent')); } protected function configureDoctrineCache(Doctrine_Manager $manager) Modified: plugins/diemPlugin/trunk/dmCorePlugin/lib/debug/dmWebDebugPanelConfig.php =================================================================== --- plugins/diemPlugin/trunk/dmCorePlugin/lib/debug/dmWebDebugPanelConfig.php 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/dmCorePlugin/lib/debug/dmWebDebugPanelConfig.php 2010-01-23 13:00:24 UTC (rev 27090) @@ -35,8 +35,6 @@ protected function dumpConfig(array $array) { - $timer = dmDebug::timerOrNull('dmWebDebugPanelConfig::dumpConfig'); - if (sfConfig::get('dm_web_debug_config_fast_dump', true)) { // generate html with fast print_r function @@ -60,8 +58,6 @@ $dumped = sfYaml::dump($array); } - $timer && $timer->addTime(); - return $dumped; } } \ No newline at end of file Deleted: plugins/diemPlugin/trunk/dmCorePlugin/lib/debug/dmWebDebugPanelDoctrine.php =================================================================== --- plugins/diemPlugin/trunk/dmCorePlugin/lib/debug/dmWebDebugPanelDoctrine.php 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/dmCorePlugin/lib/debug/dmWebDebugPanelDoctrine.php 2010-01-23 13:00:24 UTC (rev 27090) @@ -1,86 +0,0 @@ -<?php - -/* - * This file is part of the symfony package. - * (c) Fabien Potencier <[email protected]> - * (c) Jonathan H. Wage <[email protected]> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfWebDebugPanelDoctrine adds a panel to the web debug toolbar with Doctrine information. - * - * @package symfony - * @subpackage debug - * @author Fabien Potencier <[email protected]> - * @author Jonathan H. Wage <[email protected]> - * @version SVN: $Id: sfWebDebugPanelDoctrine.class.php 11205 2008-08-27 16:24:17Z fabien $ - */ -class dmWebDebugPanelDoctrine extends sfWebDebugPanelDoctrine -{ - - /** - * Builds the sql logs and returns them as an array. - * - * @return array - */ - protected function getSqlLogs() - { - $logs = $this->webDebug->getLogger()->getLogs(); - - $html = array(); - foreach ($this->getDoctrineEvents() as $i => $event) - { - $conn = $event->getInvoker() instanceof Doctrine_Connection ? $event->getInvoker() : $event->getInvoker()->getConnection(); - $params = sfDoctrineConnectionProfiler::fixParams($event->getParams()); - $query = $this->formatSql(htmlspecialchars($event->getQuery(), ENT_QUOTES, sfConfig::get('sf_charset'))); - - // interpolate parameters - foreach ($params as $param) - { - $query = join(var_export(is_scalar($param) ? $param : (string) $param, true), explode('?', $query, 2)); - } - - // slow query - if ($event->slowQuery && $this->getStatus() > sfLogger::NOTICE) - { - $this->setStatus(sfLogger::NOTICE); - } - - // backtrace - $backtrace = null; - foreach ($logs as $i => $log) - { - if (!$log['debug_backtrace']) - { - // backtrace disabled - break; - } - - if (false !== strpos($log['message'], $event->getQuery())) - { - // assume queries are being requested in order - unset($logs[$i]); - $backtrace = ' '.$this->getToggleableDebugStack($log['debug_backtrace']); - break; - } - } - - $html[] = sprintf(' - <li class="%s"> - <p class="sfWebDebugDatabaseQuery">%s</p> - <div class="sfWebDebugDatabaseLogInfo">%s ms, "%s" connection%s</div> - </li>', - $event->slowQuery ? 'sfWebDebugWarning' : '', - $query, - number_format($event->getElapsedSecs()*1000, 2), - $conn->getName(), - $backtrace - ); - } - - return $html; - } -} Modified: plugins/diemPlugin/trunk/dmCorePlugin/lib/log/dmFileLog.php =================================================================== --- plugins/diemPlugin/trunk/dmCorePlugin/lib/log/dmFileLog.php 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/dmCorePlugin/lib/log/dmFileLog.php 2010-01-23 13:00:24 UTC (rev 27090) @@ -12,7 +12,7 @@ { return array_merge(parent::getDefaultOptions(), array( 'rotation' => true, - 'max_size_megabytes' => 3, + 'max_size_kilobytes' => 2, 'buffer_size' => 1024 * 16 )); } @@ -46,12 +46,7 @@ $entry->configure($data); - $data = $this->encode($entry->toArray()); - - if (0 !== filesize($this->options['file'])) - { - $data = "\n".$data; - } + $data = "\n".$this->encode($entry->toArray()); if($fp = fopen($this->options['file'], 'a')) { @@ -63,18 +58,13 @@ throw new dmException(sprintf('Can not log in %s', $this->options['file'])); } - if (dmArray::get($this->options, 'rotation', true)) + if ($this->options['rotation']/* && !$_SERVER['REQUEST_TIME']%10*/) { $this->checkRotation(); } } catch(Exception $e) { - $this->dispatcher->notify(new sfEvent($this, 'application.log', array( - 'Can not log this request : '.$e->getMessage(), - sfLogger::ERR - ))); - if (sfConfig::get('dm_debug')) { throw $e; @@ -84,17 +74,12 @@ protected function checkRotation() { - if (rand(0, 20)) - { - return; - } - - $maxSize = dmArray::get($this->options, 'max_size_megabytes', 4) * 1024 * 1024; + $maxSize = $this->options['max_size_kilobytes'] * 1024 * 1024; if (filesize($this->options['file']) > $maxSize) { - $logs = file($this->options['file']); - file_put_contents($this->options['file'], implode("\n", array_slice($logs, round(count($logs)/4)))); + $logs = file($this->options['file'], FILE_IGNORE_NEW_LINES); + file_put_contents($this->options['file'], implode("\n", array_slice($logs, round(count($logs)/2)))); unset($logs); } } @@ -104,7 +89,6 @@ $this->checkFile(); $options = array_merge(array( - 'fix_log' => true, 'hydrate' => true, 'keys' => null, 'filter' => null @@ -139,45 +123,40 @@ foreach(array_reverse($encodedLines) as $encodedLine) { - $data = $this->decode($encodedLine); + if(empty($encodedLine)) + { + continue; + } - if (!empty($data) && is_array($data)) + $data = $this->restoreKeys($this->decode($encodedLine)); + + if ($filter && !call_user_func($filter, $data)) { - if (!is_array($data)) dmDebug::kill($data); - if ($filter && !call_user_func($filter, $data)) + continue; + } + + if ($options['hydrate']) + { + $entries[] = $this->buildEntry($data); + } + elseif($options['keys']) + { + $entry = array(); + foreach($options['keys'] as $key) { - continue; + $entry[$key] = $data[$key]; } - - if ($options['hydrate']) - { - $entries[] = $this->buildEntry($data); - } - elseif($options['keys']) - { - $entry = array(); - foreach($options['keys'] as $key) - { - $entry[$key] = $data[$key]; - } - $entries[] = $entry; - } - else - { - $entries[] = $data; - } - - if ($max && (++$nb == $max)) - { - break 2; - } + $entries[] = $entry; } - elseif($options['fix_log']) + else { - $this->fixLog(); - $options['fix_log'] = false; - return $this->getEntries($max, $options); + $entries[] = $data; } + + if ($max && (++$nb == $max)) + { + break 2; + } } unset($encodedLines, $data); @@ -188,17 +167,8 @@ protected function fixLog() { - $lines = file($this->options['file'], FILE_IGNORE_NEW_LINES); - // remove empty lines - $lines = array_filter($lines); + $this->clear(); - // separate collapsed lines - $lines = str_replace('"}{"', "\"}\n{\"", $lines); - - file_put_contents($this->options['file'], implode("\n", $lines)); - - unset($lines); - $this->dispatcher->notify(new sfEvent($this, 'application.log', array( $this->getKey().' log has been fixed', sfLogger::NOTICE @@ -214,13 +184,18 @@ protected function encode(array $array) { - return json_encode($array); + return implode('|', str_replace('|', ' ', $array)); } protected function decode($string) { - return json_decode($string, true); + return explode('|', $string); } + + protected function restoreKeys(array $arrayEntry) + { + return array_combine($this->fields, $arrayEntry); + } protected function checkFile() { Modified: plugins/diemPlugin/trunk/dmCorePlugin/lib/log/event/dmEventLog.php =================================================================== --- plugins/diemPlugin/trunk/dmCorePlugin/lib/log/event/dmEventLog.php 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/dmCorePlugin/lib/log/event/dmEventLog.php 2010-01-23 13:00:24 UTC (rev 27090) @@ -2,6 +2,17 @@ class dmEventLog extends dmFileLog { + protected + $fields = array( + 'time', + 'ip', + 'session_id', + 'user_id', + 'action', + 'type', + 'subject' + ); + public function getDefaultOptions() { return array_merge(parent::getDefaultOptions(), array( Modified: plugins/diemPlugin/trunk/dmCorePlugin/lib/log/request/dmRequestLog.php =================================================================== --- plugins/diemPlugin/trunk/dmCorePlugin/lib/log/request/dmRequestLog.php 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/dmCorePlugin/lib/log/request/dmRequestLog.php 2010-01-23 13:00:24 UTC (rev 27090) @@ -2,6 +2,21 @@ class dmRequestLog extends dmFileLog { + protected + $fields = array( + 'time', + 'uri', + 'code', + 'app', + 'env', + 'ip', + 'user_id', + 'user_agent', + 'xhr', + 'mem', + 'timer' + ); + public function getDefaultOptions() { return array_merge(parent::getDefaultOptions(), array( Modified: plugins/diemPlugin/trunk/dmCorePlugin/lib/request/dmWebRequest.php =================================================================== --- plugins/diemPlugin/trunk/dmCorePlugin/lib/request/dmWebRequest.php 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/dmCorePlugin/lib/request/dmWebRequest.php 2010-01-23 13:00:24 UTC (rev 27090) @@ -35,11 +35,6 @@ { return $this->getParameter('dm_flash'); } - - public function useTidy() - { - return dmHtml::isEnabled() && !$this->getParameter('dm_tidy_disable'); - } /** * Returns the request context used. Modified: plugins/diemPlugin/trunk/dmCorePlugin/lib/task/dmUpgradeTask.class.php =================================================================== --- plugins/diemPlugin/trunk/dmCorePlugin/lib/task/dmUpgradeTask.class.php 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/dmCorePlugin/lib/task/dmUpgradeTask.class.php 2010-01-23 13:00:24 UTC (rev 27090) @@ -10,7 +10,8 @@ '500ALPHA4', '500ALPHA6', 'deprecateMediaWidgets', - 'addGaToken' + 'addGaToken', + 'clearLogs' ); /** @@ -130,4 +131,21 @@ $setting->save(); } } + + /* + * Clear old school formatted logs + */ + protected function upgradeToClearLogs() + { + foreach(array('request', 'event') as $logName) + { + $file = sfConfig::get('sf_data_dir').'/dm/log/'.$logName.'.log'; + + if(false !== strpos(file_get_contents($file), '{"time":')) + { + $this->logSection('upgrade', 'Cleared old school formatted log '.$logName); + file_put_contents($file, ''); + } + } + } } \ No newline at end of file Deleted: plugins/diemPlugin/trunk/dmCorePlugin/lib/widget/sfWidgetFormDmDbSelectDoubleList.php =================================================================== --- plugins/diemPlugin/trunk/dmCorePlugin/lib/widget/sfWidgetFormDmDbSelectDoubleList.php 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/dmCorePlugin/lib/widget/sfWidgetFormDmDbSelectDoubleList.php 2010-01-23 13:00:24 UTC (rev 27090) @@ -1,93 +0,0 @@ -<?php - -class sfWidgetFormDmDbSelectDoubleList extends sfWidgetFormDmSelectDoubleList -{ - /** - * @see sfWidget - */ - public function __construct($options = array(), $attributes = array()) - { - $options['choices'] = new sfCallable(array($this, 'getChoices')); - - parent::__construct($options, $attributes); - } - - /** - * Constructor. - * - * Available options: - * - * * model: The model class (required) - * * method: The method to use to display object values (__toString by default) - * * key_method: The method to use to display the object keys (getPrimaryKey by default) - * * order_by: An array composed of two fields: - * * The column to order by the results (must be in the PhpName format) - * * asc or desc - * * connection: The Propel connection to use (null by default) - * * multiple: true if the select tag must allow multiple selections - * * find_method: The finder method to use to fetch objects - * - * @see sfWidgetFormSelect - */ - protected function configure($options = array(), $attributes = array()) - { - $this->addRequiredOption('model'); - $this->addOption('method', '__toString'); - $this->addOption('key_method', 'getPrimaryKey'); - $this->addOption('order_by', null); - $this->addOption('connection', null); - $this->addOption('find_method', 'find'); - - parent::configure($options, $attributes); - } - - /** - * Returns the choices associated to the model. - * - * @return array An array of choices - */ - public function getChoices() - { - $choices = array(); - - $peerClass = constant($this->getOption('model').'::PEER'); - - $finder = dm::db($this->getOption('model')); - - if ($order = $this->getOption('order_by')) - { - $finder->orderBy( - call_user_func(array($peerClass, 'translateFieldName'), $order[0], BasePeer::TYPE_PHPNAME, BasePeer::TYPE_COLNAME), - strtolower($order[1]) - ); - } - - if($connection = $this->getOption('connection')) - { - $finder->setConnection($connection); - } - - $findMethod = $this->getOption('find_method'); - - $objects = $finder->$findMethod($this->getOption('connection')); - - $methodKey = $this->getOption('key_method'); - if (!method_exists($this->getOption('model'), $methodKey)) - { - throw new RuntimeException(sprintf('Class "%s" must implement a "%s" method to be rendered in a "%s" widget', $this->getOption('model'), $methodKey, __CLASS__)); - } - - $methodValue = $this->getOption('method'); - if (!method_exists($this->getOption('model'), $methodValue)) - { - throw new RuntimeException(sprintf('Class "%s" must implement a "%s" method to be rendered in a "%s" widget', $this->getOption('model'), $methodValue, __CLASS__)); - } - - foreach ($objects as $object) - { - $choices[$object->$methodKey()] = $object->$methodValue(); - } - - return $choices; - } -} \ No newline at end of file Modified: plugins/diemPlugin/trunk/dmCorePlugin/lib/widget/sfWidgetFormDmInputFile.class.php =================================================================== --- plugins/diemPlugin/trunk/dmCorePlugin/lib/widget/sfWidgetFormDmInputFile.class.php 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/dmCorePlugin/lib/widget/sfWidgetFormDmInputFile.class.php 2010-01-23 13:00:24 UTC (rev 27090) @@ -1,20 +1,7 @@ <?php -/* - * This file is part of the symfony package. - * (c) Fabien Potencier <[email protected]> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - /** - * sfWidgetFormInputFile represents an upload HTML input tag. - * - * @package symfony - * @subpackage widget - * @author Fabien Potencier <[email protected]> - * @version SVN: $Id: sfWidgetFormInputFile.class.php 9046 2008-05-19 08:13:51Z FabianLange $ + * @see sfWidgetFormInputFile */ class sfWidgetFormDmInputFile extends sfWidgetFormInputFile { Deleted: plugins/diemPlugin/trunk/dmCorePlugin/lib/widget/sfWidgetFormDmSelectDoubleList.class.php =================================================================== --- plugins/diemPlugin/trunk/dmCorePlugin/lib/widget/sfWidgetFormDmSelectDoubleList.class.php 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/dmCorePlugin/lib/widget/sfWidgetFormDmSelectDoubleList.class.php 2010-01-23 13:00:24 UTC (rev 27090) @@ -1,152 +0,0 @@ -<?php - -/* - * This file is part of the symfony package. - * (c) Fabien Potencier <[email protected]> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -/** - * sfWidgetFormSelectDoubleList represents a multiple select displayed as a double list. - * - * This widget needs some JavaScript to work. So, you need to include the JavaScripts - * files returned by the getJavaScripts() method. - * - * If you use symfony 1.2, it can be done automatically for you. - * - * @package symfony - * @subpackage widget - * @author Fabien Potencier <[email protected]> - * @version SVN: $Id: sfWidgetFormSelectDoubleList.class.php 12412 2008-10-29 14:19:06Z fabien $ - */ -class sfWidgetFormDmSelectDoubleList extends sfWidgetForm -{ - /** - * Constructor. - * - * Available options: - * - * * choices: An array of possible choices (required) - * * class: The main class of the widget - * * class_select: The class for the two select tags - * * label_unassociated: The label for unassociated - * * label_associated: The label for associated - * * unassociate: The HTML for the unassociate link - * * associate: The HTML for the associate link - * * template: The HTML template to use to render this widget - * The available placeholders are: - * * label_associated - * * label_unassociated - * * associate - * * unassociate - * * associated - * * unassociated - * * class - * - * @param array $options An array of options - * @param array $attributes An array of default HTML attributes - * - * @see sfWidgetForm - */ - protected function configure($options = array(), $attributes = array()) - { - $this->addRequiredOption('choices'); - - $this->addOption('class', 'dm_double_list'); - $this->addOption('class_select', 'double_list_select'); - $this->addOption('label_unassociated', dm::getI18n()->__('Unassociated')); - $this->addOption('label_associated', dm::getI18n()->__('Associated')); - $this->addOption('unassociate', '<span class="s16block s16_previous"></span>'); - $this->addOption('associate', '<span class="s16block s16_next"></span>'); - $this->addOption('template', <<<EOF -<div class="%class% clearfix"> - <div class="dm_list_unassociated"> - <div class="dm_double_list_label">%label_unassociated%</div> - %unassociated% - </div> - <div class="dm_list_control"> - %associate% - <br /> - %unassociate% - </div> - <div class="dm_list_associated"> - <div class="dm_double_list_label">%label_associated%</div> - %associated% - </div> -</div> -EOF -); - } - - /** - * Renders the widget. - * - * @param string $name The element name - * @param string $value The value selected in this widget - * @param array $attributes An array of HTML attributes to be merged with the default HTML attributes - * @param array $errors An array of errors for the field - * - * @return string An HTML tag string - * - * @see sfWidgetForm - */ - public function render($name, $value = null, $attributes = array(), $errors = array()) - { - if (null === $value) - { - $value = array(); - } - - $choices = $this->getOption('choices'); - if ($choices instanceof sfCallable) - { - $choices = $choices->call(); - } - - $associated = array(); - $unassociated = array(); - foreach ($choices as $key => $option) - { - if (in_array(strval($key), $value)) - { - $associated[$key] = $option; - } - else - { - $unassociated[$key] = $option; - } - } - - $size = isset($attributes['size']) ? $attributes['size'] : (isset($this->attributes['size']) ? $this->attributes['size'] : 10); - - $associatedWidget = new sfWidgetFormSelect(array('multiple' => true, 'choices' => $associated), array('size' => $size, 'class' => $this->getOption('class_select').'-selected')); - $unassociatedWidget = new sfWidgetFormSelect(array('multiple' => true, 'choices' => $unassociated), array('size' => $size, 'class' => $this->getOption('class_select'))); - - return strtr($this->getOption('template'), array( - '%class%' => $this->getOption('class'), - '%class_select%' => $this->getOption('class_select'), - '%id%' => $this->generateId($name), - '%label_associated%' => $this->getOption('label_associated'), - '%label_unassociated%' => $this->getOption('label_unassociated'), - '%associate%' => sprintf('<a href="#" onclick="%s" class="s16block s16_next">%s</a>', 'sfDoubleList.move(\'unassociated_'.$this->generateId($name).'\', \''.$this->generateId($name).'\'); return false;', $this->getOption('associate')), - '%unassociate%' => sprintf('<a href="#" onclick="%s" class="s16block s16_previous">%s</a>', 'sfDoubleList.move(\''.$this->generateId($name).'\', \'unassociated_'.$this->generateId($name).'\'); return false;', $this->getOption('unassociate')), - '%associated%' => $associatedWidget->render($name), - '%unassociated%' => $unassociatedWidget->render('unassociated_'.$name), - )); - } - - public function __clone() - { - if ($this->getOption('choices') instanceof sfCallable) - { - $callable = $this->getOption('choices')->getCallable(); - if (is_array($callable)) - { - $callable[0] = $this; - $this->setOption('choices', new sfCallable($callable)); - } - } - } -} Modified: plugins/diemPlugin/trunk/dmCorePlugin/test/project/config/ProjectConfiguration.class.php =================================================================== --- plugins/diemPlugin/trunk/dmCorePlugin/test/project/config/ProjectConfiguration.class.php 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/dmCorePlugin/test/project/config/ProjectConfiguration.class.php 2010-01-23 13:00:24 UTC (rev 27090) @@ -49,25 +49,20 @@ copy(dmOs::join(sfConfig::get('sf_data_dir'), 'db.sqlite'), dmOs::join(sfConfig::get('sf_data_dir'), 'fresh_db.sqlite')); - foreach(array('core', 'front', 'admin') as $assetDirName) - { - if(is_readable($assetDir = dmOs::join(sfConfig::get('sf_web_dir'), 'dm', $assetDirName))) - { - unlink($assetDir); - } - } + $this->removeWebSymlinks(); - if(is_readable($dmDir = dmOs::join(sfConfig::get('sf_web_dir'), 'dm'))) - { - rmdir($dmDir); - } + sfConfig::set('dm_test_project_built', true); + } + + protected function removeWebSymlinks() + { + @unlink(dmOs::join(sfConfig::get('sf_web_dir'), 'sf')); + @unlink(dmOs::join(sfConfig::get('sf_web_dir'), 'dmFlowPlayerPlugin')); - if(is_readable($sfDir = dmOs::join(sfConfig::get('sf_web_dir'), 'sf'))) + foreach(array('core', 'front', 'admin') as $dmAssetDir) { - unlink($sfDir); + @unlink(sfConfig::get('sf_web_dir').'/dm/'.$dmAssetDir); } - - sfConfig::set('dm_test_project_built', true); } public function cleanup(sfFilesystem $filesystem) @@ -79,11 +74,7 @@ $filesystem->remove(sfFinder::type('file')->name('sitemap*')->in(sfConfig::get('sf_web_dir'))); copy(dmOs::join(sfConfig::get('sf_data_dir'), 'fresh_db.sqlite'), dmOs::join(sfConfig::get('sf_data_dir'), 'db.sqlite')); $this->cleanupUploads($filesystem); - - foreach(array('core', 'front', 'admin') as $dmAssetDir) - { - unlink(sfConfig::get('sf_web_dir').'/dm/'.$dmAssetDir); - } + $this->removeWebSymlinks(); } protected function cleanupUploads(sfFilesystem $filesystem) Modified: plugins/diemPlugin/trunk/dmCorePlugin/test/project/data/db.sqlite =================================================================== (Binary files differ) Modified: plugins/diemPlugin/trunk/dmCorePlugin/test/project/data/fresh_db.sqlite =================================================================== (Binary files differ) Modified: plugins/diemPlugin/trunk/dmCorePlugin/test/project/test/functional/dmRefreshFunctionalTestInclude.php =================================================================== --- plugins/diemPlugin/trunk/dmCorePlugin/test/project/test/functional/dmRefreshFunctionalTestInclude.php 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/dmCorePlugin/test/project/test/functional/dmRefreshFunctionalTestInclude.php 2010-01-23 13:00:24 UTC (rev 27090) @@ -26,7 +26,7 @@ * On some old version of sqlite * This test will not work as expected */ -if('Sqlite' == Doctrine_Manager::getInstance()->getCurrentConnection()->getDriverName()) +if('front' == sfConfig::get('sf_app') && 'Sqlite' == Doctrine_Manager::getInstance()->getCurrentConnection()->getDriverName()) { return; } Copied: plugins/diemPlugin/trunk/licenses/LICENSE.zend_framework (from rev 27054, plugins/diemPlugin/trunk/licenses/LICENSE.zf) =================================================================== --- plugins/diemPlugin/trunk/licenses/LICENSE.zend_framework (rev 0) +++ plugins/diemPlugin/trunk/licenses/LICENSE.zend_framework 2010-01-23 13:00:24 UTC (rev 27090) @@ -0,0 +1,27 @@ +Copyright (c) 2005-2009, Zend Technologies USA, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Zend Technologies USA, Inc. nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Deleted: plugins/diemPlugin/trunk/licenses/LICENSE.zf =================================================================== --- plugins/diemPlugin/trunk/licenses/LICENSE.zf 2010-01-23 10:36:31 UTC (rev 27089) +++ plugins/diemPlugin/trunk/licenses/LICENSE.zf 2010-01-23 13:00:24 UTC (rev 27090) @@ -1,27 +0,0 @@ -Copyright (c) 2005-2009, Zend Technologies USA, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Zend Technologies USA, Inc. nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- You received this message because you are subscribed to the Google Groups "symfony SVN" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/symfony-svn?hl=en.
