From 187335950742b4c7ec011ede6e6d1ae86662cb1f Mon Sep 17 00:00:00 2001 From: Geo Halkiadakis Date: Thu, 27 Apr 2023 15:12:50 +0300 Subject: simplify app structure blueprint; simplify build and maintenance --- README.md | 26 +++++++++++------- docker/bin/docker-entrypoint.sh | 7 +++-- public/app/controllers/cms/Course.php | 23 ++++++++-------- public/app/models/todo.md | 51 ++++++++++++----------------------- tests/code/menu.php | 0 tests/service/mailjet.php | 0 6 files changed, 48 insertions(+), 59 deletions(-) mode change 100644 => 100755 tests/code/menu.php mode change 100644 => 100755 tests/service/mailjet.php diff --git a/README.md b/README.md index 8e7a43c..c21f3cb 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,30 @@ # x-anom (another MVC framework) +An open-source, fast, small, secure, full-featured, modern, easy to setup, easy to learn, +easy to extend, php 8+, OOP, MVC framework -## pre-Check - -Update ```~./container/config/composer-copy.json``` according to -```~./composer.json``` or vice-versa. You actualy need just one of them; -if pulling the project into a server (bare-metar/vps/shared etc) you only -need the first; if pulling into container you need the second/ +## pre-Check -On a Linux system you can also create a link from the one file to the other -(then you need to use ralative paths on autoload.classmap section). - +(1) +There are several ```composer*.json``` versions; +the ```~./composer.json``` is the only one you actually need; +all others found under ```~./docker/config/composer-*,json``` are for testing/ +case-study puproses; so make sure that ```~./composer.json``` is updated with +all required packages + +(2) When deploying on PRODUCTION make sure that all development routes are deleted and debuging messages are disabled. +(3) +Anom sets-up two writable folders: +* ```~/storage``` (pre-public directory) ideal for file-sessioning, file-caching; +also ideal for file-uploading when serve permition is needed; +* ```~/public/files``` (post-public folder) which is ideal for public access content +Make sure to keep the one that suits your needs (or both if needed); diff --git a/docker/bin/docker-entrypoint.sh b/docker/bin/docker-entrypoint.sh index edcce41..b3f24f3 100644 --- a/docker/bin/docker-entrypoint.sh +++ b/docker/bin/docker-entrypoint.sh @@ -2,16 +2,15 @@ # setup writable directories # ------------------------------------------------------------------------------ -# grand to 'cache' directory writable permissions -# set file-cache directory to apache's user ownership +# grand to storage directory writable permissions +# set storage directory to apache's user ownership chmod -R 755 /var/www/storage chown -R www-data:www-data /var/www/storage chown -R www-data:www-data /var/www/public/files chmod -R 757 /var/www/public/files -# copy composer.json to 'www'; then prepare auutoloading +# prepare auutoloading # ------------------------------------------------------------------------------ -cp /var/www/docker/config/composer-naked.json /var/www/composer.json (cd /var/www ; composer update) (cd /var/www ; composer dump-autoload) diff --git a/public/app/controllers/cms/Course.php b/public/app/controllers/cms/Course.php index 47eac5f..ad8a0fb 100644 --- a/public/app/controllers/cms/Course.php +++ b/public/app/controllers/cms/Course.php @@ -11,9 +11,8 @@ use app\extends\Cache_service; class Course { - /** PERMITION - * ------------------------------------------------------------------------- - */ + ## PERMITION + ## ------------------------------------------------------------------------- /** is admin or permited @@ -41,9 +40,9 @@ class Course { - /** FILES - * ------------------------------------------------------------------------- - */ + ## FILES + ## ------------------------------------------------------------------------- + /** serve file by file_path * (request is valid only for admin users) @@ -103,9 +102,9 @@ class Course { - /** COURSES - * ------------------------------------------------------------------------- - */ + ## COURSES + ## ------------------------------------------------------------------------- + /** course * prepare and render the course view @@ -147,9 +146,9 @@ class Course { - /** LESSONS - * ------------------------------------------------------------------------ - */ + ## LESSONS + ## ------------------------------------------------------------------------- + /** lesson diff --git a/public/app/models/todo.md b/public/app/models/todo.md index defd21e..89ea113 100644 --- a/public/app/models/todo.md +++ b/public/app/models/todo.md @@ -1,55 +1,38 @@ - - -Privilege ---- - -Privilege::list_of_privileges( privilege_id ) - -Privilege::privileges_tree() - - - - - -User +Rearange --- -User::get_privileges +-- #1 -- +app\controllers\cms\Course -> [*] app\controllers\Course -User::has_privilege( privilege_id ) +app\controllers\admin\Users_admin -> [delete] +app\controllers\Admin -> [delete] -User::reset_password() - -> create otp - -> send email +app\controllers\admin\Course_admin -> [*] app\controllers\Course_admin +app\models\admin\User_model -> [*] app\models\User_model -User::set_privilege( privilege_id ) +app\models\admin\Privilege_model -> [merge_to] -> [**] app\models\User_model +app\models\admin\History_model -> [*] app\models\History_model -User::track_action() - -> user_id - -> action : Contoller::method(args) - -> timestamp +app\models\cms\Page_model -> [delete] +app\models\cms\Media_model -> [delete] +app\models\cms\Course_model -> [*] app\models\Course_model -Lesson: ---- +[*] = move -Lesson::create_lesson( POST ) -Lesson::get_lesson( lesson_id ) +-- #2 -- +app\controllers\Course -> [r] app\controllers\Cms +app\controllers\Course_admin -> [r] app\controllers\Cms_admin -Course ---- - -Course::create_course( POST ) - -Course::courses_tree() +app\models\Course_model -> app\models\Cms_model diff --git a/tests/code/menu.php b/tests/code/menu.php old mode 100644 new mode 100755 diff --git a/tests/service/mailjet.php b/tests/service/mailjet.php old mode 100644 new mode 100755 -- cgit v1.2.3