Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update lobi cms #18

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 17 additions & 9 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# ---------
YII_DEBUG = true
YII_ENV = dev
#TODO add demo mode to cms
YII_DEMO_MODE = false

APP_MAINTENANCE = 0

# Application
Expand All @@ -22,34 +25,39 @@ TEST_DB_PASSWORD = root

# Urls
# ----
API_HOST_INFO = http://api.lobi-cms.test
FRONTEND_HOST_INFO = http://lobi-cms.test
API_HOST_INFO = http://api.lobi-cms.localhost
FRONTEND_HOST_INFO = http://lobi-cms.localhost
BACKEND_HOST_INFO = http://backend.lobi-cms.localhost
STORAGE_HOST_INFO = http://storage.lobi-cms.localhost

STORAGE_HOST_INFO = http://lobi-cms.localhost
STORAGE_BASE_URL = /storage/web
# Single domain example
# ----
#FRONTEND_HOST_INFO = http://lobi-cms.localhost
#FRONTEND_BASE_URL = /
#BACKEND_HOST_INFO = http://lobi-cms.localhost
#BACKEND_BASE_URL = /backend/web
#STORAGE_HOST_INFO = http://lobi-cms.localhost
#STORAGE_BASE_URL = /storage/web


# Other
# -----
DEFAULT_LANGUAGE = en
DEFAULT_CONTENT_ID = 2
SLACK_WEBHOOK_URL =

SMTP_HOST = mailcatcher
SMTP_PORT = 1025
SMTP_HOST =
SMTP_PORT =
SMTP_USERNAME =
SMTP_PASSWORD =
SMTP_ENCRYPTION = tls

FRONTEND_COOKIE_VALIDATION_KEY = <generated_key>
BACKEND_COOKIE_VALIDATION_KEY = <generated_key>

ADMIN_EMAIL = <Your admin email>
ROBOT_EMAIL = <Sender Email>
ADMIN_EMAIL = "<Your admin email>"
ROBOT_EMAIL = "<Sender Email>"
CC_EMAIL = "<Sender Email>"
BCC_EMAIL = "<Sender Email>"

GITHUB_CLIENT_ID = your-client-id
GITHUB_CLIENT_SECRET = your-client-secret
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ phpunit.phar

# Tests
tests/codeception/*/_support/_generated/*
frontend/web/storage/web/.tmb

# MultiSite domains config.
/common/config/multisite_websites.php

from-strato1-to-apollo.sh
strato1-download-db-storage.sh
upload-storage-and-db-to-apollo.sh
56 changes: 55 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,58 @@ For most of them you can leave them default, but make sure you have correct para
1. For importing translations for frontend from all frontend files run following command
```bash
php console/yii message common/config/messages/frontend.php
```
```


### Storage and Database synchronization

To download the storage and database from production or test server run the following command.

**Important**:
In order synchronization of database to work you need to create `.my.cnf` file to access
the database by just typing `mysql`.

```shell
php console/yii test/sync $username $host $port = [22]
```

This will:

- authenticate to the server by ssh
- make the database dump
- make the `*.tar.gz` archive file of the `storage/web/source`
- download the dump and storage archive file by scp command
- extract the storage into `storage/web/source` folder
- restore the dump into current database

## MultiSite

1. Run migration
```bash
./migrate
```
1. For switch language from 'en' to 'en-US'
```bash
php console/yii utils/switch-language en en-US
```
<b>Run output SQL String from DB console than continue!!!!</b>

1. Read languages from multiSiteCore websites and insert it in language table
```bash
php console/yii sync/languages
```
1. Add website in contentTree
```bash
php console/yii sync/websites
```
1. For copy content
```bash
php console/yii utils/copy-language $fromWebsiteKey $toWebsiteKey $from $to
```
<b>Run output SQL String from DB console than continue!!!!</b>

1. For add language content content
```bash
php console/yii utils/add-language $websiteKey $from $to
```
<b>Run output SQL String from DB console than continue!!!!</b>
10 changes: 7 additions & 3 deletions autocompletion.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class Yii extends \yii\BaseYii
* @property yii\web\UrlManager $urlManagerStorage UrlManager for storage application.
* @property trntv\glide\components\Glide $glide
* @property trntv\bus\CommandBus $commandBus
* @property \intermundia\yiicms\components\MultiSiteCore $multiSiteCore
* @property \intermundia\yiicms\components\ContentTree $contentTree
*/
abstract class BaseApplication extends yii\base\Application
{
Expand All @@ -35,13 +37,15 @@ abstract class BaseApplication extends yii\base\Application
*
* @property User $user User component.
*/
class WebApplication extends \apollo11\lobicms\web\Application
class WebApplication extends \intermundia\yiicms\web\Application
{
}

/**
* Class ConsoleApplication
* Include only Console application related components here
*
* @property \intermundia\yiicms\components\MultiSiteCore $multiSiteCore
*/
class ConsoleApplication extends yii\console\Application
{
Expand All @@ -51,8 +55,8 @@ class ConsoleApplication extends yii\console\Application
* User component
* Include only Web application related components here
*
* @property \apollo11\lobicms\models\User $identity User model.
* @method \apollo11\lobicms\models\User getIdentity() returns User model.
* @property \intermundia\yiicms\models\User $identity User model.
* @method \intermundia\yiicms\models\User getIdentity() returns User model.
*/
class User extends \yii\web\User
{
Expand Down
3 changes: 2 additions & 1 deletion backend/config/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
return [
'id' => 'backend',
'basePath' => dirname(__DIR__),
'bootstrap' => ['ckEditorStyles'],
'components' => [
'urlManager' => require __DIR__ . '/_urlManager.php',
'frontendCache' => require Yii::getAlias('@frontend/config/_cache.php'),
'view' => [
'class' => \apollo11\lobicms\web\BackendView::class,
'class' => \intermundia\yiicms\web\BackendView::class,
],
],
];
15 changes: 9 additions & 6 deletions backend/config/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
'controllerNamespace' => 'backend\controllers',
'defaultRoute' => 'timeline-event/index',
'defaultAlias' => 'website',
'bootstrap' => ['ckEditorStyles'],
'components' => [
'errorHandler' => [
'errorAction' => 'site/error',
Expand All @@ -14,7 +13,7 @@
'baseUrl' => env('BACKEND_BASE_URL'),
],
'user' => [
'class' => \apollo11\lobicms\web\User::class,
'class' => \intermundia\yiicms\web\User::class,
'identityClass' => common\models\User::class,
'loginUrl' => ['sign-in/unlock'],
'enableAutoLogin' => true,
Expand All @@ -31,10 +30,10 @@
],
],
'ckEditorStyles' => [
'class' => \common\components\CKEditorComponent::class,
'class' => \intermundia\yiicms\components\CKEditorComponent::class,
'customStyles' => [
]
]
],
],
'modules' => [
'widget' => [
Expand All @@ -54,7 +53,7 @@
'defaultRoute' => 'rbac-auth-item/index',
],
'core' => [
'class' => \apollo11\lobicms\Module::class,
'class' => \intermundia\yiicms\Module::class,
],
],
'as globalAccess' => [
Expand Down Expand Up @@ -94,7 +93,11 @@
],
[
'allow' => true,
'roles' => [\common\models\User::ROLE_EDITOR, \common\models\User::ROLE_MANAGER, \common\models\User::ROLE_ADMINISTRATOR],
'roles' => [
\common\models\User::ROLE_EDITOR,
\common\models\User::ROLE_MANAGER,
\common\models\User::ROLE_ADMINISTRATOR
],
],
],
],
Expand Down
38 changes: 34 additions & 4 deletions backend/controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,43 @@

namespace backend\controllers;

use apollo11\lobicms\models\ContentTree;
use apollo11\lobicms\models\ContentTreeMenu;
use backend\models\ContentTree;
use common\models\BaseModel;
use Yii;
use yii\helpers\ArrayHelper;

