# coding=utf-8
from parallels.core.utils.message_utils import single_line_message, multi_line_message, multi_line_message_split

APPLICATION_DESCRIPTION_WORDPRESS = single_line_message("""
    WordPress at '{base_path}'
""")
APPLICATION_DESCRIPTION_JOOMLA = single_line_message("""
    Joomla! at '{base_path}'
""")
APPLICATION_DESCRIPTION_DRUPAL = single_line_message("""
    Drupal at '{base_path}'
""")
APPLICATION_DESCRIPTION_MAGENTO = single_line_message("""
    Magento at '{base_path}'
""")
APPLICATION_DESCRIPTION_PRESTASHOP = single_line_message("""
    PrestaShop at '{base_path}'
""")
ACTION_RETRIEVE_DOCUMENT_ROOT_AND_URL_DESCRIPTION = single_line_message("""
    Retrieve document root directories and URL of source website
""")
ACTION_RETRIEVE_DOCUMENT_ROOT_AND_URL_FAILURE = single_line_message("""
    Failed to retrieve document root directories and URL of source website
""")
ACTION_CONNECT_TO_SOURCE_DOMAIN_DESCRIPTION = single_line_message("""
    Connect to source domain
""")
ACTION_CONNECT_TO_SOURCE_DOMAIN_FAILURE = single_line_message("""
    Failed to connect to source domain
""")
STATUS_MESSAGE_CONNECT_TO_SOURCE_FTP_FAILURE = single_line_message("""
    Failed to connect to source domain by FTP: {reason}
""")
STATUS_MESSAGE_CONNECT_TO_SOURCE_FTPS_FAILURE = multi_line_message("""
    Failed to connect to source domain by FTPS: {reason}
    To try with insecure plain-text FTP add to config to [web] section:
    allow-insecure-connections = "true"
""")
STATUS_MESSAGE_CONNECT_TO_SOURCE_SSH_FAILURE = single_line_message("""
    Failed to connect to source domain by SSH: {reason}
""")
STATUS_MESSAGE_CONNECT_TO_SOURCE_BOTH_FAILURE = multi_line_message("""
    Failed to connect to source domain by FTP and SSH.
    
    Error when connecting by FTP: {reason_ftp}
    
    Error when connecting by SSH: {reason_ssh}
""")
STATUS_MESSAGE_SECURE_CONNECT_TO_SOURCE_BOTH_FAILURE = multi_line_message("""
    Failed to connect to source domain by FTPS and SSH.

    Error when connecting by FTPS: {reason_ftp}

    Error when connecting by SSH: {reason_ssh}
    
        To try with insecure plain-text FTP add to config to [web] section:
    allow-insecure-connections = "true"
""")
FAILED_TO_EXECUTE_TEST_COMMAND_BY_SSH = single_line_message("""
    Failed to execute commands by SSH. 
    Most probably the system user of the website has no shell access to the server. 
""")
INVALID_CREDENTIALS = single_line_message("""
    Credentials are incorrect: please specify valid login and password.
""")
ACTION_FINISH_GET_SITE_INFO_DESCRIPTION = single_line_message("""
    Finish getting information about site
""")
ACTION_FINISH_GET_SITE_INFO_FAILURE = single_line_message("""
    Failed to finish getting information about site
""")
ACTION_START_GET_SITE_INFO_STATISTICS = single_line_message("""
    Start statistics for 'get site info' action
""")
FAILED_ACTION_START_GET_SITE_INFO_STATISTICS = single_line_message("""
    Failed to start statistics for 'get site info' action
""")
ACTION_START_TRANSFER_SITE_STATISTICS = single_line_message("""
    Start statistics for 'transfer site' action
""")
FAILED_ACTION_START_TRANSFER_SITE_STATISTICS = single_line_message("""
    Failed to start statistics for 'transfer site' action
""")
ACTION_FINALIZE_GET_SITE_INFO_STATISTICS = single_line_message("""
    Finalize statistics for 'get site info' action
""")
FAILED_ACTION_FINALIZE_GET_SITE_INFO_STATISTICS = single_line_message("""
    Failed to finalize statistics for 'get site info' action
""")
ACTION_FINALIZE_TRANSFER_SITE_STATISTICS = single_line_message("""
    Finalize statistics for 'transfer site' action
""")
FAILED_ACTION_FINALIZE_TRANSFER_SITE_STATISTICS = single_line_message("""
    Failed to finalize statistics for 'transfer site' action
""")
ACTION_GET_SOURCE_PHP_VERSION = single_line_message("""
    Get source web site PHP version
""")
FAILED_ACTION_GET_SOURCE_PHP_VERSION = single_line_message("""
    Failed to get source web site PHP version
""")
ACTION_GET_SOURCE_IS_WINDOWS = single_line_message("""
    Get info about OS type on source web site, Windows or not
""")
FAILED_ACTION_GET_SOURCE_IS_WINDOWS = single_line_message("""
    Failed to get info about OS type on source web site, Windows or not
""")
ACTION_MARK_GET_SITE_INFO_FINISHED = single_line_message("""
    Mark 'get site info' action as finished successfully 
""")
FAILED_ACTION_MARK_GET_SITE_INFO_FINISHED = single_line_message("""
    Failed to mark 'get site info' action as finished successfully 
""")
ACTION_MARK_TRANSFER_SITE_FINISHED = single_line_message("""
    Mark 'get site info' action as finished successfully 
""")
FAILED_ACTION_MARK_TRANSFER_SITE_FINISHED = single_line_message("""
    Failed to mark 'get site info' action as finished successfully 
""")
ACTION_RETRIEVE_DOCUMENT_ROOT_SOURCE_SPECIFIED = single_line_message("""
    Document root directory for website is specified explicitly: '{document_root}'
""")
ACTION_RETRIEVE_DOCUMENT_ROOT_SOURCE_CACHED = single_line_message("""
    Document root directory for website was detected previous time: '{document_root}'
""")
ACTION_RETRIEVE_DOCUMENT_ROOT_SOURCE_FOUND = single_line_message("""
    Document root directory for website was found '{document_root}' with URL '{base_url}'
""")
ACTION_RETRIEVE_DOCUMENT_ROOT_SOURCE_NOT_FOUND_INITIAL = multi_line_message_split("""
    Unable to locate the document root directory of the website automatically.

    Please specify source document root and source website URL in the options below.
""")
ACTION_RETRIEVE_DOCUMENT_ROOT_SOURCE_NOT_FOUND_FTP = multi_line_message_split("""
    Unable to locate the document root directory of the website.


    Possible reasons:

    1. The FTP user only has access to a directory inside the document root.

    For example, this can happen when migrating the website http://example.com/ if the FTP user only has access
    to a subdirectory of the website, e.g. http://example.com/blog.

    To resolve the issue, specify correct source document root and source website URL in advanced options below.

    2. The document root of the website is located more than three levels deep relative to the FTP root directory.

    For example, this can happen when migrating the website http://example.com/ if its document root directory
    is /var/www/vhosts/my/sites/example.com/httpdocs and the FTP user root is in /var/www/.

    To resolve the issue, specify correct source document root in advanced options below.

    3. There are rewrite rules for the document root (for example, specified by mod_rewrite and the .htaccess file).

    To resolve the issue, temporarily disable the rewrite rules.
""")
ACTION_RETRIEVE_DOCUMENT_ROOT_SOURCE_NOT_FOUND_SSH = multi_line_message_split("""
    Unable to locate the document root directory of the website.


    Possible reasons:

    1. The SSH user home directory is inside of the document root.

    For example, this can happen when migrating the website http://example.com/ if the SSH user has 
    home directory inside of subdirectory of the website, e.g. http://example.com/blog.

    To resolve the issue, specify correct source document root and source website URL in advanced options below.

    2. The document root of the website is located more than three levels deep relative to the SSH home directory.

    For example, this can happen when migrating the website http://example.com/ if its document root directory
    is /var/www/vhosts/my/sites/example.com/httpdocs and the SSH home directory is in /var/www/.

    To resolve the issue, specify correct source document root in advanced options below.

    3. There are rewrite rules for the document root (for example, specified by mod_rewrite and the .htaccess file).

    To resolve the issue, temporarily disable the rewrite rules.
""")
ACTION_RETRIEVE_BASE_URL_DESCRIPTION = single_line_message("""
    Retrieve base URLs of source websites
""")
ACTION_RETRIEVE_BASE_URL_FAILURE = single_line_message("""
    Failed to retrieve base URLs of source websites
""")
ACTION_RETRIEVE_BASE_URL_SOURCE_SPECIFIED = single_line_message("""
    Base URL for website is specified explicitly: '{base_url}'
""")
ACTION_RETRIEVE_BASE_URL_SOURCE_CACHED = single_line_message("""
    Base URL for website was detected previous time: '{base_url}'
""")
ACTION_RETRIEVE_TARGET_SITE_INFO_DESCRIPTION = single_line_message("""
    Retrieve information about target site
""")
ACTION_RETRIEVE_TARGET_SITE_INFO_FAILURE = single_line_message("""
    Failed to retrieve information about target site
""")
ACTION_RETRIEVE_APPLICATIONS_DESCRIPTION = single_line_message("""
    Retrieve applications hosted on source websites
""")
ACTION_RETRIEVE_APPLICATIONS_FAILURE = single_line_message("""
    Failed to retrieve applications hosted on source websites
""")
ACTION_RETRIEVE_FILES_TREE_DESCRIPTION = single_line_message("""
    Retrieve information about files on source website
""")
ACTION_RETRIEVE_FILES_TREE_FAILURE = single_line_message("""
    Failed to retrieve information about files on source website
""")
ACTION_DEPLOY_WEB_RPC_AGENT_DESCRIPTION = single_line_message("""
    Deploy web RPC agent to the source website
""")
ACTION_DEPLOY_WEB_RPC_AGENT_FAILURE = single_line_message("""
    Failed to deploy web RPC agent to the source website
""")
ACTION_CHECK_SAME_WEBSPACE_DESCRIPTION = single_line_message("""
    Check if source and target sites are the same
""")
ACTION_CHECK_SAME_WEBSPACE_FAILURE = single_line_message("""
    Failed to check if source and target sites are the same
""")
ERROR_MIGRATE_FROM_THE_SAME_WEBSPACE = single_line_message("""
    Source and destination sites are the same.
    Make sure that you specified correct source domain name and 
    it resolves to the source server, not to the target server.
""")
ACTION_RETRIEVE_APPLICATIONS_SOURCE = single_line_message("""
    Retrieve applications hosted on website
""")
ACTION_RETRIEVE_APPLICATIONS_SOURCE_CACHED = single_line_message("""
    Already retrieved applications hosted on website
""")
ACTION_RETRIEVE_FILES_TREE_SOURCE = single_line_message("""
    Retrieve information about files of website
""")
ACTION_RETRIEVE_FILES_TREE_SOURCE_CACHED = single_line_message("""
    Already retrieved information about files of website
""")
ACTION_VALIDATE_HOSTING_DESCRIPTION_DESCRIPTION = single_line_message("""
    Validate hosting description file
""")
ACTION_VALIDATE_HOSTING_DESCRIPTION_FAILURE = single_line_message("""
    Failed to validate hosting description file
""")
ACTION_VALIDATE_HOSTING_DESCRIPTION_NOT_SPECIFIED = single_line_message("""
    Hosting description file is not specified in migration configuration file
""")
ACTION_COPY_FILES_DESCRIPTION = single_line_message("""
    Copy files of the source website
""")
ACTION_COPY_FILES_FAILURE = single_line_message("""
    Failed to copy files of the source website
""")
ACTION_COPY_FILES_FAILED_FOR_FOLDER = multi_line_message_split("""
    Failed to copy files of source folder '{source_folder}' to '{target_folder}' on the target server.

    Transfer the folder manually to the target server.
""")
ACTION_COPY_FILES_SSH_FAILED_FOR_FOLDER = multi_line_message_split("""
    There were issues when transferring source folder '{source_folder}' to '{target_folder}' on the target server 
    using '{method}'.

    Executed command: {command}

    Output: {output}
""")
ACTION_COPY_FILES_SCP_REMOVE_AGENT_FAILED = multi_line_message("""
    Failed to remove temporary Web RPC agent files from '{target_folder}' on the target server.
    Please remove all files starting from "plesk-migrator-agent-" from the transferred folder manually.

    Reason: {reason}
""")
ACTION_COPY_DATABASE_CONTENT = single_line_message("""
    Copy databases
""")
ACTION_COPY_DATABASE_CONTENT_FAILED = single_line_message("""
    Failed to copy database content of subscription.
""")
ACTION_COPY_DATABASE_CONTENT_FAILED_FOR_DATABASE = multi_line_message_split("""
    Failed to copy content (tables with data) of database '{name}'.

    Transfer database content manually with the help of mysqldump/mysql utilities
    or backup/restore features of tools like phpMyAdmin.
""")
ACTION_COPY_DATABASE_CONTENT_FAILED_DUMP = multi_line_message_split("""
    Failed to copy content (tables with data) of database '{database_name}':
    unable to create database dump of database '{database_name}' on the source server.

    Transfer database content manually with the help of mysqldump/mysql utilities
    or backup/restore features of tools like phpMyAdmin.
""")
ACTION_COPY_DATABASE_CONTENT_FAILED_CHECK_UTF8MB4 = multi_line_message_split("""
    Failed to check if database '{database_name}' supports utf8mb4 character set.
    Utf8 character set will be passed as option to mysqldump command instead of utf8mb4.
""")
ACTION_COPY_DATABASE_CONTENT_FAILED_NO_DB_SERVER = single_line_message("""
    Failed to copy content (tables with data) of database '{database_name}':
    there is no {database_type} database server assigned to the subscription.
""")
ACTION_COPY_DATABASE_CONTENT_FAILED_RESTORE = multi_line_message_split("""
    Failed to restore database dump of database '{name}' on the target server.

    Transfer database content manually with the help of mysqldump/mysql utilities
    or backup/restore features of tools like phpMyAdmin.
""")
DATABASE_DUMP_FAILED_LINUX = multi_line_message("""
    Failed to create database dump of database '{db_name}'.
    'mysqldump' utility returned non-zero exit code.
    - Exit code: {exit_code}
    - Stderr: {stderr}
""")
DATABASE_DUMP_FAILED_WINDOWS = multi_line_message("""
    Failed to create database dump of database '{db_name}'.
    'mysqldump' utility returned non-zero exit code.
    - Exit code: {exit_code}
""")
ACTION_FAILED_CREATE_MODEL = single_line_message("""
    Failed to create target model
""")
ACTION_DESCRIPTION_CREATE_MODEL = single_line_message("""
    Create target model
""")
ACTION_READ_MIGRATION_LIST_DESCRIPTION = single_line_message("""
    Read site migration list
""")
ACTION_READ_MIGRATION_LIST_FAILURE = single_line_message("""
    Failed to read site migration list
""")
ACTION_START_MIGRATION_DESCRIPTION = single_line_message("""
    Start migration of applications, files and databases
""")
ACTION_START_MIGRATION_FAILURE = single_line_message("""
    Failed to start migration of applications, files and databases
""")
ACTION_FINISH_MIGRATION_DESCRIPTION = single_line_message("""
    Finish migration of applications, files and databases
""")
ACTION_FINISH_MIGRATION_FAILURE = single_line_message("""
    Failed to finish migration of applications, files and databases
""")
ACTION_START_CHECK_APPS_DESCRIPTION = single_line_message("""
    Start check of applications
""")
ACTION_START_CHECK_APPS_FAILURE = single_line_message("""
    Failed to start check of applications
""")
ACTION_FINISH_CHECK_APPS_DESCRIPTION = single_line_message("""
    Finish check of applications
""")
ACTION_FINISH_CHECK_APPS_FAILURE = single_line_message("""
    Failed to finish check of applications
""")
NO_DOMAIN_ON_TARGET = single_line_message("""
    Domain '{domain_name}' specified in configuration file does not exist on the target server
""")
ACTION_GET_SITE_INFO_DESCRIPTION = single_line_message("""
    Get information about site and detect applications
""")
ACTION_COPY_WEB_FILES_DESCRIPTION = single_line_message("""
    Copy web files
""")
ACTION_COPY_CONTENT_DESCRIPTION = single_line_message("""
    Copy web files and databases content
""")
COMMAND_TRANSFER_SITE = single_line_message("""
    Transfer site (applications, files, databases)
""")
COMMAND_GET_SITE_INFO = single_line_message("""
    Get information about site and detect applications
""")
COMMAND_CHECK_APPS = single_line_message("""
    Check migrated applications
""")
COMMAND_RUN_TASKS = single_line_message("""
    Run site migration tasks
""")
COMMAND_ADD_TASKS = single_line_message("""
    Add site migration tasks for specified applications/files/databases
""")
COMMAND_CANCEL_TASKS = single_line_message("""
    Cancel site migration tasks for specified applications/files/databases
""")
ACTION_RUN_TASKS_DESCRIPTION = single_line_message("""
    Run site migration tasks
""")
ACTION_RUN_TASKS_FAILURE = single_line_message("""
    Failed to run site migration tasks
""")
ACTION_ADD_TASKS_DESCRIPTION = single_line_message("""
    Add site migration tasks for specified applications/files/databases
""")
ACTION_ADD_TASKS_FAILURE = single_line_message("""
    Failed to add site migration tasks for specified applications/files/databases
""")
ACTION_CANCEL_TASKS_DESCRIPTION = single_line_message("""
    Cancel site migration tasks for specified applications/files/databases
""")
ACTION_CANCEL_TASKS_FAILURE = single_line_message("""
    Failed to cancel site migration tasks for specified applications/files/databases
""")
ACTION_CHECK_APPS_DESCRIPTION = single_line_message("""
    Check migrated applications
""")
ACTION_CHECK_APPS_FAILURE = single_line_message("""
    Failed to check migrated applications
""")
RUN_COMMAND = single_line_message("""
    Run task command: {command}
""")
COMMAND_TERMINATED = single_line_message("""
    Task command process was terminated by stop request
""")
SITE_MIGRATION_LIST_OPTION = single_line_message("""
    Site migration list - JSON file which contains information about applications,
    files and databases to be transferred
""")
SITE_MIGRATION_RELOAD_SOURCE_DATA_OPTION = single_line_message("""
    Load information about source directories and applications even if it was loaded before, avoid usage of cache
""")
FTP_COPY_CONFIG = multi_line_message("""
    Start FTP copy command with the following config (the config is passed to stdin):
    {config}
""")
WEB_STREAMING_CONFIG = multi_line_message("""
    Start web stream download command with the following config (the config is passed to stdin):
    {config}
""")
NO_VIRTUAL_HOSTING = single_line_message("""
    Domain '{domain}' has no virtual hosting enabled on the target server: site migration is not possible.
""")
ACTION_REGISTER_WORDPRESS_DESCRIPTION = single_line_message("""
    Register WordPress instances in WordPress Toolkit
""")
ACTION_REGISTER_WORDPRESS_FAILURE = single_line_message("""
    Failed to register WordPress instances in WordPress Toolkit
""")
ACTION_REGISTER_WORDPRESS_FAILURE_FOR_APP = multi_line_message_split("""
    Failed to register WordPress instance at '{path}' in WordPress Toolkit on the target server.

    You will not be able to manage application with the help of WordPress Toolkit.
""")
ACTION_ADJUST_SITE_NAME_CHANGE_DESCRIPTION = single_line_message("""
    Fix site name in configuration files
""")
ACTION_ADJUST_SITE_NAME_CHANGE_FAILURE = single_line_message("""
    Failed to fix site name in configuration files
""")
ACTION_ADJUST_SITE_NAME_CHANGE_FAILURE_FOR_FOLDER = multi_line_message_split("""
    Failed to fix site name in configuration files in '{target_folder}' folder on the target server.
    Applications in that folder may become broken after migration.

    To resolve the issue, find all references to old domain name and replace them with new domain name.
""")
ACTION_ADJUST_PATHS_DESCRIPTION = single_line_message("""
    Adjust paths
""")
ACTION_ADJUST_PATHS_FAILURE = single_line_message("""
    Failed to adjust paths
""")
ACTION_ADJUST_PATHS_FAILURE_FOR_FOLDER = multi_line_message_split("""
    Failed to adjust paths in '{target_folder}' folder on the target server:
    applications and scripts which use absolute paths in their code or configuration
    may get broken after migration.

    Replace old absolute paths with the new ones in case if applications does not work.
""")
ACTION_ADJUST_BASE_URL_IN_FILES_DESCRIPTION = single_line_message("""
    Adjust application URL in files
""")
ACTION_ADJUST_BASE_URL_IN_FILES_FAILURE = single_line_message("""
    Failed to adjust application URL in files
""")
ACTION_ADJUST_BASE_URL_IN_FILES_FAILURE_FOR_APP = multi_line_message_split("""
    Failed to adjust application URL in files of {application_type} at '{path}'.

    Application could be broken on the target server.

    To resolve the issue, fix files so it contains actual application URL.
""")
ADJUSTED_BASE_URL_IN_FILE = multi_line_message("""
    File '{filename}': fixed application URL that was changed during migration.
    Line #{line_number} of the file was changed.
    Before fix: {before_fix}
    After fix : {after_fix}
""")
ACTION_ADJUST_BASE_URL_IN_DB_DESCRIPTION = single_line_message("""
    Adjust application URL in database
""")
ACTION_ADJUST_BASE_URL_IN_DB_FAILURE = single_line_message("""
    Failed to adjust application URL in database
""")
ACTION_ADJUST_BASE_URL_IN_DB_FAILURE_FOR_APP = multi_line_message_split("""
    Failed to adjust application URL in database of {application_type} at '{path}'.

    Application could be broken on the target server.

    To resolve the issue, fix database so it contains actual application URL.
""")
ACTION_ADJUST_DATABASE_HOST_DESCRIPTION = single_line_message("""
    Adjust database hostname in configuration files of migrated applications
""")
ACTION_ADJUST_DATABASE_HOST_FAILURE = single_line_message("""
    Failed to adjust database hostname in configuration files of migrated applications
""")
ACTION_ADJUST_DATABASE_HOST_FAILURE_FOR_APP = multi_line_message_split("""
    Failed to adjust database hostname in configuration files of {application_type} at '{path}'.

    Application could be broken on the target server.

    To resolve the issue, fix configuration files so they contain actual database server hostname.
""")
ACTION_ADJUST_DATABASE_NAME_DESCRIPTION = single_line_message("""
    Adjust database name in configuration files of migrated applications
""")
ACTION_ADJUST_DATABASE_NAME_FAILURE = single_line_message("""
    Failed to adjust database name in configuration files of migrated applications
""")
ACTION_ADJUST_DATABASE_NAME_FAILURE_FOR_APP = multi_line_message_split("""
    Failed to adjust database name in configuration files of {application_type} at '{path}'.

    Application could be broken on the target server.

    To resolve the issue, fix configuration files so they contain actual database name.
""")
ACTION_ADJUST_DATABASE_USER_DESCRIPTION = single_line_message("""
    Adjust database user in configuration files of migrated applications
""")
ACTION_ADJUST_DATABASE_USER_FAILURE = single_line_message("""
    Failed to adjust database user in configuration files of migrated applications
""")
ACTION_ADJUST_DATABASE_USER_FAILURE_FOR_APP = multi_line_message_split("""
    Failed to adjust database user name in configuration files of {application_type} at '{path}'.
    
    Application could be broken on the target server.

    To resolve the issue, fix configuration files so they contain actual database user name.
""")
ACTION_CHECK_APPS_FAILURE_FOR_APP = single_line_message("""
    Failed to check {application_type} application at '{path}'.
""")
QUERY_FOR_BASE_URL_ADJUSTMENT_EXECUTED = multi_line_message("""
    Application URL was successfully adjusted with query:
    {query}
""")
FAILED_TO_EXECUTE_QUERY_FOR_BASE_URL_ADJUSTMENT = multi_line_message("""
    Failed to adjust application URL with query:
    {query}
    Error message:
    {error}
""")
FAILED_TO_GET_TARGET_WEBSITE_IP_ADDRESS = single_line_message("""
    Failed to get target website IP address
""")
CHECK_FINISHED_NO_ISSUES = single_line_message("""
    Checks didn't detect any issues. Website works well.
""")
CHECK_IMPOSSIBLE_NO_SOURCE_URL = single_line_message("""
    Failed to detect URL of the application. Check is impossible for this application.
    Start the new site import using this application URL to make check available.
""")
ADJUSTED_SITE_NAME = single_line_message("""
    Adjusted site name in '{filename}': changed from '{source_domain_name}' to '{target_domain_name}'
""")
ACTION_REMOVE_WEB_RPC_AGENT_DESCRIPTION = single_line_message("""
    Remove web agent from the source site
""")
ACTION_REMOVE_WEB_RPC_AGENT_DESCRIPTION_FAILURE = single_line_message("""
    Failed to remove web agent from the source site
""")
ACTION_REMOVE_SSH_KEYS_ACTION_DESCRIPTION = single_line_message("""
    Remove SSH keys used to transfer files and directories
""")
ACTION_REMOVE_SSH_KEYS_ACTION_FAILURE = single_line_message("""
    Failed to remove SSH keys used to transfer files and directories
""")
ACTION_REMOVE_WEB_AGENT_REPEAT = single_line_message("""
    Failed to remove web agent from the source site, try to remove it once more
""")
ACTION_REMOVE_WEB_AGENT_REPEAT_SUCCESS = single_line_message("""
    Successfully removed web agent from the source site after several attempts
""")
ACTION_REMOVE_INDEX_FILES = single_line_message("""
    Remove unnecessary index files
""")
ACTION_REMOVE_INDEX_FILES_FAILURE = single_line_message("""
    Failed to remove unnecessary index files
""")
ACTION_VALIDATE_DATABASES_DESCRIPTION = single_line_message("""
    Validate application databases
""")
ACTION_VALIDATE_DATABASES_FAILURE = single_line_message("""
    Failed to validate application databases
""")
ACTION_DISABLE_PRESTASHOP_CACHE_DESCRIPTION = single_line_message("""
    Disable caching on PrestaShop (as it breaks application on default Plesk configuration)
""")
ACTION_DISABLE_PRESTASHOP_CACHE_FAILURE = single_line_message("""
    Failed to disable caching on PrestaShop
""")
ACTION_DISABLE_JOOMLA_CACHE_DESCRIPTION = single_line_message("""
    Disable caching on Joomla! (as it breaks application on default Plesk configuration)
""")
ACTION_DISABLE_JOOMLA_CACHE_FAILURE = single_line_message("""
    Failed to disable caching on Joomla!
""")
ACTION_DISABLE_JOOMLA_CACHE_FAILURE_FOR_APP = multi_line_message_split("""
    Failed to disable caching for Joomla! at '{path}'.

    Application could get broken if caching is enabled, but there is no required caching PHP module on 
    the target server (e.g. APC, memcached).
    
    If application works after migration then just ignore this issue.
    If application does not work after migration, then ensure that either 
    "app/config/parameters.php" has caching disabled ("ps_cache_enable" option) 
    or target server has required caching modules installed (e.g. APC, memcached)
""")
JOOMLA_DISABLE_CACHING_REASON = single_line_message("""
    Disabled caching as it breaks application on default Plesk configuration
""")
ACTION_DISABLE_PRESTASHOP_CACHE_FAILURE_FOR_APP = multi_line_message_split("""
    Failed to disable caching for PrestaShop at '{path}'.

    Application could get broken if caching is enabled, but there is no required caching PHP module on 
    the target server (e.g. APC, memcached).
    
    If application works after migration then just ignore this issue.
    If application does not work after migration, then ensure that either 
    "app/config/parameters.php" has caching disabled ("ps_cache_enable" option) 
    or target server has required caching modules installed (e.g. APC, memcached)
""")
PRESTASHOP_DISABLE_CACHING_REASON = single_line_message("""
    Disabled caching as it breaks application on default Plesk configuration
""")
APPLICATION_REPLACE_FILE_CONTENT = multi_line_message("""
    {application_instance_description}: {reason}.
    Line #{line_number} of the file '{file}' was changed.
    Before fix: {before_fix}
    After fix: {after_fix}
""")
ACTION_REMOVE_INDEX_FILES_FAILURE_FOR_APP = multi_line_message_split("""
    Failed to remove unnecessary "index.html" file for {application_type} at '{path}'.

    Application could be unavailable via HTTP.

    To resolve the issue, remove "index.html" file from the directory of the application, if such file exists.
""")
ACTION_VALIDATE_DATABASE_FAILURE_FOR_APP = multi_line_message_split("""
    Failed to check database parameters for {application_type} at '{path}'.
""")
APPLICATION_INVALID_DATABASE = multi_line_message_split("""
    Failed to detect database parameters for {application_type} at '{path}'.

    Database of the application won't be imported.
""")
INDEX_FILE_REMOVED = multi_line_message("""
    Remove unnecessary index file '{file}'
""")
NEW_BASE_URL = multi_line_message("""
    Detected URL of the site: {url}
""")
LOG_DETECT_DOCROOT_URL = multi_line_message("""
    Detect document root of site by:
    1. Uploading probe file '{file}' to directories starting from '{path}'.
    2. Requesting it starting at base URL '{url}'.
""")
CHECKED_PATHS = multi_line_message("""
    When detecting document root of the site, we checked the following paths with the following results:
    {table}
""")
CHECKED_PATH = single_line_message("""
    Uploaded probe file to
""")
CHECKED_PATH_URL = single_line_message("""
    Checked URL
""")
CHECKED_PATH_RESULT = single_line_message("""
    Result
""")
CHECKED_PATH_RESULT_SUCCESS = single_line_message("""
    Success, path will be used for web RPC agent
""")
CHECKED_HTTP_PATH_SUCCESS = single_line_message("""
    Success, path will be used for web RPC agent as insecure solution
""")
CHECKED_PATH_HTTP_REDIRECT = single_line_message("""
    Redirect to HTTP detected, but HTTPS required, path will be skipped
""")
CHECKED_PATH_OTHER_REDIRECT = single_line_message("""
    Redirect to non HTTP/HTTPS protocol detected, path will be skipped
""")
CHECKED_PATH_RESULT_FAILED_TO_UPLOAD_PROBE = single_line_message("""
    Failed to upload probe file (e.g. no permissions to write to directory)
""")
CHECKED_PATH_HTTP_ERROR = single_line_message("""
    HTTP error (e.g. 404 - probe file not found)
""")
CHECKED_PATH_URL_ERROR = single_line_message("""
    URL error (e.g. connection refused)
""")
CHECKED_PATH_UNKNOWN_ERROR = single_line_message("""
    Unknown error
""")
CHECKED_PATH_DIFFERENT_HTTP_RESPONSE = single_line_message("""
    Different HTTP response (no contents of probe file)
""")
ACTION_DEPLOY_DATABASE_DESCRIPTION = single_line_message("""
    Create databases
""")
ACTION_DEPLOY_DATABASE_FAILURE = single_line_message("""
    Failed to create databases
""")
ACTION_DEPLOY_DATABASE_FAILURE_FOR_DATABASE = multi_line_message_split("""
    Failed to create database '{name}' on the target server.

    Try to create the database manually from Plesk.
""")
ACTION_DEPLOY_DATABASE_USERS_DESCRIPTION = single_line_message("""
    Create database users
""")
ACTION_DEPLOY_DATABASE_USERS_FAILURE = single_line_message("""
    Failed to create database users
""")
ACTION_DEPLOY_DATABASE_USERS_FAILURE_FOR_USER = multi_line_message_split("""
    Failed to create database user '{user}' for database '{database}'.

    Contents of corresponding database will not be transferred, and applications which use that database won't
    work after migration.

    Try to create the database user manually from Plesk.
""")
ACTION_RESOLVE_DATABASE_NAME_CONFLICTS_DESCRIPTION = single_line_message("""
    Resolve database name conflicts
""")
ACTION_RESOLVE_DATABASE_NAME_CONFLICTS_FAILURE = single_line_message("""
    Failed to resolve database name conflicts
""")
ACTION_RESOLVE_DATABASE_USER_NAME_CONFLICTS_DESCRIPTION = single_line_message("""
    Resolve database user name conflicts
""")
ACTION_RESOLVE_DATABASE_USER_NAME_CONFLICTS_FAILURE = single_line_message("""
    Failed to resolve database user name conflicts
""")
LOG_EXECUTE_FOR_OBJECT = single_line_message("""
    Execute for {object_description}
""")
LOG_SKIP_EXECUTE_FOR_OBJECT = single_line_message("""
    Skip executing for {object_description} as pre-requirement actions were not executed
""")
APPLICATION_DESCRIPTION = single_line_message("""
    {application} at source path '{source_path}', target path '{target_path}'
""")
DATABASE_DESCRIPTION = single_line_message("""
    database '{name}'
""")
FOLDER_DESCRIPTION = single_line_message("""
    folder '{path}'
""")
SCHEDULED_TASK = multi_line_message("""
    Scheduled task '{task_id}'
    Task directory: {task_dir}
    Migration list:
    {migration_list}
""")
STOP_RUNNING_TASK = single_line_message("""
    Requested to stop running task '{task_id}', waiting
""")
TASK_STOPPED = single_line_message("""
    Task '{task_id}' was stopped
""")
TASK_CANCELLED = single_line_message("""
    Task '{task_id}' was cancelled
""")
COMMAND_FINISHED = single_line_message("""
    Command execution finished
""")
FTP_MIGRATOR_INVALID_OUTPUT = single_line_message("""
    Most probably, files were not copied from the source site: failed to decode output of FTP migrator.
""")
FTP_MIGRATOR_INVALID_OUTPUT_DETAILS = multi_line_message("""
    Error when decoding output: {exception}
    ===============================================================
    stdout of the FTP migrator:
    ===============================================================
    {stdout}
    ===============================================================
    stderr of the FTP migrator:
    ===============================================================
    {stderr}
    ===============================================================
""")
WEB_STREAM_DOWNLOADER_INVALID_OUTPUT = single_line_message("""
    Most probably, files were not copied from the source site: failed to decode output of web stream downloader.
""")
WEB_STREAM_DOWNLOADER_INVALID_OUTPUT_DETAILS = multi_line_message("""
    Error when decoding output: {exception}
    ===============================================================
    stdout of the web stream downloader:
    ===============================================================
    {stdout}
    ===============================================================
    stderr of the web stream downloader:
    ===============================================================
    {stderr}
    ===============================================================
""")
ADJUST_PRESTASHOP_DB_PS_SHOP_DOMAIN = single_line_message("""
    'PS_SHOP_DOMAIN' value was changed to '{domain}' in table '{prefix}configuration'
""")
ADJUST_PRESTASHOP_DB_PS_SHOP_DOMAIN_FAILURE = single_line_message("""
    Failed to change 'PS_SHOP_DOMAIN' value to '{domain}' in table '{prefix}configuration'
""")
ADJUST_PRESTASHOP_DB_PS_SHOP_DOMAIN_SSL = single_line_message("""
    'PS_SHOP_DOMAIN_SSL' value was changed to '{domain}' in table '{prefix}configuration'
""")
ADJUST_PRESTASHOP_DB_PS_SHOP_DOMAIN_SSL_FAILURE = single_line_message("""
    Failed to change 'PS_SHOP_DOMAIN_SSL' to '{domain}' in table '{prefix}configuration'
""")
ADJUST_PRESTASHOP_DB_DOMAIN = single_line_message("""
    'domain' value was changed to '{domain}' in table '{prefix}shop_url'
""")
ADJUST_PRESTASHOP_DB_DOMAIN_FAILURE = single_line_message("""
    Failed to change 'domain' value to '{domain}' in table '{prefix}shop_url'
""")
ADJUST_PRESTASHOP_DB_DOMAIN_SSL = single_line_message("""
    'domain_ssl' value was changed to '{domain}' in table '{prefix}shop_url'
""")
ADJUST_PRESTASHOP_DB_DOMAIN_SSL_FAILURE = single_line_message("""
    Failed to change 'domain_ssl' value to '{domain}' in table '{prefix}shop_url'
""")
ADJUST_PRESTASHOP_DB_PHYSICAL_URI = single_line_message("""
    'physical_uri' value was changed to '{path}' in table '{prefix}shop_url'
""")
ADJUST_PRESTASHOP_DB_PHYSICAL_URI_FAILURE = single_line_message("""
    Failed to change 'physical_uri' value to '{path}' in table '{prefix}shop_url'
""")
ADJUST_MAGENTO_DB_WEB_UNSECURE_BASE_URL = single_line_message("""
    'web/unsecure/base_url' value was changed to '{base_url}' in table '{prefix}core_config_data'
""")
ADJUST_MAGENTO_DB_WEB_UNSECURE_BASE_URL_FAILURE = single_line_message("""
    Failed to change 'web/unsecure/base_url' value to '{base_url}' in table '{prefix}core_config_data'
""")
ADJUST_MAGENTO_DB_WEB_SECURE_BASE_URL = single_line_message("""
    'web/secure/base_url' value was changed to '{base_url}' in table '{prefix}core_config_data'
""")
ADJUST_MAGENTO_DB_WEB_SECURE_BASE_URL_FAILURE = single_line_message("""
    Failed to change 'web/secure/base_url' value to '{base_url}' in table '{prefix}core_config_data'
""")
ADJUST_DRUPAL_DB_TRUNCATE_CACHE = single_line_message("""
    The following tables with cache were truncated: {truncated_tables}
""")
DATABASE_ADJUST_FAILED_INVALID_PREFIX = single_line_message("""
    Failed to adjust database '{database}': database prefix '{prefix}' obtained from application config 
    doesn't match expression '^[A-Za-z0-9_]*$'
""")
LIST_FILES_MODE = single_line_message("""
    List files mode: {list_files_mode}
""")
DIRECTORY_WITH_SUSPICIOUS_ITEMS = single_line_message("""
    Directory '{directory}' has file names which could be retrieved incorrectly with Web RPC agent.
    Retrieve list of directory files with {transport}.
""")
DIRECTORY_WITH_SUSPICIOUS_ITEMS_LIST_ITEMS = single_line_message("""
    List files and directories of '{directory}' by {transport}
""")
DIRECTORY_WITH_SUSPICIOUS_ITEMS_ADD_FILE = single_line_message("""
    Take file with name '{name}' from {transport} listing 
""")
DIRECTORY_WITH_SUSPICIOUS_ITEMS_ADD_DIR = single_line_message("""
    Take directory with name '{name}' from {transport} listing. Retrieve its contents with {transport}.
""")
FAILED_TO_LIST_FILES_WITH_WEB_RPC_AGENT_FALLBACK = single_line_message("""
    Failed to list files with Web RPC agent: {reason}. Try to list files with {transport}.
    Original exception is below.
""")
EMPTY_FILE_LIST_WEB_RPC_AGENT_FALLBACK = single_line_message("""
    Web RPC agent returned empty list of files. Probably it is broken. Try to list files with {transport}.
""")
LOOK_FOR_DATABASES_OF_APPLICATION = single_line_message("""
    Look for databases of {application_description}
""")
SOURCE_PHP_VERSION_DETECTED = single_line_message("""
    PHP version '{php_version}' was detected on source web site
""")
SOURCE_WINDOWS_DETECTED = single_line_message("""
    OS type Windows was detected on source web site
""")
SOURCE_LINUX_DETECTED = single_line_message("""
    OS type Linux was detected on source web site
""")
ACTION_CALC_FOLDER_DATA_SIZE = single_line_message("""
    Calculate migrated files size for statistics
""")
FAILED_ACTION_CALC_FOLDER_DATA_SIZE = single_line_message("""
    Failed to calculate migrated files size for statistics
""")
FAILED_ACTION_CALC_FOLDER_DATA_SIZE_FOR_FOLDER = single_line_message("""
    Failed to calculate migrated files size for statistics in directory: '{target_folder}'
""")
FAILED_CALC_SIZE = single_line_message("""
    Failed to calculate migrated data size for statistics: {error_details}
""")
UNEXPECTED_SESSION_CONTENT = single_line_message("""
    Unexpected session content in file '{file}'. Expected '{expected_type}', got '{got_type}'.
""")
FAILED_READ_SESSION_FILE = single_line_message("""
    Failed to read session file '{file}': {error}
""")
FAILED_ENCODE_DOMAIN_IDNA = single_line_message("""
    Failed to encode domain '{domain}' with 'idna': {error}
""")
NO_RSYNC_OR_SCP_ON_SERVER = single_line_message("""
    Can not use SSH as a transport: no 'rsync' or 'scp' utilities (which are used to copy files) were found
""")
NO_FIND_OR_LS_ON_SERVER = single_line_message("""
    Can not use SSH as a transport: no 'find' or 'ls' utilities (which are used to list files) were found
""")
INTERNAL_ERROR_NO_FTP = single_line_message("""
    Internal error: trying to use FTP connection without its initialization
""")
INTERNAL_ERROR_NO_SSH = single_line_message("""
    Internal error: trying to use SSH connection without its initialization
""")
INTERNAL_ERROR_NO_FILE_TRANSPORT = single_line_message("""
    Internal error: no FTP or SSH transport is available
""")
INTERNAL_ERROR_NO_WEB_RPC_AGENT = single_line_message("""
    Internal error: trying to use Web RPC agent without its initialization
""")
CONNECT_BY_FTP = single_line_message("""
    Connect to the source site by FTP
""")
CONNECT_BY_SSH = single_line_message("""
    Connect to the source site by SSH
""")
TRY_TO_CONNECT_BY_SSH = single_line_message("""
    Try to connect to the source site by SSH
""")
CONNECT_BY_SSH_FAILED = single_line_message("""
    SSH seems to be unavailable for the source site, connect to the site by FTP
""")
CONFIGURE_KEY_SSH_ACCESS = single_line_message("""
    Configure SSH key access to source site
""")
CREATE_TARGET_DIRECTORY = single_line_message("""
    Create directory on the target server
""")
SSH_PRIVATE_KEY_LOCATION = single_line_message("""
    SSH private key located at '{private_key_location}'
""")
PRIVATE_KEY_TO_USER = single_line_message("""
    Make SSH private key available to system user of target site
""")
PRIVATE_KEY_USER_DETAILS = single_line_message("""
    Private key was written to '{private_key_location}' under '{sysuser_login}', only that user could read the file
""")
TRANSFER_FILES = single_line_message("""
    Transfer files with '{method}'
""")
REMOVE_PRIVATE_KEY = single_line_message("""
    Remove SSH private key which was available to system user of target site
""")
NEW_BASE_URL_INVALID_CERTIFICATE = multi_line_message("""
    SSL certificate validation failed for detected base URL '{url}'.
    
    To migrate with low security level (vulnerable, not recommended), certificates validation can be disabled 
    by setting option 'allow-insecure-connections' to 'true' in configuration file:
    allow-insecure-connections = true
    
    To migrate using unsecure HTTP protocol (the most vulnerable, not recommended),
    define base URL with HTTP protocol explicitly in configuration file:
    base-url = "http://mydomain.com/"
""")
NEW_BASE_URL_HTTP_DETECTED = multi_line_message("""
    Failed to detect document root using HTTPS protocol, 
    but document root was detected via HTTP protocol by URL '{url}'.

    To migrate using unsecure HTTP protocol (vulnerable, not recommended),
    define base URL with HTTP protocol explicitly in configuration file:
    base-url = "http://mydomain.com/"
""")
SSHRUNNER_CHANGE_PROBE_FILE_PERMISSIONS_FAILED = single_line_message("""
    Failed to change permissions to the probe file {path}
""")
REMOVE_PROBE_FILE_FAILED = single_line_message("""
    Failed to remove probe file {path}
""")
PANEL_DATABASES = multi_line_message("""
    List of databases on {db_server} registered in Plesk: 
    {databases}
""")
OTHER_DATABASES = multi_line_message("""
    List of databases on {db_server} not registered in Plesk: 
    {databases}
""")
PANEL_DATABASE_USERS = multi_line_message("""
    List of database users on {db_server} registered in Plesk: 
    {database_users}
""")
OTHER_DATABASE_USERS = multi_line_message("""
    List of database users on {db_server} not registered in Plesk: 
    {database_users}
""")
UNKNOWN_TASK_IN_MIGRATION_LIST = multi_line_message("""
    Unknown task '{task}' in migration list. Available tasks: {available_tasks}.
""")
SITE_CHECK_WEB_AVAILABILITY_SIGNATURE_FOUND_ON_SOURCE = multi_line_message("""
    An error message was found on the source server web page and on the target server web page.
    The error message on the source: {source_error_message}
    The error message on the target: {target_error_message}
    The source web page URL: {source_url} 
    The target web page URL: {url}
""")
SITE_CHECK_WEB_AVAILABILITY_WEBSERVER_RETURNED_HTTP_CODE_BOTH = multi_line_message("""
    An HTTP status code 4xx or 5xx is returned by both the {source_server_description} and the {target_server_description}.
    Most probably that could be ignored: the site did not work on the source server,
    and it does not work on the target server.
    
    The HTTP status code: {status_code}
    The target web page URL: {url} 
    The source web page URL: {source_url} 
""")
SITE_CHECK_WEB_AVAILABILITY_DIFFERENT_HTTP_CODE = multi_line_message("""
    The HTTP status code of a web page has changed after the migration.
    The status code returned by the {source_server_description}: {source_status_code}
    The status code returned by the {target_server_description}: {target_status_code}
    The source web page URL: {source_url} 
    The target web page URL: {url}
""")
SITE_CHECK_WEB_AVAILABILITY_TITLE_CHANGED = multi_line_message("""
    The title of a web page has changed after the migration.
    The page title on the source server: {title_source}
    The page title on the target server: {title_target}
    The source web page URL: {source_url}
    The target web page URL: {url}
""")


