Changeset 904
- Timestamp:
- 07/20/08 14:38:59 (3 months ago)
- Files:
-
- branches/arnoschn/cache/lib/Ak.php (modified) (1 diff)
- branches/arnoschn/cache/lib/AkActiveRecord.php (modified) (2 diffs)
- branches/arnoschn/cache/lib/AkCache.php (modified) (1 diff)
- branches/arnoschn/cache/lib/AkPlugin/AkPluginManager.php (modified) (4 diffs)
- branches/arnoschn/cache/lib/utils/generators/scaffold/sintags_templates/controller.php (modified) (1 diff)
- branches/arnoschn/cache/lib/utils/generators/scaffold/templates/controller.php (modified) (1 diff)
- branches/arnoschn/cache/lib/utils/scripts/plugin.php (modified) (1 diff)
- branches/arnoschn/cache/test/unit/lib/AkActiveRecord/AkValidation.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/arnoschn/cache/lib/Ak.php
r901 r904 1130 1130 foreach ($array as $key => $value) { 1131 1131 $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; 1133 1133 $_tags[$key] = $key; 1134 1134 $xml .= sprintf("<%s>%s</%s>\r\n", $key, $value, $key); branches/arnoschn/cache/lib/AkActiveRecord.php
r856 r904 1347 1347 function constructFinderSql($options, $select_from_prefix = 'default') 1348 1348 { 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'] : ''; 1351 1351 1352 1352 $this->addConditions($sql, isset($options['conditions']) ? $options['conditions'] : array()); … … 3993 3993 $attribute_names = Ak::toArray($attribute_names); 3994 3994 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){ 4013 4008 $this->addError($attribute_name, $message); 4014 4009 } branches/arnoschn/cache/lib/AkCache.php
r899 r904 252 252 $this->_driverInstance =& new Cache_Lite($options); 253 253 break; 254 case 2: $this->cache_enabled = true;254 case 2: 255 255 require_once(AK_LIB_DIR.'/AkCache/AkAdodbCache.php'); 256 256 $this->_driverInstance =& new AkAdodbCache(); branches/arnoschn/cache/lib/AkPlugin/AkPluginManager.php
r522 r904 197 197 198 198 $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 } 200 205 201 206 if(!$options['force'] && is_dir(AK_PLUGINS_DIR.DS.$plugin_name)){ 202 207 trigger_error(Ak::t('Destination directory is not empty. Use force option to overwrite exiting files.'), E_USER_NOTICE); 203 208 }else{ 204 $method = '_installUsing'. ucfirst($this->guessBestInstallMethod($options));209 $method = '_installUsing'.AkInflector::camelize($install_method); 205 210 $this->$method($plugin_name, rtrim($repository, '/'), $options['revision'], $options['force']); 206 211 $this->_runInstaller($plugin_name, 'install', $options); … … 211 216 function guessBestInstallMethod($options = array()) 212 217 { 213 if($this->canUseSvn()){ 218 if(isset($options['parameters']) && is_dir($options['parameters'])){ 219 return 'local directory'; 220 }elseif($this->canUseSvn()){ 214 221 if(!empty($options['externals']) && $this->_shouldUseSvnExternals()){ 215 222 return 'externals'; … … 250 257 $plugin_name = Ak::sanitize_include($plugin_name, 'high'); 251 258 252 $method = '_updateUsing'. ucfirst($this->guessBestInstallMethod($options));259 $method = '_updateUsing'.AkInflector::camelize($this->guessBestInstallMethod($options)); 253 260 $this->$method($plugin_name, rtrim($this->getRepositoryForPlugin($plugin_name, $repository), '/')); 254 261 … … 538 545 `svn update $plugin_dir`; 539 546 } 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 } 540 560 541 561 function _installUsingExport($name, $uri, $rev = null, $force = false) branches/arnoschn/cache/lib/utils/generators/scaffold/sintags_templates/controller.php
r647 r904 11 11 function index() 12 12 { 13 $this-> performAction('listing');13 $this->redirectToAction('listing'); 14 14 } 15 15 branches/arnoschn/cache/lib/utils/generators/scaffold/templates/controller.php
r647 r904 11 11 function index() 12 12 { 13 $this-> performAction('listing');13 $this->redirectToAction('listing'); 14 14 } 15 15 branches/arnoschn/cache/lib/utils/scripts/plugin.php
r494 r904 329 329 $repository = preg_replace('/\/?'.$plugin_name.'$/', '', trim($plugin)); 330 330 } 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 } 335 337 } 336 338 echo "\nInstalling $plugin\n"; branches/arnoschn/cache/test/unit/lib/AkActiveRecord/AkValidation.php
r468 r904 671 671 $Person->validatesNumericalityOf('age'); 672 672 $this->assertFalse($Person->hasErrors()); 673 674 $Person->clearErrors(); 675 $Person->age = '18'; 676 $Person->validatesNumericalityOf('age','not_valid',true); 677 $this->assertFalse($Person->hasErrors()); 673 678 674 679 $Person->clearErrors(); … … 676 681 $Person->validatesNumericalityOf('age', 'not_valid',false, true); 677 682 $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()); 678 688 679 689 }
