fix(perfexcrm module): align version to 3.0.1, unify entrypoint, and harden routes/views
- Bump DESK_MOLONI version to 3.0.1 across module - Normalize hooks to after_client_* and instantiate PerfexHooks safely - Fix OAuthController view path and API client class name - Add missing admin views for webhook config/logs; adjust view loading - Harden client portal routes and admin routes mapping - Make Dashboard/Logs/Queue tolerant to optional model methods - Align log details query with existing schema; avoid broken joins This makes the module operational in Perfex (admin + client), reduces 404s, and avoids fatal errors due to inconsistent tables/methods.
This commit is contained in:
112
validate_sync.sh
Normal file
112
validate_sync.sh
Normal file
@@ -0,0 +1,112 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Validação de consistência entre ficheiros locais e servidor
|
||||
# Desk-Moloni v3.0.1
|
||||
|
||||
echo "🔍 Validando consistência Local ↔ Servidor..."
|
||||
echo "========================================="
|
||||
|
||||
SERVER="server.descomplicar.pt"
|
||||
PORT="9443"
|
||||
USER="root"
|
||||
LOCAL_PATH="/media/ealmeida/Dados/Dev/desk-moloni/modules/desk_moloni"
|
||||
REMOTE_PATH="/home/ealmeida/desk.descomplicar.pt/modules/desk_moloni"
|
||||
|
||||
# Cores para output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Função para comparar ficheiros
|
||||
compare_file() {
|
||||
local file=$1
|
||||
local local_file="$LOCAL_PATH/$file"
|
||||
local remote_file="$REMOTE_PATH/$file"
|
||||
|
||||
if [ ! -f "$local_file" ]; then
|
||||
echo -e "${RED}❌ LOCAL: $file (não existe)${NC}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Calcular hash local
|
||||
local_hash=$(md5sum "$local_file" | cut -d' ' -f1)
|
||||
|
||||
# Calcular hash remoto
|
||||
remote_hash=$(ssh -p $PORT $USER@$SERVER "md5sum $remote_file 2>/dev/null | cut -d' ' -f1")
|
||||
|
||||
if [ -z "$remote_hash" ]; then
|
||||
echo -e "${RED}❌ REMOTO: $file (não existe)${NC}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$local_hash" == "$remote_hash" ]; then
|
||||
echo -e "${GREEN}✅ SINCRONIZADO: $file${NC}"
|
||||
return 0
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ DIFERENTE: $file${NC}"
|
||||
echo " Local: $local_hash"
|
||||
echo " Remoto: $remote_hash"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Lista de ficheiros críticos para validar
|
||||
CRITICAL_FILES=(
|
||||
"controllers/Dashboard.php"
|
||||
"controllers/Admin.php"
|
||||
"controllers/Mapping.php"
|
||||
"models/Desk_moloni_config_model.php"
|
||||
"models/Desk_moloni_sync_queue_model.php"
|
||||
"models/Desk_moloni_sync_log_model.php"
|
||||
"models/Desk_moloni_mapping_model.php"
|
||||
"models/Config_model.php"
|
||||
"libraries/PerfexHooks.php"
|
||||
"libraries/QueueProcessor.php"
|
||||
"libraries/MoloniApiClient.php"
|
||||
"helpers/desk_moloni_helper.php"
|
||||
"views/admin/partials/csrf_token.php"
|
||||
"assets/css/admin.css"
|
||||
"assets/js/admin.js"
|
||||
)
|
||||
|
||||
echo "📋 Verificando ${#CRITICAL_FILES[@]} ficheiros críticos..."
|
||||
echo ""
|
||||
|
||||
total_files=${#CRITICAL_FILES[@]}
|
||||
synced_files=0
|
||||
different_files=0
|
||||
missing_files=0
|
||||
|
||||
for file in "${CRITICAL_FILES[@]}"; do
|
||||
if compare_file "$file"; then
|
||||
((synced_files++))
|
||||
elif [ -f "$LOCAL_PATH/$file" ]; then
|
||||
((different_files++))
|
||||
else
|
||||
((missing_files++))
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "📊 RESUMO DA VALIDAÇÃO:"
|
||||
echo "======================="
|
||||
echo -e "✅ Sincronizados: ${GREEN}$synced_files${NC}/$total_files"
|
||||
echo -e "⚠️ Diferentes: ${YELLOW}$different_files${NC}/$total_files"
|
||||
echo -e "❌ Em falta: ${RED}$missing_files${NC}/$total_files"
|
||||
|
||||
# Calcular percentagem de consistência
|
||||
consistency=$((synced_files * 100 / total_files))
|
||||
echo ""
|
||||
echo -e "🎯 Consistência: ${GREEN}$consistency%${NC}"
|
||||
|
||||
if [ $consistency -eq 100 ]; then
|
||||
echo -e "${GREEN}🎉 PERFEITO! Todos os ficheiros estão sincronizados!${NC}"
|
||||
exit 0
|
||||
elif [ $consistency -ge 90 ]; then
|
||||
echo -e "${YELLOW}✨ MUITO BOM! Quase todos os ficheiros sincronizados${NC}"
|
||||
exit 0
|
||||
else
|
||||
echo -e "${RED}⚠️ ATENÇÃO! Vários ficheiros não estão sincronizados${NC}"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user