tangra logo
   
[ class tree: tangra_lib ] [ index: tangra_lib ] [ all elements ]
 

Class: Tangra_Module_Installer

Source Location: /modules_manager/tangra_module_installer.class.php

Class Tangra_Module_Installer

Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From Tangra_Class

Tangra_Class::get_class_name()
Alias of get_class(). Exist because of historical reasons.
Tangra_Class::__set()
Overides PHP built-in method and just throws exception if called. Purpose - to "forbid" autosetting of nonexisting class properties.

[ Top ]
Property Summary
array   $files   List of installed files and directories
string   $file_group   Usergroup to which intalled files will be chown-ed
integer   $file_permissions   Filepermissions that will be used to chmod installed files to
string   $module_dir   Module source dir
string   $module_name   Name of the module
boolean   $overwrite   Flag for overwrite
boolean   $overwrite_all   Flag for overwrite all
string   $target_dir   Root directory of the site where module will be installed

[ Top ]
Method Summary
Tangra_Module_Installer   __construct()   Constructor
void   add_section_to_conf_file()   Adds new section to conf file
void   add_to_files_list_dir()   Adds dir to files list
void   add_to_files_list_file()   Adds file to files list
void   add_to_files_list_symlink()   Adds symlink to files list
void   change_file_properties()   Changes file permisssions and groups
void   check_params()   Checks if all required parameters are present
void   compile_tpl_file()   Compiles template file and writes the rezult in destination file. Adds full destination path to files list.
void   copy_module_ctrl()   Copies module.ctrl file to modules conf dir
void   copy_static_content_bulk()   Recursive copy of given directory
void   copy_static_file()   Copies file.
void   create_dir()   Creates directory and adds it to files list.
void   create_module_conf_dir()   Creates modules conf dir (hidden/conf/modules)
void   create_module_dir()   Creates module's config dir, i.e. where module.ctrl file will be installed
void   create_sym_link()   Creates symlink and adds it to files list
array   find_start_and_end_of_conf_section()   Find start and end indexes of module's section
unknown   get_files()   Returns installed files list
unknown   get_file_group()   Returns usergroup to which intalled files will be chown-ed
integer   get_file_permissions()   Returns permission that will be used to chmod installed files to
unknown   get_module_dir()   Returns module source dir
string   get_module_name()   Returns module name
boolean   get_overwrite()   Returns overwrite flag
boolean   get_overwrite_all()   Returns overwrite all flag
unknown   get_target_dir()   Gets root directory of the site where module will be installed
void   install()   Actual installation. This method have to be overwrited by inherited clases.
boolean   is_parameter_present()   Checks if parameter is present
void   post_install()   Activities that have to be performed after actual installation have to be placed here.
void   pre_install()   Activities that have to be performed before actual installation have to be placed here.
void   remove_section_from_conf_file()   Removes module section from conf file
void   set_files()   Sets installed files list.
void   set_file_group()   Sets usergroup to which intalled files will be chown-ed
void   set_file_permissions()   Sets permission that will be used to chmod installed files to
void   set_module_dir()   Sets module source dir
void   set_module_name()   Sets module name
void   set_overwrite()   Sets overwrite flag
void   set_overwrite_all()   Sets overwrite all flag
void   set_target_dir()   Sets root directory of the site where module will be installed
void   uninstall()   Deinstallation of the module
void   write_files_list()   Writes installed files list to files.list
void   _add_section_to_conf_file()   Actual adding of section to conf file
void   _compile_tpl_file()   Actual compilation of template file
boolean   _copy_static_file()   Actual copy of file
unknown   _create_sym_link()   Enter description here...

[ Top ]
Properties
array   $files = array() [line 108]

List of installed files and directories

API Tags:
Internal:  
Access:  protected


[ Top ]
string   $file_group = '' [line 129]

Usergroup to which intalled files will be chown-ed

API Tags:
Internal:  
Access:  private


[ Top ]
integer   $file_permissions = '' [line 137]

Filepermissions that will be used to chmod installed files to

API Tags:
Internal:  
Access:  private


[ Top ]
string   $module_dir [line 94]

Module source dir

API Tags:
Internal:  
Access:  private


[ Top ]
string   $module_name [line 87]

Name of the module

API Tags:
Internal:  
Access:  private


[ Top ]
boolean   $overwrite [line 122]

Flag for overwrite

API Tags:
Internal:  
Access:  private


[ Top ]
boolean   $overwrite_all [line 115]

Flag for overwrite all

API Tags:
Internal:  
Access:  private


[ Top ]
string   $target_dir [line 101]

Root directory of the site where module will be installed

API Tags:
Internal:  
Access:  private


[ Top ]
Methods
Constructor __construct  [line 149]

  Tangra_Module_Installer __construct( array $params  )

Constructor

Parameter $params is a structured array that must have at least key 'target-dir'. Other parameters have to be fed as key-value pairs.

Example $params['smarty-dir'] = '/some/path';

Parameters:
array   $params: 


[ Top ]
add_section_to_conf_file  [line 703]

  void add_section_to_conf_file( string $file, string $section_content, [boolean $strict = false]  )

Adds new section to conf file

Parameters:
string   $file:  Path to config file relative to site target dir
string   $section_content:  Content of the section
boolean   $strict:  If true will throw exception if section already exists.

API Tags:
Access:  protected

Information Tags:
Throws:  TE_TMM_Exception

[ Top ]
add_to_files_list_dir  [line 873]

  void add_to_files_list_dir( string $item  )

Adds dir to files list

Parameters:
string   $item:  Full path to the dir

