Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Dev Updated Yii to 1.1.23
  • Loading branch information
c-schmitz committed Apr 23, 2021
1 parent 10f4f6b commit 609e661
Show file tree
Hide file tree
Showing 42 changed files with 13,578 additions and 13,176 deletions.
1,822 changes: 911 additions & 911 deletions framework/YiiBase.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion framework/base/CComponent.php
Expand Up @@ -621,7 +621,7 @@ public function evaluateExpression($_expression_,$_data_=array())
else
{
$_data_[]=$this;
return call_user_func_array($_expression_, $_data_);
return call_user_func_array($_expression_, array_values($_data_));
}
}
}
Expand Down
43 changes: 31 additions & 12 deletions framework/caching/CMemCache.php
Expand Up @@ -165,15 +165,12 @@ protected function getValues($keys)
*
* @param string $key the key identifying the value to be cached
* @param string $value the value to be cached
* @param integer $expire the number of seconds in which the cached value will expire. 0 means never expire.
* @param integer $duration the number of seconds in which the cached value will expire. 0 means never expire.
* @return boolean true if the value is successfully stored into cache, false otherwise
*/
protected function setValue($key,$value,$expire)
protected function setValue($key,$value,$duration)
{
if($expire>0)
$expire+=time();
else
$expire=0;
$expire = $this->normalizeDuration($duration);

return $this->useMemcached ? $this->_cache->set($key,$value,$expire) : $this->_cache->set($key,$value,0,$expire);
}
Expand All @@ -184,19 +181,41 @@ protected function setValue($key,$value,$expire)
*
* @param string $key the key identifying the value to be cached
* @param string $value the value to be cached
* @param integer $expire the number of seconds in which the cached value will expire. 0 means never expire.
* @param integer $duration the number of seconds in which the cached value will expire. 0 means never expire.
* @return boolean true if the value is successfully stored into cache, false otherwise
*/
protected function addValue($key,$value,$expire)
protected function addValue($key,$value,$duration)
{
if($expire>0)
$expire+=time();
else
$expire=0;
$expire = $this->normalizeDuration($duration);

return $this->useMemcached ? $this->_cache->add($key,$value,$expire) : $this->_cache->add($key,$value,0,$expire);
}

/**
* Normalizes duration value.
* Ported code from yii2 after identifying issue with memcache falsely handling short term duration based on unix timestamps
*
* @see https://github.com/yiisoft/yii2/issues/17710
* @see https://secure.php.net/manual/en/memcache.set.php
* @see https://secure.php.net/manual/en/memcached.expiration.php
* @see https://github.com/php-memcached-dev/php-memcached/issues/368#issuecomment-359137077
*
* @param int $duration
* @return int
*/
protected function normalizeDuration($duration)
{
if ($duration < 0) {
return 0;
}

if ($duration < 2592001) {
return $duration;
}

return $duration + time();
}

/**
* Deletes a value with the specified key from cache
* This is the implementation of the method declared in the parent class.
Expand Down
8 changes: 7 additions & 1 deletion framework/console/CConsoleCommand.php
Expand Up @@ -129,7 +129,13 @@ public function run($args)
$name=$param->getName();
if(isset($options[$name]))
{
if($param->isArray())
if(version_compare(PHP_VERSION,'8.0','>=')) {
$isArray=$param->getType() && $param->getType()->getName()==='array';
} else {
$isArray = $param->isArray();
}

if($isArray)
$params[]=is_array($options[$name]) ? $options[$name] : array($options[$name]);
elseif(!is_array($options[$name]))
$params[]=$options[$name];
Expand Down
20 changes: 13 additions & 7 deletions framework/db/schema/pgsql/CPgsqlSchema.php
Expand Up @@ -166,7 +166,12 @@ protected function resolveTableNames($table,$name)
protected function findColumns($table)
{
$sql=<<<EOD
SELECT a.attname, LOWER(format_type(a.atttypid, a.atttypmod)) AS type, pg_get_expr(d.adbin,d.adrelid) as adsrc, a.attnotnull, a.atthasdef,
SELECT
a.attname,
LOWER(format_type(a.atttypid, a.atttypmod)) AS type,
pg_get_expr(adbin, adrelid) AS adsrc,
a.attnotnull,
a.atthasdef,
pg_catalog.col_description(a.attrelid, a.attnum) AS comment
FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attnum > 0 AND NOT a.attisdropped
Expand Down Expand Up @@ -225,14 +230,15 @@ protected function createColumn($column)
protected function findConstraints($table)
{
$sql=<<<EOD
SELECT conname, consrc, contype, indkey FROM (
SELECT
conname,
consrc,
contype,
indkey
FROM (
SELECT
conname,
CASE WHEN contype='f' THEN
pg_catalog.pg_get_constraintdef(oid)
ELSE
'CHECK (' || pg_get_expr(conbin, conrelid) || ')'
END AS consrc,
pg_catalog.pg_get_constraintdef(oid) AS consrc,
contype,
conrelid AS relid,
NULL AS indkey
Expand Down

0 comments on commit 609e661

Please sign in to comment.