summaryrefslogtreecommitdiff
path: root/public/app/controllers/cli
diff options
context:
space:
mode:
Diffstat (limited to 'public/app/controllers/cli')
-rw-r--r--public/app/controllers/cli/CliContoller.php48
1 files changed, 9 insertions, 39 deletions
diff --git a/public/app/controllers/cli/CliContoller.php b/public/app/controllers/cli/CliContoller.php
index 310e2ae..4549b50 100644
--- a/public/app/controllers/cli/CliContoller.php
+++ b/public/app/controllers/cli/CliContoller.php
@@ -4,9 +4,11 @@ namespace app\controllers\cli;
/** CliContoller
*
- * Re-generate cashes of commonly used entities
- * like: product categories and trendy products
- * (proxy calls make use of PROXY_IGNORE_CACHE)
+ * A typical cli constoller; this one is used to
+ * re-generate cashes of commonly used entities
+ * with expensive queries like (ex:) categories;
+ *
+ * Proxy calls make use of PROXY_IGNORE_CACHE
*
* CliController calls Model methods who create
* cashed data with the exact same arguments as
@@ -14,8 +16,8 @@ namespace app\controllers\cli;
* the Model::method(arguments) triplete creates
* the same keys as via the web interface.
*
- * NOTE: Only Cli interface is allowed
- * [if (php_sapi_name() != 'cli') return false;]
+ * NOTE: Only Cli interface is allowed¨
+ * `if (php_sapi_name() != 'cli') return false;`
*
* The Cli-interfaced script can run manualy or
* (most usual scenario) scheduled via a cron job
@@ -37,12 +39,12 @@ class CliContoller
if (php_sapi_name() != 'cli') return false;
# PROXY call:
- # MARKET \ ProductCategories_model::tree():
+ # CMS \ Course_model::courses_struct():
# + Refresh Cache
# --------------------------------------
echo textColor("Creating category_products tree Cache ... ", \NORMAL);
$reply = proxy(
- [\app\models\market\ProductCategories_model::class, 'tree'],
+ [\app\models\cms\Course_model::class, 'courses_struct'],
[], \CACHE_ROOT_TTL,
\PROXY_IGNORE_CACHE
);
@@ -50,36 +52,4 @@ class CliContoller
}
-
- public static function getProductCategories()
- {
- return \Registry::use('database')->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