From 7076343338ae3439f3c86f01144818abe8c31978 Mon Sep 17 00:00:00 2001 From: George Halkiadakis Date: Sun, 12 Mar 2023 07:16:23 +0200 Subject: add container helpers; constuct public directory-tree --- html/app/controllers/cli/CliContoller.php | 85 +++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 html/app/controllers/cli/CliContoller.php (limited to 'html/app/controllers/cli/CliContoller.php') diff --git a/html/app/controllers/cli/CliContoller.php b/html/app/controllers/cli/CliContoller.php new file mode 100644 index 0000000..310e2ae --- /dev/null +++ b/html/app/controllers/cli/CliContoller.php @@ -0,0 +1,85 @@ +runQuery( + "SELECT * FROM product_categories", + [] + ); + } + + + + /** (re-) cacheCategoryByUrl( url ) + * regenerate cache of a category_product + * by category's friendly url + * @param $url (string): the category's friendly url + */ + public static function cacheCategoryByUrl(string $url) + { + // Only Cli interface is allowed + if (php_sapi_name() != 'cli') return false; + + # PROXY call: + # MARKET \ ProductCategories_model::tree(): + # + Refresh Cache + # -------------------------------------- + $reply = proxy( + [\app\models\market\ProductCategories_model::class, 'categoryFromUrl'], + [ $url ], \CACHE_CATEGORY_TTL, + \PROXY_IGNORE_CACHE + ); + echo ($reply == false) ? textColor("Failed\n", \FAIL) : textColor("Done!\n", \SUCCESS); + } +} \ No newline at end of file -- cgit v1.2.3