Permalink
Browse files

prepare for 1.1.12 release.

  • Loading branch information...
qiangxue committed Aug 19, 2012
1 parent ad47786 commit b600af63136a8913b192cbe651186f02632c0267
Showing with 51 additions and 32 deletions.
  1. +2 −2 CHANGELOG
  2. +6 −3 UPGRADE
  3. +1 −1 framework/YiiBase.php
  4. +42 −26 framework/yiilite.php
View
@@ -1,8 +1,8 @@
Yii Framework Change Log
========================
-Version 1.1.12 work in progress
--------------------------------
+Version 1.1.12 August 19, 2012
+------------------------------
- Bug #190: WSDL return tag was not generated by CWsdlGenerator when Macintosh line endings were used inside service describing docblock (resurtm)
- Bug #1066: CMemCache: expiration time higher than 60*60*24*30 (31536000) seconds led the value to expire right away after saving (resurtm)
- Bug #1072: Fixed the problem with getTableAlias() in defaultScope() (creocoder)
View
@@ -1,5 +1,5 @@
- Upgrading Instructions for Yii Framework v1.1.12
+ Upgrading Instructions for Yii Framework v1.1.13
================================================
!!!IMPORTANT!!!
@@ -9,15 +9,18 @@ if you want to upgrade from version A to version C and there is
version B between A and C, you need to following the instructions
for both A and B.
-General upgrade intructions
----------------------------
+General upgrade instructions
+----------------------------
- Make a backup.
- Clean up your 'assets' folder.
- Replace 'framework' dir with the new one or point GIT to a fresh
release and update.
- Check if everything is OK, if not — revert from backup and post
issues to Yii issue tracker.
+Upgrading from v1.1.12
+----------------------
+
Upgrading from v1.1.11
----------------------
- Changes in CCookieCollection::add() (introduced in 1.1.11) were reverted as they were triggering E_STRICT on some old PHP-versions
View
@@ -82,7 +82,7 @@ class YiiBase
*/
public static function getVersion()
{
- return '1.1.12-dev';
+ return '1.1.12';
}
/**
View
@@ -40,7 +40,7 @@ class YiiBase
private static $_logger;
public static function getVersion()
{
- return '1.1.11';
+ return '1.1.12';
}
public static function createWebApplication($config=null)
{
@@ -837,7 +837,7 @@ public function raiseEvent($name,$event)
}
public function evaluateExpression($_expression_,$_data_=array())
{
- if(is_string($_expression_) && !function_exists($_expression_))
+ if(is_string($_expression_))
{
extract($_data_);
return eval('return '.$_expression_.';');
@@ -2683,24 +2683,14 @@ protected function getCookies()
}
return $cookies;
}
- public function add($name,$cookie=null)
+ public function add($name,$cookie)
{
- if($name instanceof CHttpCookie)
+ if($cookie instanceof CHttpCookie)
{
- $cookieName=$name->name;
- $cookieObject=$name;
- }
- else
- {
- $cookieName=(string)$name;
- $cookieObject=$cookie;
- }
- if($cookieObject instanceof CHttpCookie)
- {
- $this->remove($cookieName);
- parent::add($cookieName,$cookieObject);
+ $this->remove($name);
+ parent::add($name,$cookie);
if($this->_initialized)
- $this->addCookie($cookieObject);
+ $this->addCookie($cookie);
}
else
throw new CException(Yii::t('yii','CHttpCookieCollection can only hold CHttpCookie objects.'));
@@ -2776,7 +2766,7 @@ protected function processRules()
if(isset($cache))
$cache->set(self::CACHE_KEY,array($this->_rules,$hash));
}
- public function addRules($rules, $append=true)
+ public function addRules($rules,$append=true)
{
if ($append)
{
@@ -2785,6 +2775,7 @@ public function addRules($rules, $append=true)
}
else
{
+ $rules=array_reverse($rules);
foreach($rules as $pattern=>$route)
array_unshift($this->_rules, $this->createUrlRule($route,$pattern));
}
@@ -4894,7 +4885,7 @@ public static function ajax($options)
$options['data']=new CJavaScriptExpression('jQuery(this).parents("form").serialize()');
foreach(array('beforeSend','complete','error','success') as $name)
{
- if(isset($options[$name]) && (!($options[$name] instanceof CJavaScriptExpression) || strpos($options[$name],'js:')!==0))
+ if(isset($options[$name]) && !($options[$name] instanceof CJavaScriptExpression))
$options[$name]=new CJavaScriptExpression($options[$name]);
}
if(isset($options['update']))
@@ -5414,8 +5405,8 @@ public static function resolveValue($model,$attribute)
{
if($pos===0) // [a]name[b][c], should ignore [a]
{
- if(preg_match('/\](.*)/',$attribute,$matches))
- $attribute=$matches[1];
+ if(preg_match('/\](\w+(\[.+)?)/',$attribute,$matches))
+ $attribute=$matches[1]; // we get: name[b][c]
if(($pos=strpos($attribute,'['))===false)
return $model->$attribute;
}
@@ -6886,9 +6877,12 @@ public function defaultScope()
{
return array();
}
- public function resetScope()
+ public function resetScope($resetDefault=true)
{
- $this->_c=new CDbCriteria();
+ if($resetDefault)
+ $this->_c=new CDbCriteria();
+ else
+ $this->_c=null;
return $this;
}
public static function model($className=__CLASS__)
@@ -7360,7 +7354,7 @@ public function applyScopes(&$criteria)
{
$c->mergeWith($criteria);
$criteria=$c;
- $this->_c=null;
+ $this->resetScope(false);
}
}
public function getTableAlias($quote=false, $checkScopes=true)
@@ -7414,7 +7408,7 @@ public function findBySql($sql,$params=array())
$this->beforeFind();
if(($criteria=$this->getDbCriteria(false))!==null && !empty($criteria->with))
{
- $this->_c=null;
+ $this->resetScope(false);
$finder=new CActiveFinder($this,$criteria->with);
return $finder->findBySql($sql,$params);
}
@@ -7429,7 +7423,7 @@ public function findAllBySql($sql,$params=array())
$this->beforeFind();
if(($criteria=$this->getDbCriteria(false))!==null && !empty($criteria->with))
{
- $this->_c=null;
+ $this->resetScope(false);
$finder=new CActiveFinder($this,$criteria->with);
return $finder->findAllBySql($sql,$params);
}
@@ -7754,6 +7748,28 @@ public function mergeWith($criteria,$fromScope=false)
}
class CManyManyRelation extends CHasManyRelation
{
+ private $_junctionTableName=null;
+ private $_junctionForeignKeys=null;
+ public function getJunctionTableName()
+ {
+ if ($this->_junctionTableName===null)
+ $this->initJunctionData();
+ return $this->_junctionTableName;
+ }
+ public function getJunctionForeignKeys()
+ {
+ if ($this->_junctionForeignKeys===null)
+ $this->initJunctionData();
+ return $this->_junctionForeignKeys;
+ }
+ private function initJunctionData()
+ {
+ if(!preg_match('/^\s*(.*?)\((.*)\)\s*$/',$this->foreignKey,$matches))
+ throw new CDbException(Yii::t('yii','The relation "{relation}" in active record class "{class}" is specified with an invalid foreign key. The format of the foreign key must be "joinTable(fk1,fk2,...)".',
+ array('{class}'=>$this->className,'{relation}'=>$this->name)));
+ $this->_junctionTableName=$matches[1];
+ $this->_junctionForeignKeys=preg_split('/\s*,\s*/',$matches[2],-1,PREG_SPLIT_NO_EMPTY);
+ }
}
class CActiveRecordMetaData
{

0 comments on commit b600af6

Please sign in to comment.