Skip to content

Latest commit

 

History

History
123 lines (100 loc) · 3.4 KB

README.md

File metadata and controls

123 lines (100 loc) · 3.4 KB

Yii2 CMS core

Package contains core models, migrations, behaviors, controllers etc. for the Yii2 CMS

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist intermundia/yiicms "*"

or add

"intermundia/yiicms": "*"

to the require section of your composer.json file.

Upgrading from single site to Multi site

Important!!!

Make sure you do not override ContentTree::getActiveTranslation and BaseModel::getActiveTranslation methods


  1. Add user component in console/config.php

    'user' => [
        'class' => \intermundia\yiicms\web\User::class,
        'enableSession' => false,
        'identityClass' => \intermundia\yiicms\models\User::class
    ]
  2. Add controllers in console/config.php

    'sync' => [
        'class' => \intermundia\yiicms\console\controllers\SyncController::class,
    ],
    'utils' => [
        'class' => \intermundia\yiicms\console\controllers\UtilsController::class,
    ],
  3. Configure mulsitecore component in common/config/base.php If you want to have different domains for different environments, better to create ignored file and include inside multisitecore config

    'websites' => [
        'website key1' => [
            'defaultContentId' => "content tree id",
            'masterLanguage' => 'en-US',
            "storageUrl" => 'storage url',
            "domains" => [
                'domain1' => 'en-US',
                'domain2' => 'en-US',
            ]
        ],
        'website key2' => [
            'defaultContentId' => "content tree id",
            'masterLanguage' => 'en-US',
            "storageUrl" => 'storage url',
            "domains" => [
                'domain1' => 'en-US',
                'domain2' => 'en-US',
            ]
        ]
    ]
  4. Add console script to run core migrations in ./migrate bash script as the first line

    php console/yii migrate --migrationPath=@cmsCore/migrations
  5. Run migration

    ./migrate
  6. For switch language from 'en' to 'en-US'

    php console/yii utils/switch-language en en-US
  7. Read languages from multiSiteCore websites and insert it in language table

    php console/yii sync/languages 
  8. Add websites in contentTree

    php console/yii sync/websites 
  9. Make frontend/controllers/ContentTreeController to be extend of core's FrontendContentTreeController


  1. To copy the website content when you have already run php console/yii sync/websites

    php console/yii utils/copy-language $fromWebsiteKey $toWebsiteKey $from $to
  2. Copy language inside website

    php console/yii utils/add-language $websiteKey $from $to

To update alias, alias-path for and corresponding file manager items run

   php console/yii utils/fix-alias-and-file-manager-items $websiteKey

SluggableBehavior will update alias and alias_path attributes for each record in content_tree_translation table that belongs to provided $websiteKey. Corresponding file_manager_item records are also updated.