[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r674 - trunk/skel/include
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r674 - trunk/skel/include |
Date: |
Fri, 31 Jan 2014 23:27:43 +0100 (CET) |
Author: danydb
Date: 2014-01-31 23:27:43 +0100 (Fri, 31 Jan 2014)
New Revision: 674
Modified:
trunk/skel/include/class_install_plugin.php
Log:
update skeleton
Modified: trunk/skel/include/class_install_plugin.php
===================================================================
--- trunk/skel/include/class_install_plugin.php 2014-01-31 19:36:41 UTC (rev
673)
+++ trunk/skel/include/class_install_plugin.php 2014-01-31 22:27:43 UTC (rev
674)
@@ -21,63 +21,37 @@
// Copyright Author Dany De Bontridder address@hidden
-/**\file
- * \brief this class manages the installation and the patch of the plugin
- replace SKEL by the plugin schema
+/**
+ * @file
+ * @brief install the ... (SKEL plugin)
+ *
*/
-
-class Install_Plugin
+class SKEL_Install
{
- function __construct($p_cn)
- {
- $this->cn = $p_cn;
- }
+ function __construct($cn)
+ {
+ $this->db = $cn;
+ }
- /**
- * @brief install the plugin, create all the needed schema, tables, proc
- * in the database
- * @param $p_dossier is the dossier id
- */
- function install()
- {
- $this->cn->start();
- // create the schema
- $this->create_schema();
- // create table + put default values
- $this->create_table_parameter();
- $this->cn->commit();
- }
+ function install()
+ {
+ $file = dirname(__FILE__);
+ $this->db->execute_script($file . '/../sql/install.sql');
+ }
- function create_schema()
- {
- $this->cn->exec_sql('create schema SKEL');
- }
+ function upgrade($p_version)
+ {
+ global $cn;
+ $cur_version = $cn->get_value('select max(version_id) from
skel.version');
+ $cur_version++;
+ $file = dirname(__FILE__);
+ for ($e = $cur_version; $e <= $p_version; $e++)
+ {
+ $this->db->execute_script($file . '/../sql/upgrade' . $e . '.sql');
+ }
+ }
- function create_table_parameter()
- {
- $sql = <<<EOF
-CREATE TABLE SKEL.parameter
-(
- pr_id text NOT NULL,
- pr_value text,
- CONSTRAINT SKEL_parameter_pkey PRIMARY KEY (pr_id)
- );
-EOF;
- $this->cn->exec_sql($sql);
-// load default value
- $array = array(
- 'GRIL00' => array('6'),
- 'GRIL01' => array('3'),
- 'GRIL02' => array('2', ''),
-
- );
-
- foreach ($array as $code => $value)
- {
- $this->cn->exec_sql('insert into
SKEL.parameter(pr_id,pr_value,pr_other) values ($1,$2)', array($code,
$value[0]));
- }
- }
-
}
+?>
---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r674 - trunk/skel/include,
phpcompta-dev <=