Changeset 904

Show
Ignore:
Timestamp:
07/20/08 14:38:59 (3 months ago)
Author:
arnoschn
Message:

merging trunk changes in

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/arnoschn/cache/lib/Ak.php

    r901 r904  
    11301130        foreach ($array as $key => $value) { 
    11311131            $key = is_numeric($key) ? $parent : $key; 
    1132             $value = is_array($value) ? "\r\n".xmlFromArray($value, '', $key) : $value; 
     1132            $value = is_array($value) ? "\r\n".Ak::array_to_xml($value, '', $key) : $value; 
    11331133            $_tags[$key] = $key; 
    11341134            $xml .= sprintf("<%s>%s</%s>\r\n", $key, $value, $key); 
  • branches/arnoschn/cache/lib/AkActiveRecord.php

    r856 r904  
    13471347    function constructFinderSql($options, $select_from_prefix = 'default') 
    13481348    { 
    1349         $sql = isset($options['select_prefix']) ? $options['select_prefix'] : ($select_from_prefix == 'default' ? 'SELECT * FROM '.$this->getTableName() : $select_from_prefix); 
    1350         $sql .= !empty($options['joins']) ? ' '.$options['joins'] : ''; 
     1349        $sql = isset($options['select_prefix']) ? $options['select_prefix'] : ($select_from_prefix == 'default' ? 'SELECT '.(!empty($options['joins'])?$this->getTableName().'.':'') .'* FROM '.$this->getTableName() : $select_from_prefix); 
     1350        $sql .= !empty($options['joins']) ? ' '.$options['joins'] : ''; 
    13511351 
    13521352        $this->addConditions($sql, isset($options['conditions']) ? $options['conditions'] : array()); 
     
    39933993        $attribute_names = Ak::toArray($attribute_names); 
    39943994        foreach ($attribute_names as $attribute_name){ 
    3995             if( 
    3996             $allow_null ? 
    3997             ( 
    3998             isset($this->$attribute_name) ? 
    3999             ( 
    4000             $only_integer ? 
    4001             !is_integer(@$this->$attribute_name) : 
    4002             !is_numeric(@$this->$attribute_name) 
    4003             ) : 
    4004             false 
    4005             ) : 
    4006             ( 
    4007             isset($this->$attribute_name) ? 
    4008             ($only_integer ? !is_integer(@$this->$attribute_name) : !is_numeric(@$this->$attribute_name)) : 
    4009             true 
    4010             ) 
    4011             ) 
    4012             { 
     3995            if (isset($this->$attribute_name)){ 
     3996                $value = $this->$attribute_name; 
     3997                if ($only_integer){ 
     3998                    $is_int = is_numeric($value) && (int)$value == $value; 
     3999                    $has_error = !$is_int; 
     4000                }else{ 
     4001                    $has_error = !is_numeric($value); 
     4002                } 
     4003            }else{ 
     4004                $has_error = $allow_null ? false : true; 
     4005            } 
     4006 
     4007            if ($has_error){ 
    40134008                $this->addError($attribute_name, $message); 
    40144009            } 
  • branches/arnoschn/cache/lib/AkCache.php

    r899 r904  
    252252                $this->_driverInstance =& new Cache_Lite($options); 
    253253                break; 
    254             case 2:$this->cache_enabled = true; 
     254            case 2: 
    255255                require_once(AK_LIB_DIR.'/AkCache/AkAdodbCache.php'); 
    256256                $this->_driverInstance =& new AkAdodbCache(); 
  • branches/arnoschn/cache/lib/AkPlugin/AkPluginManager.php

    r522 r904  
    197197 
    198198        $plugin_name = Ak::sanitize_include($plugin_name, 'high'); 
    199         $repository = $this->getRepositoryForPlugin($plugin_name, $repository); 
     199         
     200        $install_method = $this->guessBestInstallMethod($options); 
     201  
     202        if($install_method != 'local directory'){ 
     203            $repository = $this->getRepositoryForPlugin($plugin_name, $repository); 
     204        } 
    200205 
    201206        if(!$options['force'] && is_dir(AK_PLUGINS_DIR.DS.$plugin_name)){ 
    202207            trigger_error(Ak::t('Destination directory is not empty. Use force option to overwrite exiting files.'), E_USER_NOTICE); 
    203208        }else{ 
    204             $method = '_installUsing'.ucfirst($this->guessBestInstallMethod($options)); 
     209            $method = '_installUsing'.AkInflector::camelize($install_method); 
    205210            $this->$method($plugin_name, rtrim($repository, '/'), $options['revision'], $options['force']); 
    206211            $this->_runInstaller($plugin_name, 'install', $options); 
     
    211216    function guessBestInstallMethod($options = array()) 
    212217    { 
    213         if($this->canUseSvn()){ 
     218        if(isset($options['parameters']) && is_dir($options['parameters'])){ 
     219            return 'local directory'; 
     220        }elseif($this->canUseSvn()){ 
    214221            if(!empty($options['externals']) && $this->_shouldUseSvnExternals()){ 
    215222                return 'externals'; 
     
    250257        $plugin_name = Ak::sanitize_include($plugin_name, 'high'); 
    251258 
    252         $method = '_updateUsing'.ucfirst($this->guessBestInstallMethod($options)); 
     259        $method = '_updateUsing'.AkInflector::camelize($this->guessBestInstallMethod($options)); 
    253260        $this->$method($plugin_name, rtrim($this->getRepositoryForPlugin($plugin_name, $repository), '/')); 
    254261 
     
    538545        `svn update $plugin_dir`; 
    539546    } 
     547     
     548    function _installUsingLocalDirectory($name, $path, $rev = null) 
     549    { 
     550        $source = $path.DS.$name; 
     551        $plugin_dir = AK_PLUGINS_DIR; 
     552        $command = AK_OS == 'UNIX' ? 'cp -rf ' : 'xcopy /h /r /k /x /y /S /E '; 
     553        `$command $source $plugin_dir`; 
     554    } 
     555 
     556    function _updateUsingLocalDirectory($name) 
     557    { 
     558        trigger_error(Ak::t('Updating from local targets it\'s not supported yet. Please use install --force instead.')); 
     559    } 
    540560 
    541561    function _installUsingExport($name, $uri, $rev = null, $force = false) 
  • branches/arnoschn/cache/lib/utils/generators/scaffold/sintags_templates/controller.php

    r647 r904  
    1111    function index() 
    1212    { 
    13         $this->performAction('listing'); 
     13        $this->redirectToAction('listing'); 
    1414    } 
    1515 
  • branches/arnoschn/cache/lib/utils/generators/scaffold/templates/controller.php

    r647 r904  
    1111    function index() 
    1212    { 
    13         $this->performAction('listing'); 
     13        $this->redirectToAction('listing'); 
    1414    } 
    1515 
  • branches/arnoschn/cache/lib/utils/scripts/plugin.php

    r494 r904  
    329329            $repository = preg_replace('/\/?'.$plugin_name.'$/', '', trim($plugin)); 
    330330        } 
    331         if (!@$PluginManager->getRepositoryForPlugin($plugin_name, $repository)){ 
    332             is_null($repository) ? $repository = AK_PLUGINS_MAIN_REPOSITORY : null; 
    333             echo "\nPlugin $plugin_name not found @ ".$repository.".\n"; 
    334             continue; 
     331        if(!is_dir($plugin)){ 
     332            if (!@$PluginManager->getRepositoryForPlugin($plugin_name, $repository)){ 
     333                is_null($repository) ? $repository = AK_PLUGINS_MAIN_REPOSITORY : null; 
     334                echo "\nPlugin $plugin_name not found @ ".$repository.".\n"; 
     335                continue; 
     336            } 
    335337        } 
    336338        echo "\nInstalling $plugin\n"; 
  • branches/arnoschn/cache/test/unit/lib/AkActiveRecord/AkValidation.php

    r468 r904  
    671671        $Person->validatesNumericalityOf('age'); 
    672672        $this->assertFalse($Person->hasErrors()); 
     673         
     674        $Person->clearErrors(); 
     675        $Person->age = '18'; 
     676        $Person->validatesNumericalityOf('age','not_valid',true); 
     677        $this->assertFalse($Person->hasErrors()); 
    673678 
    674679        $Person->clearErrors(); 
     
    676681        $Person->validatesNumericalityOf('age', 'not_valid',false, true); 
    677682        $this->assertFalse($Person->hasErrors()); 
     683         
     684        $Person->clearErrors(); 
     685        $Person->age = null; 
     686        $Person->validatesNumericalityOf('age', 'not_valid',false, false); 
     687        $this->assertTrue($Person->hasErrors()); 
    678688 
    679689    }