API Tags:
Access:  protected


[ Top ]
add_to_files_list_file  [line 861]

  void add_to_files_list_file( string $item  )

Adds file to files list

Parameters:
string   $item:  Full path to the file

API Tags:
Access:  protected


[ Top ]
add_to_files_list_symlink  [line 884]

  void add_to_files_list_symlink( string $item  )

Adds symlink to files list

Parameters:
string   $item:  Full path to the symlink

API Tags:
Access:  protected


[ Top ]
change_file_properties  [line 827]

  void change_file_properties( )

Changes file permisssions and groups


API Tags:
See:  Tangra_Module_Installer::set_file_permissions(), Tangra_Module_Installer::set_file_group()
Internal:  
Access:  private


[ Top ]
check_params  [line 203]

  void check_params( array $params  )

Checks if all required parameters are present

Parameters:
array   $params: 

API Tags:
Access:  protected

Information Tags:
Throws:  TE_TMM_Exception

[ Top ]
compile_tpl_file  [line 582]

  void compile_tpl_file( Tangra_Simple_Tple $tple, string $file, unknown_type $destination_file, [unknown_type $special_file = false]  )

Compiles template file and writes the rezult in destination file. Adds full destination path to files list.

Parameters:
Tangra_Simple_Tple   $tple:  Template engine object with preassigned values that will be substituted
string   $file:  Temlate file
unknown_type   $destination_file:  Destination file
unknown_type   $special_file:  Flags file that will not be overwrited if just 'overwrite' flag is set. Such files are for example configuration files that you don't want to get overwrited when preinstalling module. If you want to overwrite special files use 'overwrite-all' flag.

API Tags:
Access:  protected

Information Tags:
Throws:  TE_TMM_Exception

[ Top ]
copy_module_ctrl  [line 685]

  void copy_module_ctrl( )

Copies module.ctrl file to modules conf dir


API Tags:
Internal:  
Access:  private

Information Tags:
Throws:  TE_TMM_Exception

[ Top ]
copy_static_content_bulk  [line 393]

  void copy_static_content_bulk( string $source_dir, string $destination_dir, [boolean $is_root = true]  )

Recursive copy of given directory

Parameters:
string   $source_dir:  Source dir
string   $destination_dir:  destination dir
boolean   $is_root:  If false tries to create $destionation_dir if not already exist. If true will copy just the content of $source_dir.

API Tags:
Access:  protected

Information Tags:
Throws:  TE_TMM_Exception

[ Top ]
copy_static_file  [line 492]

  void copy_static_file( string $source_file, string $target_file, [boolean $special_file = false]  )

Copies file.

Parameters:
string   $source_file:  Path to source file relative to module source dir
string   $target_file:  Path to target file relative to site target path
boolean   $special_file:  Flags file that will not be overwrited if just 'overwrite' flag is set. Such files are for example configuration files that you don't want to get overwrited when preinstalling module. If you want to overwrite special files use 'overwrite-all' flag.

API Tags:
Access:  protected

Information Tags:
Throws:  TE_TMM_Exception

[ Top ]
create_dir  [line 563]

  void create_dir( string $dir  )

Creates directory and adds it to files list.

If directory already exists is just added to files list.

Parameters:
string   $dir:  Directory to be created

API Tags:
Access:  protected

Information Tags:
Throws:  TE_TMM_Exception

[ Top ]
create_module_conf_dir  [line 194]

  void create_module_conf_dir( )

Creates modules conf dir (hidden/conf/modules)


API Tags:
Abstract:  
Access:  protected


[ Top ]
create_module_dir  [line 549]

  void create_module_dir( string $modules_conf_dir  )

Creates module's config dir, i.e. where module.ctrl file will be installed

Parameters:
string   $modules_conf_dir: 

API Tags:
Access:  protected


[ Top ]
create_sym_link  [line 633]

  void create_sym_link( string $source_file, string $link_name, [string $alternative_source_for_copy = '']  )

Creates symlink and adds it to files list

Parameters:
string   $source_file:  Source file that symlink will point to
string   $link_name:  Link name
string   $alternative_source_for_copy:  If symlinks are not available (like in Windows), just copy this file instead of creating symlink

API Tags:
Access:  protected

Information Tags:
Throws:  TE_TMM_Exception

[ Top ]
find_start_and_end_of_conf_section  [line 785]

  array find_start_and_end_of_conf_section( array $arr  )

Find start and end indexes of module's section

Parameters:
array   $arr: 

API Tags:
Return:  Structured array 'start' => start index, 'end' => end index
Internal:  
Access:  private


[ Top ]
get_files  [line 454]

  unknown get_files( )

Returns installed files list


API Tags:
Access:  public


[ Top ]
get_file_group  [line 368]

  unknown get_file_group( )

Returns usergroup to which intalled files will be chown-ed


API Tags:
Access:  public


[ Top ]
get_file_permissions  [line 348]

  integer get_file_permissions( )

Returns permission that will be used to chmod installed files to


API Tags:
Access:  public


[ Top ]
get_module_dir  [line 252]

  unknown get_module_dir( )

Returns module source dir


API Tags:
Access:  public


[ Top ]
get_module_name  [line 232]

  string get_module_name( )

Returns module name


API Tags:
Access:  public


[ Top ]
get_overwrite  [line 305]

  boolean get_overwrite( )

Returns overwrite flag


API Tags:
Access:  public


[ Top ]
get_overwrite_all  [line 326]

  boolean get_overwrite_all( )

Returns overwrite all flag


API Tags:
Access: