<commit_before># Function for generating proper configuration SQL statements.
#
# @author    <NAME> <<EMAIL>>
# @copyright <NAME>
# @license   MIT (LICENSE.txt)

import "lib/magento.gen_update_config_sql" as "update_config"


function magento.gen_config_sql_statements () {
    # Temporarily change rules and gather all statements.
    local IFS=
    statements=(
        ##
        # General stuff
        ##

        # Replace all email addresses
        "UPDATE core_config_data SET value=CONCAT(SUBSTRING_INDEX(value,'@',1),'@${BASE_DOMAIN}') WHERE value REGEXP '[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}'"

        # Replace URLs
        $(update_config "web/unsecure/base_url" "http://${BASE_DOMAIN}/" default)
        $(update_config "web/unsecure/base_link_url" "{{unsecure_base_url}}" default)
        $(update_config "web/unsecure/base_js_url" "{{unsecure_base_url}}js/" default)
        $(update_config "web/unsecure/base_skin_url" "{{unsecure_base_url}}skin/" default)
        $(update_config "web/unsecure/base_media_url" "{{unsecure_base_url}}media/" default)
        $(update_config "web/secure/base_url" "https://${BASE_DOMAIN}/" default)
        $(update_config "web/secure/base_link_url" "{{secure_base_url}}" default)
        $(update_config "web/secure/base_js_url" "{{secure_base_url}}js/" default)
        $(update_config "web/secure/base_skin_url" "{{secure_base_url}}skin/" default)
        $(update_config "web/secure/base_media_url" "{{secure_base_url}}media/" default)

        # Password lifetime
        $(update_config "admin/security/password_lifetime" "365")
        $(update_config "admin/security/password_is_forced" 0)

        # Logging
        $(update_config "dev/log/active" "1")
        $(update_config "dev/log/file" "system.log")
        $(update_config "dev/log/exception_file" "exception.log")

        # Reset environment
        "delete from core_config_data where path = 'environment';"
        "insert into core_config_data (scope, scope_id, path, value) values ('default', 0, 'environment', concat('unknown | unknown | ', now()));"

        # Reset indexer status
        "UPDATE index_process SET status='pending';"

        # Reset admin user passwords
        "UPDATE admin_user SET password=md5('${MP_ANON_ADMIN_PASSWORD}');"

        ##<commit_msg>Added clearing of the allow_ips config var when generating config sql statements.<commit_after># Function for generating proper configuration SQL statements.
#
# @author    <NAME> <<EMAIL>>
# @copyright <NAME>
# @license   MIT (LICENSE.txt)

import "lib/magento.gen_update_config_sql" as "update_config"


function magento.gen_config_sql_statements () {
    # Temporarily change rules and gather all statements.
    local IFS=
    statements=(
        ##
        # General stuff
        ##

        # Replace all email addresses
        "UPDATE core_config_data SET value=CONCAT(SUBSTRING_INDEX(value,'@',1),'@${BASE_DOMAIN}') WHERE value REGEXP '[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}'"

        # Replace URLs
        $(update_config "web/unsecure/base_url" "http://${BASE_DOMAIN}/" default)
        $(update_config "web/unsecure/base_link_url" "{{unsecure_base_url}}" default)
        $(update_config "web/unsecure/base_js_url" "{{unsecure_base_url}}js/" default)
        $(update_config "web/unsecure/base_skin_url" "{{unsecure_base_url}}skin/" default)
        $(update_config "web/unsecure/base_media_url" "{{unsecure_base_url}}media/" default)
        $(update_config "web/secure/base_url" "https://${BASE_DOMAIN}/" default)
        $(update_config "web/secure/base_link_url" "{{secure_base_url}}" default)
        $(update_config "web/secure/base_js_url" "{{secure_base_url}}js/" default)
        $(update_config "web/secure/base_skin_url" "{{secure_base_url}}skin/" default)
        $(update_config "web/secure/base_media_url" "{{secure_base_url}}media/" default)

        # Password lifetime
        $(update_config "admin/security/password_lifetime" "365")
        $(update_config "admin/security/password_is_forced" 0)

        # Logging
        $(update_config "dev/log/active" "1")
        $(update_config "dev/log/file" "system.log")
        $(update_config "dev/log/exception_file" "exception.log")

        # Reset environment
        "delete from core_config_data where path = 'environment';"
        "insert into core_config_data (scope, scope_id, path, value) values ('default', 0, 'environment', concat('unknown | unknown | ', now()));"
        $(update_config "dev/restrict/allow_ips" "")

        # Reset indexer status
        "UPDATE index_process SET status='pending';"

        # Reset admin user passwords
        "UPDATE admin_user SET password=md5('${MP_ANON_ADMIN_PASSWORD}');"

        ##
{'fraction_non_alphanumeric': 0.14367450731087095, 'fraction_numerical': 0.005933460478915025, 'mean_word_length': 3.5914396887159534, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '398979', 'n_tokens_mistral': 1509, 'n_tokens_neox': 1470, 'n_words': 299}