- Publicity: Public Only All
30-apm-load-procs.tcl
Routines needed by the bootstrapper to load package code.
- Location:
- packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl
- Created:
- 26 May 2000
- Author:
- Jon Salz [jsalz@arsdigita.com]
- CVS Identification:
$Id: 30-apm-load-procs.tcl,v 1.52 2024/09/11 06:15:47 gustafn Exp $
Procedures in this file
- ad_after_server_initialization (public)
- apm_backup_file_p (private)
- apm_bootstrap_load_file (private)
- apm_bootstrap_load_libraries (private)
- apm_bootstrap_upgrade (public)
- apm_first_time_loading_p (public)
- apm_get_package_files (public)
- apm_guess_db_type (public)
- apm_guess_file_type (public)
- apm_ignore_file_p (public)
- apm_include_data_model_file_p (private)
- apm_include_file_p (private)
- apm_install_xml_file_path (private)
- apm_is_catalog_file (public)
- apm_load_install_xml_file (private)
- apm_package_supports_rdbms_p (public)
- apm_parse_catalog_path (public)
- apm_source (public)
Detailed information
ad_after_server_initialization (public)
ad_after_server_initialization name [ args... ]
Registers code to run after server initialization is complete.
- Parameters:
- name (required)
- a human-readable name for the code block (for debugging purposes).
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- ad_after_server_initialization
apm_backup_file_p (private)
apm_backup_file_p path
Returns 1 if $path is a backup file, or 0 if not. We consider it a backup file if any of the following apply:
- its name begins with
#
- its name is
bak
- its name begins with
bak
and one or more non-alphanumeric characters- its name ends with
.old
,.bak
, or~
- Parameters:
- path (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_bootstrap_load_file (private)
apm_bootstrap_load_file root_directory file [ errorVarName ]
Source a single file during initial bootstrapping and set APM data.
- Parameters:
- root_directory (required)
- file (required)
- errorVarName (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_bootstrap_load_libraries (private)
apm_bootstrap_load_libraries [ -load_tests ] [ -init ] [ -procs ] \ package_key [ errorVarName ]
Scan all the files in the "tcl" dir of the package and load those asked for by the init and procs flags. This proc is an analog of apm_load_libraries. In addition though this proc sets apm_first_time_loading_p variable.
- Switches:
- -load_tests (optional, boolean, defaults to
"0"
)- -init (optional, boolean)
- Load initialization files
- -procs (optional, boolean)
- Load the proc library files
- Parameters:
- package_key (required)
- The package to load (normally acs-tcl)
- errorVarName (optional)
- Authors:
- Don Baccus <dhogaza@pacifier.com>
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_bootstrap_upgrade (public)
apm_bootstrap_upgrade -from_version_name from_version_name \ -to_version_name to_version_name
Copy the files from acs-bootstrap-installer/installer/tcl to the Tcl files in the acs root directory. This makes it possible to incorporate changes to these files by only updating the acs-bootstrap-installer package (rather than a full tar file install as in earlier versions). Caveat: don't modify these files in your local installation, adding extra files to $::acs::rootdir/tcl is fine.
- Switches:
- -from_version_name (required)
- -to_version_name (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- apm_bootstrap_upgrade
apm_first_time_loading_p (public)
apm_first_time_loading_p
Returns 1 if this is a -procs.tcl file's first time loading, or 0 otherwise.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- apm_first_time_loading_p
apm_get_package_files (public)
apm_get_package_files [ -include_data_model_files ] [ -all ] \ [ -all_db_types ] -package_key package_key \ [ -package_path package_path ] [ -file_types file_types ]
Returns all files, or files of a certain types, belonging to an APM package. Ignores files based on proc apm_include_file_p and determines file type of files with proc apm_guess_file_type. Only returns file with no db type or a db type matching that of the system, unless '-all' is specified.
Goes directly to the filesystem to find files instead of using a file listing in the package info file or the database.
- Switches:
- -include_data_model_files (optional, boolean)
- -all (optional, boolean)
- When specified, return all files in the package, regardless of their file or database type.
- -all_db_types (optional, boolean)
- -package_key (required)
- The key of the package to return file paths for
- -package_path (optional)
- The full path of the root directory of the package. Defaults to acs_package_root_dir.
- -file_types (optional)
- The type of files to return. If not provided files of all types recognized by the APM are returned.
- Returns:
- The paths, relative to the root dir of the package, of matching files.
- Author:
- Peter Marklund
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- get_package_files, apm_tarballs, files__tcl_file_syntax_errors, files__check_upgrade_ordering, files__check_xql_files, files__trailing_whitespace, files__page_contracts
apm_guess_db_type (public)
apm_guess_db_type package_key path
Guesses and returns the database type key corresponding to a particular path (or an empty string if none is known).
$path
should be relative to the package directory (e.g.,www/index.tcl
for/packages/bboard/admin-www/index.tcl
). We consider two cases: 1. Data model files. If the path contains a string matching "sql/" followed by a database type known to this version of OpenACS, the file is assumed to be specific to that database type. The empty string is returned for all other data model files. Example: "sql/postgresql/apm-create.sql" is assumed to be the PostgreSQL-specific file used to create the APM datamodel. If the path contains a string matching "sql/common" the file is assumed to be compatible with all supported RDBMS's and a blank db_type is returned. Otherwise "oracle" is returned. This is a hardwired kludge to allow us to handle legacy ACS 4 packages. 2. Other files. If it is a .tcl, .xql, or .sqlj file not under the "sql" dir and whose name ends in a dash and database type, the file is assumed to be specific to that database type. Example: "tcl/10-database-postgresql-proc.tcl" is assumed to be the file that defines the PostgreSQL-specific portions of the database API.
- Parameters:
- package_key (required)
- path (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- files__check_upgrade_ordering
apm_guess_file_type (public)
apm_guess_file_type package_key path
Guesses and returns the file type key corresponding to a particular path (or an empty string if none is known).
$path
should be relative to the package directory (e.g.,www/index.tcl
) for/packages/bboard/admin-www/index.tcl
. We use the following rules:Rules are applied in this order (stopping with the first match).
- Files with extension
.sql
are considered data-model files,- Files with extension
.dat
are considered SQL data files.- Files with extension
.ctl
are considered sql data loader control files. or if any path contains the substringupgrade
, data-model upgrade files.- Files with extension
.sqlj
are considered sqlj_code files.- Files with extension
.info
are considered package specification files.- Files with extension
.xql
are considered query files.- Files with extension
.java
are considered java code files.- Files with extension
.jar
are considered java archive files.- Files with a path component named
doc
are considered documentation files.- Files with extension
.pl
or.sh
or which have a path component namedbin
, are considered shell-executable files.- Files with a path component named
templates
are considered template files.- Files with extension
.html
or.adp
, in the top level of the package, are considered documentation files.- Files with a path component named
www
oradmin-www
are considered content-page files.- Files with a path component named
lib
are considered include_page files.- Files under package-key/tcl ending in
-procs(-)+()*.tcl)
or-init.tcl
are considered Tcl procedure or Tcl initialization files, respectively.- File ending in
.tcl
are considered Tcl utility script files (normally found only in the bootstrap installer).- Files with extension
.xml
in the directory catalog are considered message catalog files.- Tcl procs or init files under package-key/tcl in a test directory are of type test_procs and test_init respectively.
- Parameters:
- package_key (required)
- path (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- apm_guess_file_type
apm_ignore_file_p (public)
apm_ignore_file_p [ -data_model_files ] path
Return 1 if $path should, in general, be ignored for package operations. Currently, a file is ignored if it is a backup file or a CVS directory.
- Switches:
- -data_model_files (optional, boolean)
- Parameters:
- path (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- files__page_contracts
apm_include_data_model_file_p (private)
apm_include_data_model_file_p filename
Check if the APM should consider a file found by ad_find_all_files. Files for which apm_ignore_file_p returns true will be ignored. Backup files are ignored.
- Parameters:
- filename (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_include_file_p (private)
apm_include_file_p filename
Check if the APM should consider a file found by ad_find_all_files. Files for which apm_ignore_file_p returns true will be ignored. Backup files and SQL scripts (including the ones in upgrade directory) are ignored.
- Parameters:
- filename (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_install_xml_file_path (private)
apm_install_xml_file_path
Get the path of the install.xml file.
- Author:
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_is_catalog_file (public)
apm_is_catalog_file file_path
Given a file path return 1 if the path represents a message catalog file and 0 otherwise.
- Parameters:
- file_path (required)
- Should be absolute or relative to OpenACS /packages dir or one of its parent dirs.
- Author:
- Peter Marklund
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- apm_guess_file_type
apm_load_install_xml_file (private)
apm_load_install_xml_file
Loads any install.xml file and returns the root node. Returns the empty string if there is no install.xml file.
- Author:
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
apm_package_supports_rdbms_p (public)
apm_package_supports_rdbms_p -package_key package_key
Returns 1 if the given package supports the rdbms of the system and 0 otherwise. The package is considered to support the given rdbms if there is at least one file in the package of matching db_type, or if there are no files in the package of a certain db type.
- Switches:
- -package_key (required)
- Author:
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- apm_package_supports_rdbms_p
apm_parse_catalog_path (public)
apm_parse_catalog_path file_path
Given the path of a file attempt to extract package_key, prefix, charset and locale information from the path assuming the path is on valid format for a message catalog file. If the parsing fails then the file is not considered a catalog file and the empty list is returned.
- Parameters:
- file_path (required)
- Path of file, relative to the OpenACS /packages dir, one of its parent directories, or absolute path.
- Author:
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- apm_parse_catalog_path
apm_source (public)
apm_source __file [ errorVarName ]
Sources $__file in a clean environment, returning 1 if successful or 0 if not. Records that the file has been sourced and stores its mtime in the nsv array apm_library_mtime
- Parameters:
- __file (required)
- errorVarName (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- apm_source