Revision #134                                    has been created by 
 rackycz                                    on Oct 4, 2019, 2:53:23 PM with the memo:
                                
                                
                                    git auto upload                                
                                                                    « previous (#133)                                                                                                    next (#135) »                                                            
                            Changes
                            
    Title
    unchanged
    Yii v2 snippet guide
    Category
    unchanged
    Tutorials
    Yii version
    unchanged
    2.0
    Tags
    unchanged
    tutorial,beginner,yii2
    Content
    changed
    [...]
- C:\xampp\htdocs\basic\config\db.php
... but it should work out-of-the-box if you use DB name "yii2basic" which is also used in examples below ...
Yii demo app + GitLab
---
 
**Once I know more about GitLab I will add some info** ... for example automatical copying from GitLab to your target web space.
Once you download and run the basic app, I recommend to push it into [GitLab](https://gitlab.com/). You will probably need a SSH certificate which can be generated [like this](https://www.huber.xyz/?p=275) using [PuTTYgen](https://www.puttygen.com/). When I work with Git I use [TortoiseGIT](https://www.puttygen.com/) which integrates all git functionalities into the context menu in Windows File Explorer.[...]
Then you can start to modify you project, for example based on this "tutorial".
**Automatical copying from GitLab to FTP**.
 
I found these two pages where things are explained: [link](https://www.savjee.be/2019/04/gitlab-ci-deploy-to-ftp-with-lftp/) [link](https://stackoverflow.com/questions/49632077/use-gitlab-pipeline-to-push-data-to-ftpserver) and I just copied something.
 
 
You only need to create 1 file in your GitLab repository. It is named .gitlab-ci.yml and it should contain following code:
 
 
```
 
variables:
 
  HOST: "url.to.my.ftp"
 
  USERNAME: "username"
 
  PASSWORD: "password"
 
  FOLDER: "relative path if needed"
 
 
deploy:
 
  script:
 
    - apt-get update -qq && apt-get install -y -qq lftp
 
    - lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rnev ./ $FOLDER --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/" --exclude vendor
 
  only:
 
    - master
 
```
 
 
I just added **--exclude vendor** and will probably add **--delete** in the future. Read linked webs.
 
 
**User management + DB creation + login via DB**
---
To create DB with users, use following command. I recommend charset **utf8_unicode_ci** (or utf8mb4_unicode_ci) as it allows you to use [more international characters](https://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci).
```sql
CREATE DATABASE IF NOT EXISTS `yii2basic` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;[...]