Changeset 252
- Timestamp:
- 06/07/07 08:15:35 (1 year ago)
- Files:
-
- trunk/config/development.php (modified) (1 diff)
- trunk/config/production.php (modified) (1 diff)
- trunk/config/testing.php (modified) (1 diff)
- trunk/lib/AkActiveRecord.php (modified) (11 diffs)
- trunk/test/fixtures/config/config.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/config/development.php
r251 r252 2 2 3 3 // Define constants that are used only on a development environment 4 // See file available_constants.php for more info4 // See file boot.php for more info 5 5 6 6 define('AK_ENABLE_STRICT_XHTML_VALIDATION', false); // At least until the validator is fully tested trunk/config/production.php
r2 r252 2 2 3 3 // Define constants that are used only on a production environment 4 // See file available_constants.php for more info4 // See file boot.php for more info 5 5 6 /** 7 * Performance tricks for production environments. 8 * 9 * Disable callback getters/setters. If you allways use 10 * AkActiveRecord::get('attribute_name') and AkActiveRecord::set('attribute_name', $value) 11 * instead of AkActiveRecord::getAttributeName and AkActiveRecord::setAttributeName 12 * you might want to disable thath functionality by uncommenting the next two line. 13 */ 14 // ak_define('ACTIVE_RECORD_ENABLE_CALLBACK_SETTERS', false); 15 // ak_define('ACTIVE_RECORD_ENABLE_CALLBACK_GETTERS', false); 16 17 /** 18 * These settings can also help on heavy load sites, but please TEST that these new defaults 19 * don't break you working application. 20 * 21 * DONT CHANGE ANYTHING IF YOU DON'T KNOW WHAT IT MEANS. 22 */ 23 // ak_define('ACTIVE_RECORD_VALIDATE_TABLE_NAMES', false); 24 // ak_define('ACTIVE_RECORD_SKIP_SETTING_ACTIVE_RECORD_DEFAULTS', true); 25 // ak_define('ACTIVE_RECORD_ENABLE_PERSISTENCE', true); 26 // ak_define('ACTIVE_RECORD_CACHE_DATABASE_SCHEMA', true); 27 // ak_define('ACTIVE_RECORD_CACHE_DATABASE_SCHEMA_LIFE', 86400); 6 28 7 29 ?> trunk/config/testing.php
r2 r252 2 2 3 3 // Define constants that are used only on a testing environment 4 // See file available_constants.php for more info4 // See file boot.php for more info 5 5 6 6 trunk/lib/AkActiveRecord.php
r248 r252 20 20 require_once(AK_LIB_DIR.DS.'AkActiveRecord'.DS.'AkAssociatedActiveRecord.php'); 21 21 22 // Use setColumnName if available when using set('column_name', $value); 23 ak_define('ACTIVE_RECORD_ENABLE_CALLBACK_SETTERS', true); 24 ak_define('ACTIVE_RECORD_ENABLE_CALLBACK_GETTERS', true); 22 25 ak_define('ACTIVE_RECORD_ENABLE_PERSISTENCE', AK_ENVIRONMENT != 'testing'); 23 26 ak_define('ACTIVE_RECORD_CACHE_DATABASE_SCHEMA', AK_ACTIVE_RECORD_ENABLE_PERSISTENCE && AK_ENVIRONMENT != 'development'); 27 ak_define('ACTIVE_RECORD_CACHE_DATABASE_SCHEMA_LIFE', 300); 24 28 ak_define('ACTIVE_RECORD_VALIDATE_TABLE_NAMES', true); 25 29 ak_define('ACTIVE_RECORD_SKIP_SETTING_ACTIVE_RECORD_DEFAULTS', false); … … 1560 1564 1561 1565 1562 function setAttribute($attribute, $value, $inspect_for_callback_child_method = true, $compose_after_set = true) 1563 { 1566 function setAttribute($attribute, $value, $inspect_for_callback_child_method = AK_ACTIVE_RECORD_ENABLE_CALLBACK_SETTERS, $compose_after_set = true){ 1564 1567 static $watchdog; 1565 1568 … … 1573 1576 1574 1577 if($inspect_for_callback_child_method === true && method_exists($this,'set'.AkInflector::camelize($attribute))){ 1578 static $watchdog; 1575 1579 $watchdog[$attribute] = @$watchdog[$attribute]+1; 1576 1580 if($watchdog[$attribute] == 5000){ … … 1586 1590 $this->{$attribute.'_before_type_cast'} = $value; 1587 1591 $this->$attribute = $value; 1588 if($compose_after_set && ! $this->requiredForCombination($attribute)){1592 if($compose_after_set && !empty($this->_combinedAttributes) && !$this->requiredForCombination($attribute)){ 1589 1593 $combined_attributes = $this->_getCombinedAttributesWhereThisAttributeIsUsed($attribute); 1590 1594 foreach ($combined_attributes as $combined_attribute){ … … 1622 1626 } 1623 1627 1624 function getAttribute($attribute, $inspect_for_callback_child_method = true) 1625 { 1626 static $watchdog; 1627 1628 function getAttribute($attribute, $inspect_for_callback_child_method = AK_ACTIVE_RECORD_ENABLE_CALLBACK_GETTERS) 1629 { 1628 1630 if($attribute[0] == '_'){ 1629 1631 return false; … … 1631 1633 1632 1634 if($inspect_for_callback_child_method === true && method_exists($this,'get'.AkInflector::camelize($attribute))){ 1635 static $watchdog; 1633 1636 $watchdog[@$attribute] = @$watchdog[$attribute]+1; 1634 1637 if($watchdog[$attribute] == 66){ … … 1643 1646 if(isset($this->$attribute) || (!isset($this->$attribute) && $this->isCombinedAttribute($attribute))){ 1644 1647 if($this->hasAttribute($attribute)){ 1645 if ( $this->isCombinedAttribute($attribute)){1648 if (!empty($this->_combinedAttributes) && $this->isCombinedAttribute($attribute)){ 1646 1649 $this->composeCombinedAttribute($attribute); 1647 1650 } … … 1850 1853 } 1851 1854 } 1852 /* 1853 if(!empty($this->_combinedAttributes)){ 1854 foreach ($this->_combinedAttributes as $attribute=>$rule){ 1855 $pattern = $rule[0]; 1856 $ary = array(); 1857 $ary = array(); 1858 for ($x=1;$x<count($rule);$x++){ 1859 $subattribute = $rule[$x]; 1860 $ary[$subattribute] = $this->getAttribute($subattribute); 1861 } 1862 $this->$attribute = method_exists(&$this, $pattern.'Compose') ? $this->{$pattern.'Compose'}($ary) : vsprintf($pattern, $ary); 1863 } 1864 } 1865 */ 1855 1866 1856 function composeCombinedAttribute($combined_attribute) 1867 1857 { … … 2559 2549 if(AK_ACTIVE_RECORD_CACHE_DATABASE_SCHEMA && AK_CACHE_HANDLER > 0){ 2560 2550 $Cache =& Ak::cache(); 2561 $Cache->init( 300);2551 $Cache->init(AK_ACTIVE_RECORD_CACHE_DATABASE_SCHEMA_LIFE); 2562 2552 $Cache->clean('AkActiveRecord'); 2563 2553 } … … 2568 2558 if(isset($_SESSION['__activeRecordColumnsSettingsCache'])){ 2569 2559 $Cache =& Ak::cache(); 2570 $Cache->init( 300);2560 $Cache->init(AK_ACTIVE_RECORD_CACHE_DATABASE_SCHEMA_LIFE); 2571 2561 $Cache->save(serialize($_SESSION['__activeRecordColumnsSettingsCache']), 'active_record_db_cache', 'AkActiveRecord'); 2572 2562 } … … 2577 2567 if(!isset($_SESSION['__activeRecordColumnsSettingsCache'])){ 2578 2568 $Cache =& Ak::cache(); 2579 $Cache->init( 300);2569 $Cache->init(AK_ACTIVE_RECORD_CACHE_DATABASE_SCHEMA_LIFE); 2580 2570 if($serialized_column_settings = $Cache->get('active_record_db_cache', 'AkActiveRecord') && !empty($serialized_column_settings)){ 2581 2571 $_SESSION['__activeRecordColumnsSettingsCache'] = @unserialize($serialized_column_settings); trunk/test/fixtures/config/config.php
r208 r252 19 19 define('AK_SITE_URL_SUFFIX', str_replace(array(join(DIRECTORY_SEPARATOR,array_diff((array)@explode(DIRECTORY_SEPARATOR,AK_TEST_DIR), 20 20 (array)@explode('/',@$_SERVER['REQUEST_URI']))),DIRECTORY_SEPARATOR),array('','/'),AK_TEST_DIR)); 21 21 22 22 23 //define('AK_SKIP_DB_CONNECTION',isset($db) && $db === false);