class BaseController extends \apollo11\lobicms\controllers\BaseController
class BaseController extends \intermundia\yiicms\controllers\BaseController
{

/**
*
*
* @author Zura Sekhniashvili <[email protected]>
* @param $tableName
* @param $contentTreeId
* @param $id
* @return \yii\web\Response
* @throws \Throwable
* @throws \yii\db\Exception
* @throws \yii\db\StaleObjectException
*/
public function actionDelete($tableName, $contentTreeId, $id)
{
$ClassName = Yii::$app->contentTree->getClassName($tableName);
$connection = Yii::$app->db;
$transaction = $connection->beginTransaction();
/** @var BaseModel $baseModel */
$baseModel = $ClassName::find()->byId($id)->one();
$tree = ContentTree::find()->byId($contentTreeId)->one();
$parent = $tree->getParent();

$tree->deleteWithChildren();

if (!$tree->link_id) {
$baseModel->delete();
}

$transaction->commit();

return $this->redirect($parent->getFullUrl());
}
}
2 changes: 1 addition & 1 deletion backend/controllers/ContentTreeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @author Zura Sekhniashvili <[email protected]>
* @package backend\controllers
*/
class ContentTreeController extends \apollo11\lobicms\controllers\ContentTreeController
class ContentTreeController extends \intermundia\yiicms\controllers\ContentTreeController
{

}
6 changes: 3 additions & 3 deletions backend/controllers/ContinentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace backend\controllers;

use apollo11\lobicms\models\Language;
use apollo11\lobicms\web\BackendController;
use intermundia\yiicms\models\Language;
use intermundia\yiicms\web\BackendController;
use Yii;
use apollo11\lobicms\models\Continent;
use intermundia\yiicms\models\Continent;
use backend\models\search\ContinentSearch;
use yii\helpers\ArrayHelper;
use yii\web\NotFoundHttpException;
Expand Down
8 changes: 4 additions & 4 deletions backend/controllers/CountryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace backend\controllers;

use apollo11\lobicms\models\Continent;
use apollo11\lobicms\models\Language;
use apollo11\lobicms\web\BackendController;
use intermundia\yiicms\models\Continent;
use intermundia\yiicms\models\Language;
use intermundia\yiicms\web\BackendController;
use Yii;
use apollo11\lobicms\models\Country;
use intermundia\yiicms\models\Country;
use backend\models\search\CountrySearch;
use yii\helpers\ArrayHelper;
use yii\web\NotFoundHttpException;
Expand Down
11 changes: 11 additions & 0 deletions backend/controllers/LanguageController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace backend\controllers;

/**
* MenuController implements the CRUD actions for Menu model.
*/
class LanguageController extends \intermundia\yiicms\controllers\LanguageController
{

}
2 changes: 1 addition & 1 deletion backend/controllers/MenuController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* MenuController implements the CRUD actions for Menu model.
*/
class MenuController extends \apollo11\lobicms\controllers\MenuController
class MenuController extends \intermundia\yiicms\controllers\MenuController
{

}
4 changes: 2 additions & 2 deletions backend/controllers/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace backend\controllers;

use apollo11\lobicms\models\SearchBackend;
use apollo11\lobicms\web\BackendController;
use intermundia\yiicms\models\SearchBackend;
use intermundia\yiicms\web\BackendController;
use Yii;
use yii\data\ActiveDataProvider;

Expand Down
2 changes: 1 addition & 1 deletion backend/controllers/SignInController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace backend\controllers;

use apollo11\lobicms\web\BackendController;
use intermundia\yiicms\web\BackendController;
use backend\models\AccountForm;
use backend\models\LoginForm;
use Intervention\Image\ImageManagerStatic;
Expand Down
2 changes: 1 addition & 1 deletion backend/controllers/SiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace backend\controllers;

use apollo11\lobicms\web\BackendController;
use intermundia\yiicms\web\BackendController;
use Yii;

/**
Expand Down
2 changes: 1 addition & 1 deletion backend/controllers/TimelineEventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace backend\controllers;

use apollo11\lobicms\web\BackendController;
use intermundia\yiicms\web\BackendController;
use backend\models\search\TimelineEventSearch;
use Yii;

Expand Down
4 changes: 2 additions & 2 deletions backend/controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace backend\controllers;

use apollo11\lobicms\web\BackendController;
use intermundia\yiicms\web\BackendController;
use backend\models\search\UserSearch;
use backend\models\UserForm;
use common\models\User;
use apollo11\lobicms\models\UserToken;
use intermundia\yiicms\models\UserToken;
use Yii;
use yii\filters\VerbFilter;
use yii\helpers\ArrayHelper;
Expand Down
Loading