cx d dl mZmZ d dlZd dlZd dlZd dlZd dlmZ d dl m Z mZ d dlm Z d dlmZ d dlmZmZmZ d dlmZ d d lmZmZmZmZmZ d d lmZmZ d dlm Z d dl!m"Z" G d de e Z#dS ) )absolute_importprint_functionN)drop_privileges)ModifyUserHookModifyDomainHook) WposError)OBJECT_CACHE_FEATURE)get_admin_config_directory ALL_SUITESUNSUPPORTED_SUITES_FOR_RESELLER) UserConfig)WposUserupdate_redis_confupdate_wp_configuser_uidis_user_owned_by_reseller)SUITES_MARKERSDISABLE_FEATURE_IN_HOOK_FLAG)reload_redis)is_pleskc J e Zd ZdZd ZddedefdZd Zd Zd Z d d Z d ZdS )WposModifyUserHookz5 Update user's data in Redis and WP configs. c b t | }t | 5 t j |j s ddd dS t n5# t $ r(}t d| t j Y d}~nd}~ww xY wddd dS # 1 swxY w Y dS )z Reload Redis if the user has a Redis configuration file. We should use it because after modification of the domain the cagefsctl --force-update kill redis :param username: username of the domain owner N%Error occurred during daemon reload: file)r r ospathexists redis_confr Exceptionprintsysstderr)selfusernameuseres (py/clwpos/hooks/wpos_modify_user_hook.py_post_reload_redisz%WposModifyUserHook._post_reload_redis( sC !! X & &