From 4217dc0560bf40b4fa7ae6a6f964bd56b418712e Mon Sep 17 00:00:00 2001 From: kaotisk Date: Fri, 14 Jun 2024 22:36:12 +0300 Subject: Refactoring --- modules/categories/main.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'modules/categories') diff --git a/modules/categories/main.sh b/modules/categories/main.sh index c0e1e77..82fc669 100755 --- a/modules/categories/main.sh +++ b/modules/categories/main.sh @@ -24,9 +24,9 @@ source $AK_LIBDIR/_ak_zblock if [ ! -d $AK_CATEGORIES ]; then mkdir $AK_CATEGORIES cd $AK_CATEGORIES - logit "INFO" "AK_CATEGORIES created" + _ak_log_info "AK_CATEGORIES created" else - logit "INFO" "AK_CATEGORIES found" + _ak_log_info "AK_CATEGORIES found" fi _ak_modules_categories_create(){ @@ -34,7 +34,7 @@ _ak_modules_categories_create(){ cd $TEMP export NEWS_FILE="$(date +%Y%m%d_%H%M%S)" vi $NEWS_FILE - logit "INFO" "Renaming..." + _ak_log_info "Renaming..." TITLE="$(head -n 1 $NEWS_FILE)" TO_FILE=$NEWS_FILE-$(echo $TITLE | tr '[:upper:]' '[:lower:]' | sed -e 's/ /\_/g' ) IPFS_FILE=$(_ak_ipfs_add $NEWS_FILE) @@ -61,10 +61,10 @@ _ak_modules_categories_import(){ then if [ ! -d $1 ] then - logit "ERROR" "Folder does not exists" + _ak_log_error "Folder does not exists" exit 4 else - logit "INFO" "Folder $1 exists" + _ak_log_info "Folder $1 exists" fl="$(ls -1 $1)" for f in $fl do @@ -72,7 +72,7 @@ _ak_modules_categories_import(){ done fi else - logit "ERROR" "No value" + _ak_log_error "No value" exit 6 fi exit 224 @@ -82,7 +82,7 @@ _ak_modules_categories_add(){ cd $TEMP if [ -f $1 ]; then FILE="$1" - logit "INFO" "Adding news from " $FILE + _ak_log_info "Adding news from " $FILE DATETIME=$(echo $FILE | cut -d - -f 1 | awk '{print $1}') TITLE=$(head -n 1 $FILE) FILE_IPFS_HASH=$(_ak_ipfs_add $FILE) @@ -99,15 +99,15 @@ _ak_modules_categories_add(){ } EOF else - logit "ERROR" "File $FILE doesn't exist"; + _ak_log_error "File $FILE doesn't exist"; exit 2 fi _ak_zblock_pack "news/add" $(pwd)/data if [ $? == 0 ] then - logit "INFO" "News added successfully" + _ak_log_info "News added successfully" else - logit "ERROR" "error??" + _ak_log_error "error??" exit 1 fi } -- cgit v1.2.3