noalyss Version-9
Public Member Functions
Package_Template Class Reference

Show , download and install template database for accountancy from the Package repository. More...

+ Inheritance diagram for Package_Template:
+ Collaboration diagram for Package_Template:

Public Member Functions

 can_install ()
 
 install ()
 Install the template. More...
 
- Public Member Functions inherited from Package_Noalyss
 __construct ($name, $description, $full_path)
 
 can_download ()
 check that NOALYSS_HOME exists and is writable More...
 
 can_install ()
 
 download ()
 
 get_description ()
 
 get_file ()
 
 get_name ()
 
 get_path ()
 
 install ()
 
 set_description ($description)
 
 set_file ($file)
 
 set_name ($name)
 
 set_path ($path)
 

Detailed Description

Show , download and install template database for accountancy from the Package repository.

Definition at line 34 of file package_template.class.php.

Member Function Documentation

◆ can_install()

Package_Template::can_install ( )

Reimplemented from Package_Noalyss.

Definition at line 37 of file package_template.class.php.

38 {
39 return TRUE;
40 }

◆ install()

Package_Template::install ( )

Install the template.

Reimplemented from Package_Noalyss.

Definition at line 45 of file package_template.class.php.

46 {
47 // make temp dir
48 $tmp=NOALYSS_HOME."/tmp/";
49 $tmpdir=$tmp."db-".microtime(TRUE);
50 mkdir($tmpdir);
51
52 // unzip Archive file
53 $db=new ZipArchive;
54 $db->open($tmp."/".$this->get_file());
55 $db->extractTo($tmpdir);
56
57
58 // create database
59 $cn=new Database();
60 $seq=$cn->get_value("select nextval('s_modid')");
61
62 $sql=sprintf(" create database %smod%d encoding='utf8'", domaine, $seq);
63 $cn->exec_sql($sql);
64
65 $newdb=new Database($seq, 'mod');
66
67 // Execute SQL Script
68 $newdb->execute_script($tmpdir.'/schema.sql');
69 $newdb->execute_script($tmpdir.'/data.sql');
70 $newdb->execute_script($tmpdir.'/constraint.sql');
71
72 // Register into account_repository, we add the seq number for avoiding duplicate
73 $description = sprintf(_("Installé le %s"),date("d-m-Y h:i:s"));
74 $cn->exec_sql(" insert into modeledef (mod_id,mod_name,mod_desc) values ($1,$2,$3)",
75 [$seq,$seq."-".$this->get_name(),$this->get_description()." ".$description]);
76 }
contains the class for connecting to Noalyss
domaine
Definition: install.php:370

References $cn, Package_Noalyss\$description, $seq, $sql, $tmp, and domaine.


The documentation for this class was generated from the following file: