CPasswordHelper
, which provides a reliable method for storing and verifying password hashes. Also added CRedisCache
,
CPasswordHelper
CPasswordHelper
provides a reliable method for storing and verifying password hashes. Using it is very simple:
// , . $password $hash = CPasswordHelper::hashPassword($password); // $hash — , , $password if (CPasswordHelper::verifyPassword($password, $hash) // else //
CDbCommandBuilder::createMultipleInsertCommand()
CDbCommandBuilder::createMultipleInsertCommand()
it became possible to insert several records in one request:
$builder=Yii::app()->db->schema->commandBuilder; $command=$builder->createMultipleInsertCommand('tbl_post', array( array('title' => 'record 1', 'text' => 'text1'), array('title' => 'record 2', 'text' => 'text2'), )); $command->execute();
CRedisCache
array( // ... 'components'=>array( 'cache'=>array( 'class'=>'CRedisCache', 'hostname'=>'localhost', 'port'=>6379, 'database'=>0, ), ), )
composer.json
.
"yiisoft/yii": "dev-master"
// ... 'components'=>array( 'user'=>array( // ... 'absoluteAuthTimeout' => 60*60*24; ), ), )
CHttpRequest::sendFile
Yii now correctly responds to RANGE requests, that is, the end user
through
with BELONGS_TO
CActiveRecord::BELONGS_TO
. More about this
CLogFilter::$logVars
now accepts an array of arrays in which you can specify what to log from $GLOBALS
:
'components'=>array( 'log'=>array( 'class'=>'CLogRouter', 'routes'=>array( array( 'class'=>'system.logging.CWebLogRoute', 'filter'=>array( 'class'=>'system.logging.CLogFilter', 'logVars'=>array( '_COOKIE', // , < 1.1.14 array('_SERVER','REMOTE_ADDR'), // , >= 1.1.14 array('_SERVER','HTTP_USER_AGENT'), // , >= 1.1.14 ), ), ), ), ), ),
$_COOKIE=array ( '__utma' => '111872281.473431406.1366046648.1366046648.1366046648.1', '__utmz' => '111872281.1366046648.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)', 'cartVisible' => '1', '96ab4aec0c2977c9b793d4ba009eb3ce' => '...', 'PHPSESSID' => 'vb8pk7obs3q2lc7bl8ield7si7', ) $_SERVER.REMOTE_ADDR='::1' $_SERVER.HTTP_USER_AGENT='Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0'
CLocalizedFormatter
CLocalizedFormatter
class allows CLocalizedFormatter
to format values ​​according to the current locale:
'components'=>array( 'format'=>array( 'class'=>'system.utils.CLocalizedFormatter', 'locale'=>'en_US', ), 'germanFormat'=>array( 'class'=>'system.utils.CLocalizedFormatter', 'locale'=>'de_DE', ), 'russianFormat'=>array( 'class'=>'system.utils.CLocalizedFormatter', 'locale'=>'ru_RU', ), ),
echo Yii::app()->format->formatDatetime(time()) . "\n"; echo Yii::app()->germanFormat->formatDatetime(time()) . "\n"; echo Yii::app()->russianFormat->formatDatetime(time()) . "\n"; // Jul 7, 2013 9:34:56 PM // 07.07.2013 21:34:56 // 07.07.2013, 21:34:56
CREATE TABLE `tbl_user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `first_name` varchar(100) NOT NULL COMMENT ':', `last_name` varchar(100) NOT NULL COMMENT 'Nachname:', `title` varchar(50) NOT NULL COMMENT 'Title (eg Mr., Mrs., etc.):', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1;
attributeLabels
method will be as follows (if you select “Use Column Comments as Attribute Labels” in Gii):
/** * @return array customized attribute labels (name=>label) */ public function attributeLabels() { return array( 'id' => 'ID', 'first_name' => ':', 'last_name' => 'Nachname:', 'title' => 'Title (eg Mr., Mrs., etc.):', ); }
CSecurityManager
CSecurityManager
:
CSecurityManager::generateSessionRandomBlock()
: generates a random byte sequence based on the current session
CSecurityManager::generatePseudoRandomBlock()
: an improved alternative to mt_rand()
.
CSecurityManager::generateRandomBytes()
: generates random binary data. Crypt resistance is set second
CSecurityManager::generateRandomString()
: generates a random string. Crypto resistance is given by the second argument.
Source: https://habr.com/ru/post/186596/