Added activity mail migrations, moved last_activity_mail column to settings

This commit is contained in:
Lucas Bartholemy 2017-01-12 16:28:27 +01:00
parent 604ad336ec
commit a507a470a1
4 changed files with 37 additions and 9 deletions

View File

@ -0,0 +1,37 @@
<?php
use yii\db\Migration;
class m170112_115052_settings extends Migration
{
public function up()
{
/**
* Update old interval setting key names
*/
$this->update('setting', ['name' => 'mailSummaryInterval'], ['name' => 'receive_email_activities', 'module_id' => 'activity']);
$this->update('contentcontainer_setting', ['name' => 'mailSummaryInterval'], ['name' => 'receive_email_activities', 'module_id' => 'activity']);
// This is now stored in settings
$this->dropColumn('user', 'last_activity_email');
}
public function down()
{
echo "m170112_115052_settings cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -42,7 +42,6 @@ class InstallController extends Controller
$user->email = 'humhub@example.com';
$user->status = User::STATUS_ENABLED;
$user->language = '';
$user->last_activity_email = new \yii\db\Expression('NOW()');
if (!$user->save()) {
throw new \yii\base\Exception("Could not save user");
}

View File

@ -248,7 +248,6 @@ class ConfigController extends Controller
$userModel->email = "david.roberts@example.com";
$userModel->language = '';
$userModel->tags = "Microsoft Office, Marketing, SEM, Digital Native";
$userModel->last_activity_email = new \yii\db\Expression('NOW()');
$userModel->save();
$profileImage = new \humhub\libs\ProfileImage($userModel->guid);
@ -275,7 +274,6 @@ class ConfigController extends Controller
$userModel2->email = "sara.schuster@example.com";
$userModel2->language = '';
$userModel2->tags = "Yoga, Travel, English, German, French";
$userModel2->last_activity_email = new \yii\db\Expression('NOW()');
$userModel2->save();
$profileImage2 = new \humhub\libs\ProfileImage($userModel2->guid);
@ -426,7 +424,6 @@ class ConfigController extends Controller
$form->models['User']->status = User::STATUS_ENABLED;
$form->models['User']->language = '';
$form->models['User']->tags = 'Administration, Support, HumHub';
$form->models['User']->last_activity_email = new \yii\db\Expression('NOW()');
$form->models['User']->save();
$form->models['Profile']->user_id = $form->models['User']->id;

View File

@ -27,7 +27,6 @@ use humhub\modules\space\models\Space;
* @property string $tags
* @property string $language
* @property string $time_zone
* @property string $last_activity_email
* @property string $created_at
* @property integer $created_by
* @property string $updated_at
@ -97,7 +96,6 @@ class User extends ContentContainerActiveRecord implements \yii\web\IdentityInte
[['status', 'created_by', 'updated_by', 'visibility'], 'integer'],
[['status', 'visibility'], 'integer'],
[['tags'], 'string'],
[['last_activity_email', 'last_login'], 'safe'],
[['guid'], 'string', 'max' => 45],
[['username'], 'string', 'max' => 50, 'min' => Yii::$app->params['user']['minUsernameLength']],
[['time_zone'], 'in', 'range' => \DateTimeZone::listIdentifiers()],
@ -179,7 +177,6 @@ class User extends ContentContainerActiveRecord implements \yii\web\IdentityInte
'auth_mode' => Yii::t('UserModule.models_User', 'Auth Mode'),
'tags' => Yii::t('UserModule.models_User', 'Tags'),
'language' => Yii::t('UserModule.models_User', 'Language'),
'last_activity_email' => Yii::t('UserModule.models_User', 'Last Activity Email'),
'created_at' => Yii::t('UserModule.models_User', 'Created at'),
'created_by' => Yii::t('UserModule.models_User', 'Created by'),
'updated_at' => Yii::t('UserModule.models_User', 'Updated at'),
@ -369,8 +366,6 @@ class User extends ContentContainerActiveRecord implements \yii\web\IdentityInte
}
}
$this->last_activity_email = new \yii\db\Expression('NOW()');
if ($this->status == "") {
$this->status = self::STATUS_ENABLED;
}