Sign inSign up

thefreshuk/gradle-php

By thefreshuk

•Updated about 2 hours ago

Image
0

9.4K

thefreshuk/gradle-php repository overview

⁠ias-elearning

IAS elearning Theme with plugins in /plugins/ folder

⁠Migrations

⁠Make

php scripts/database/migrations generate

⁠Starting up

⁠First time
  1. Start Oauth.
  2. Create an Elearning client in OAuth (migration coming soon)
  3. Run cd config; ansible-playbook -i inventories/development docker.yml to download TF Data and create a .env
  4. Add the clients details to the generated .env
  5. Run docker-compose up
⁠Day-to-day
  1. Run docker-compose up

⁠Development notes

  • If you wish to add new plugins, a new docker image needs to be created: docker build --platform linux/amd64 --pull --no-cache -t thefreshuk/ias-elearning:VERSION . && docker push thefreshuk/ias-elearning:VERSION
  • Frontend assets are handled outside the contaner by yarn
  • PHP composer dependencies are handled inside the container. They're automatically built on startup

⁠Adding a new course

Addition of a new course can be done on any environment but is best done locally and then exported using tf-data.

⁠Export the Product

wp tf-data export-pages <page-slug> --post-type=product

⁠Export the Course

wp tf-data export-pages <page-slug> --post-type=sfwd-courses

⁠Export the lessons

You can export multiple lessons at once by space separating the slug.

wp tf-data export-pages <page-slugs> --post-type=sfwd-lessons

⁠Migrate the new content

php scripts/database/migrations generate

You'll need to edit the generated file and import all the xml files that have been generated.

<?php
...
    public function up(Schema $schema) : void
    {
        // this up() migration is auto-generated, please modify it to your needs
        $array = [
            "_course_product.xml",
            "_sfwd-courses.xml",
            "_sfwd-lessons.xml"
        ];
        sh("wp tf-data import-xml ". implode(' ', $array));
    }
 ...
⁠Rerunning migrations

If for some reason you need to re-run a migration you can use the execute command to rollback the migration, and then run it again without the --down option to re-execute it.

php scripts/database/migrations execute <migration id> --down

⁠Staging - TF data env sync broken

Since the env sync seems to be haivng issue with trashed pages this is how im doing it now.

SSH into Staging: cd ~/elearning/current/src; sudo wp --allow-root tf-data export-pages '{page_url}' --post-type={post_type}

Then to get from Staging on your local machine run - This will copy the staging resources folder into test/ folder located in your ias-elearning/ folder : scp -r -i ~/.ssh/IAS_Elearning.pem [email protected]:~/elearning/current/src/resources test/ You will then need to find the page you exported. Jsut a note sometime it doesnt like overwriteing XML so you might need to manaullyt remove the old xml file.

Tag summary

Content type

Image

Digest

sha256:a77461718…

Size

789 MB

Last updated

about 2 hours ago

docker pull thefreshuk/gradle-php