apm::package_version::attributes::set_all_instances_names (private)

 apm::package_version::attributes::set_all_instances_names

Defined in packages/acs-tcl/tcl/apm-install-procs.tcl

Set all names of the instances for those packages that have the attribute package_instance_name. After running this script you must restart your installation.

Partial Call Graph (max 5 caller/called nodes):
%3 ad_conn ad_conn (public) apm::package_version::attributes::get_instance_name apm::package_version::attributes::get_instance_name (private) apm_package_info_file_path apm_package_info_file_path (public) apm_read_package_info_file apm_read_package_info_file (public) db_dml db_dml (public) apm::package_version::attributes::set_all_instances_names apm::package_version::attributes::set_all_instances_names apm::package_version::attributes::set_all_instances_names->ad_conn apm::package_version::attributes::set_all_instances_names->apm::package_version::attributes::get_instance_name apm::package_version::attributes::set_all_instances_names->apm_package_info_file_path apm::package_version::attributes::set_all_instances_names->apm_read_package_info_file apm::package_version::attributes::set_all_instances_names->db_dml

Testcases:
No testcase defined.
Source code:
    # packages list
    db_foreach get_packages_keys {
        select package_key
        from apm_enabled_package_versions
    } {
        # Getting the instance name
        set package_instance_name [apm::package_version::attributes::get_instance_name $package_key]

        # Getting package_name
        set path [apm_package_info_file_path $package_key]
        array set version_properties [apm_read_package_info_file $path]
        set package_name $version_properties(package-name)

        # Getting instances name
        db_foreach get_instances_names {
            select instance_name
            from apm_packages
            where package_key = :package_key
        } {
            # Removing the character "#".
            regsub -all -- {[\#]*} $instance_name {\1} instance_name

            # Verifying whether this instance_name is a message_key
            set is_msg [lang::message::message_exists_p [ad_conn locale] $instance_name]
            if {$package_name eq $instance_name && $is_msg eq 0} {
                if { $package_instance_name ne ""} {
                    # Updating the names of the instances for this package_key
                    db_transaction {
                        db_dml app_rename {
                            update apm_packages
                            set instance_name = :package_instance_name
                            where package_key = :package_key
                        }
                    }
                }
            }
        }
    }
Generic XQL file:
packages/acs-tcl/tcl/apm-install-procs.xql

PostgreSQL XQL file:
packages/acs-tcl/tcl/apm-install-procs-postgresql.xql

Oracle XQL file:
packages/acs-tcl/tcl/apm-install-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: