Skip to content

Commit 4b64202

Browse files
author
Igor Chepurnoy
committed
add key-value storage component
1 parent 4d7f6ad commit 4b64202

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ DIRECTORY STRUCTURE
3434
- Content management components: cms, comments
3535
- Yii2 component for logging cron jobs
3636
- Account page
37+
- Key-value storage component
3738

3839

3940
REQUIREMENTS

config/main.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,19 @@
1414
'rbac' => [
1515
'class' => 'yii2mod\rbac\Module',
1616
],
17+
'settings-storage' => [
18+
'class' => 'yii2mod\settings\Module',
19+
],
1720
]
1821
],
1922
'comment' => [
2023
'class' => 'yii2mod\comments\Module'
2124
]
2225
],
2326
'components' => [
27+
'settings' => [
28+
'class' => 'yii2mod\settings\components\Settings',
29+
],
2430
'request' => [
2531
'cookieValidationKey' => 'fYPq2eLM',
2632
],

migrations/m130524_201442_init.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
use yii\db\Schema;
34
use yii\db\Migration;
45

@@ -83,6 +84,18 @@ public function up()
8384
'updatedAt' => time(),
8485
]);
8586

87+
$this->createTable('{{%Setting}}', [
88+
'id' => Schema::TYPE_PK,
89+
'type' => Schema::TYPE_STRING . '(10) NOT NULL',
90+
'section' => Schema::TYPE_STRING . ' NOT NULL',
91+
'key' => Schema::TYPE_STRING . ' NOT NULL',
92+
'value' => Schema::TYPE_STRING . ' NOT NULL',
93+
'status' => Schema::TYPE_SMALLINT . ' NOT NULL',
94+
'createdAt' => Schema::TYPE_INTEGER . ' NOT NULL',
95+
'updatedAt' => Schema::TYPE_INTEGER . ' NOT NULL',
96+
], $tableOptions
97+
);
98+
8699
$this->insert('{{%Cms}}', [
87100
'url' => 'terms-and-conditions',
88101
'title' => 'Terms & Conditions',
@@ -289,6 +302,7 @@ public function down()
289302
$this->dropTable('{{%AuthRule}}');
290303
//Drop cron table
291304
$this->dropTable('{{%CronSchedule}}');
305+
$this->dropTable('{{%Setting}}');
292306
$this->execute('SET FOREIGN_KEY_CHECKS=1;');
293307
}
294308
}

modules/admin/views/layouts/column2.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@
7373
'label' => '<i class="glyphicon glyphicon-user"></i> RBAC',
7474
'url' => ['/admin/rbac'],
7575
],
76+
[
77+
'label' => '<i class="glyphicon glyphicon-wrench"></i> Settings Storage',
78+
'url' => ['/admin/settings-storage'],
79+
],
7680
[
7781
'label' => '<i class="glyphicon glyphicon-repeat"></i> Clear Cache',
7882
'url' => ['/admin/settings/clear-cache'],

0 commit comments

Comments
 (0)