mirror of
https://github.com/humhub/humhub.git
synced 2025-02-22 10:14:19 +01:00
Merge pull request #4443 from humhub/fix/4428
Replace db Expression time now with func date()
This commit is contained in:
commit
72b9a6b79f
@ -37,3 +37,4 @@ HumHub Changelog
|
||||
- Fix #3566: Bug in models/filetype/CheckboxList.php
|
||||
- Enh #4401: Allow to use less variable name in value of another less variable
|
||||
- Fix #4434: Fix title quoting for space icons in widget “Member in these spaces”
|
||||
- Fix #4428: Replace db Expression time now with func date('Y-m-d G:i:s')
|
||||
|
@ -36,7 +36,7 @@ class ActiveRecord extends \yii\db\ActiveRecord implements \Serializable
|
||||
{
|
||||
if ($insert) {
|
||||
if ($this->hasAttribute('created_at') && $this->created_at == "") {
|
||||
$this->created_at = new \yii\db\Expression('NOW()');
|
||||
$this->created_at = date('Y-m-d G:i:s');
|
||||
}
|
||||
|
||||
if (isset(Yii::$app->user) && $this->hasAttribute('created_by') && $this->created_by == "") {
|
||||
@ -45,7 +45,7 @@ class ActiveRecord extends \yii\db\ActiveRecord implements \Serializable
|
||||
}
|
||||
|
||||
if ($this->hasAttribute('updated_at')) {
|
||||
$this->updated_at = new \yii\db\Expression('NOW()');
|
||||
$this->updated_at = date('Y-m-d G:i:s');
|
||||
}
|
||||
if (isset(Yii::$app->user) && $this->hasAttribute('updated_by')) {
|
||||
$this->updated_by = Yii::$app->user->id;
|
||||
|
@ -206,7 +206,7 @@ class Content extends ActiveRecord implements Movable, ContentOwner
|
||||
}
|
||||
}
|
||||
|
||||
$this->stream_sort_date = new \yii\db\Expression('NOW()');
|
||||
$this->stream_sort_date = date('Y-m-d G:i:s');
|
||||
|
||||
if ($this->created_by == "") {
|
||||
throw new Exception("Could not save content without created_by!");
|
||||
@ -853,7 +853,7 @@ class Content extends ActiveRecord implements Movable, ContentOwner
|
||||
*/
|
||||
public function updateStreamSortTime()
|
||||
{
|
||||
$this->updateAttributes(['stream_sort_date' => new \yii\db\Expression('NOW()')]);
|
||||
$this->updateAttributes(['stream_sort_date' => date('Y-m-d G:i:s')]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -146,7 +146,7 @@ class Membership extends ActiveRecord
|
||||
*/
|
||||
public function updateLastVisit()
|
||||
{
|
||||
$this->last_visit = new \yii\db\Expression('NOW()');
|
||||
$this->last_visit = date('Y-m-d G:i:s');
|
||||
$this->update(false, ['last_visit']);
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ class RegistrationController extends Controller
|
||||
// Autologin when user is enabled (no approval required)
|
||||
if ($registration->getUser()->status === User::STATUS_ENABLED) {
|
||||
Yii::$app->user->switchIdentity($registration->models['User']);
|
||||
$registration->models['User']->updateAttributes(['last_login' => new \yii\db\Expression('NOW()')]);
|
||||
$registration->models['User']->updateAttributes(['last_login' => date('Y-m-d G:i:s')]);
|
||||
if (Yii::$app->request->getIsAjax()) {
|
||||
return $this->htmlRedirect(Yii::$app->user->returnUrl);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class m140303_125031_password extends Migration
|
||||
->all();
|
||||
foreach ($rows as $row) {
|
||||
$password = str_replace('___enc___', '', $row['password']);
|
||||
$this->update('user_password', ['user_id' => $row['id'], 'password' => $password, 'algorithm' => $algorithm, 'salt' => Yii::$app->settings->get('secret'), 'created_at' => new \yii\db\Expression('NOW()')]);
|
||||
$this->update('user_password', ['user_id' => $row['id'], 'password' => $password, 'algorithm' => $algorithm, 'salt' => Yii::$app->settings->get('secret'), 'created_at' => date('Y-m-d G:i:s')]);
|
||||
}
|
||||
$this->dropColumn('user', 'password');
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ class Group extends ActiveRecord
|
||||
$newGroupUser = new GroupUser();
|
||||
$newGroupUser->user_id = $userId;
|
||||
$newGroupUser->group_id = $this->id;
|
||||
$newGroupUser->created_at = new \yii\db\Expression('NOW()');
|
||||
$newGroupUser->created_at = date('Y-m-d G:i:s');
|
||||
$newGroupUser->created_by = Yii::$app->user->id;
|
||||
$newGroupUser->is_group_manager = $isManager;
|
||||
if ($newGroupUser->save() && !Yii::$app->user->isGuest) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user