first commit

This commit is contained in:
2023-05-06 20:40:02 +03:00
commit fdf3e1e602
221 changed files with 12262 additions and 0 deletions

3
console/config/.gitignore vendored Executable file
View File

@ -0,0 +1,3 @@
main-local.php
params-local.php
test-local.php

1
console/config/bootstrap.php Executable file
View File

@ -0,0 +1 @@
<?php

36
console/config/main.php Executable file
View File

@ -0,0 +1,36 @@
<?php
$params = array_merge(
require __DIR__ . '/../../common/config/params.php',
require __DIR__ . '/../../common/config/params-local.php',
require __DIR__ . '/params.php',
require __DIR__ . '/params-local.php'
);
return [
'id' => 'app-console',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'controllerNamespace' => 'console\controllers',
'aliases' => [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
],
'controllerMap' => [
'fixture' => [
'class' => \yii\console\controllers\FixtureController::class,
'namespace' => 'common\fixtures',
],
],
'components' => [
'log' => [
'targets' => [
[
'class' => \yii\log\FileTarget::class,
'levels' => ['error', 'warning'],
],
],
],
],
'params' => $params,
];

5
console/config/params.php Executable file
View File

@ -0,0 +1,5 @@
<?php
return [
'adminEmail' => 'admin@example.com',
];

4
console/config/test.php Executable file
View File

@ -0,0 +1,4 @@
<?php
return [
];

0
console/controllers/.gitkeep Executable file
View File

View File

@ -0,0 +1,33 @@
<?php
use yii\db\Migration;
class m130524_201442_init extends Migration
{
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('{{%user}}', [
'id' => $this->primaryKey(),
'username' => $this->string()->notNull()->unique(),
'auth_key' => $this->string(32)->notNull(),
'password_hash' => $this->string()->notNull(),
'password_reset_token' => $this->string()->unique(),
'email' => $this->string()->notNull()->unique(),
'status' => $this->smallInteger()->notNull()->defaultValue(10),
'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(),
], $tableOptions);
}
public function down()
{
$this->dropTable('{{%user}}');
}
}

View File

@ -0,0 +1,16 @@
<?php
use \yii\db\Migration;
class m190124_110200_add_verification_token_column_to_user_table extends Migration
{
public function up()
{
$this->addColumn('{{%user}}', 'verification_token', $this->string()->defaultValue(null));
}
public function down()
{
$this->dropColumn('{{%user}}', 'verification_token');
}
}

View File

@ -0,0 +1,30 @@
<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%news}}`.
*/
class m230503_111312_create_news_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%news}}', [
'id' => $this->primaryKey(),
'title' => $this->string(),
'text' => $this->text(),
'slug' => $this->string()->unique()
]);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropTable('{{%news}}');
}
}

View File

@ -0,0 +1,33 @@
<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%profile}}`.
*/
class m230503_151339_create_profile_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%profile}}', [
'id' => $this->primaryKey(),
'user_id' => $this->integer(),
'created_at' => $this->timestamp(),
'image' => $this->string(),
'activity' => $this->tinyInteger()
]);
$this->addForeignKey('user_foreign', 'profile', 'user_id', 'user', 'id');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropForeignKey('user_foreign', 'profile');
$this->dropTable('{{%profile}}');
}
}

View File

@ -0,0 +1,33 @@
<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%text}}`.
*/
class m230503_151354_create_text_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%text}}', [
'id' => $this->primaryKey(),
'profile_id' => $this->integer(),
'title' => $this->string(),
'text' => $this->text(),
'language' => $this->string()
]);
$this->addForeignKey('profile_foreign', 'text', 'profile_id', 'profile', 'id');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropForeignKey('profile_foreign', 'text');
$this->dropTable('{{%text}}');
}
}

1
console/models/.gitkeep Executable file
View File

@ -0,0 +1 @@
*

2
console/runtime/.gitignore vendored Executable file
View File

@ -0,0 +1,2 @@
*
!.gitignore