function prepareDataForTpl($instance = "")
 {
     $data = array();
     $data = parent::prepareDataForTpl($instance);
     //add data specific
     return $data;
 }
 function prepareDataForTpl($instance = "")
 {
     $data = array();
     $data = parent::prepareDataForTpl($instance);
     //add data specific
     //tablenom et classnom construct
     $tablenom = strtolower($data['confgenerator']['instancecour']['name']);
     $classnom = ucfirst($tablenom);
     $data['tablenom'] = $tablenom;
     $data['classnom'] = $classnom;
     //sqltype construct per column
     if (isset($data['confgenerator']['instancecour']['columns']['column'])) {
         if (isset($data['confgenerator']['instancecour']['columns']['column'][0])) {
             foreach ($data['confgenerator']['instancecour']['columns']['column'] as $idcolumn => $columncour) {
                 $sqltypecour = $this->typeToSqltype($columncour['type']);
                 $data['confgenerator']['instancecour']['columns']['column'][$idcolumn]['sqltype'] = $sqltypecour;
             }
         } else {
             $sqltypecour = $this->typeToSqltype($data['confgenerator']['instancecour']['columns']['column']['type']);
             $data['confgenerator']['instancecour']['columns']['column']['sqltype'] = $sqltypecour;
         }
     }
     if (isset($data['confgenerator']['instances'])) {
         foreach ($data['confgenerator']['instances'] as $idinstance => $instancecour) {
             if (isset($instancecour['columns']['column'])) {
                 if (isset($instancecour['columns']['column'][0])) {
                     foreach ($instancecour['columns']['column'] as $idcolumn => $columncour) {
                         $sqltypecour = $this->typeToSqltype($columncour['type']);
                         $data['confgenerator']['instances'][$idinstance]['columns']['column'][$idcolumn]['sqltype'] = $sqltypecour;
                     }
                 } else {
                     $sqltypecour = $this->typeToSqltype($instancecour['columns']['column']['type']);
                     $data['confgenerator']['instances'][$idinstance]['columns']['column']['sqltype'] = $sqltypecour;
                 }
             }
         }
     }
     return $data;
 }
Exemplo n.º 3
0
 function update($packagecodename = "example")
 {
     //conflict init
     if ($this->conflictresolution != null && !is_dir($this->conflictfolder)) {
         mkdir($this->conflictfolder, 0777, true);
     }
     //update package
     $this->initer['update'] = "update";
     $this->initer['packagecodename'] = $packagecodename;
     $classpackagename = "";
     $tabclassname = explode(".", $packagecodename);
     foreach ($tabclassname as $classnamecour) {
         $classpackagename .= ucfirst(strtolower($classnamecour));
     }
     if (file_exists("package/" . $packagecodename)) {
         //tab deployed files
         $tabdeployedfiles = array();
         //include descripter
         $this->initer['descripter'] = array();
         if (file_exists("package/" . $packagecodename . "/package.descripter.php")) {
             include "package/" . $packagecodename . "/package.descripter.php";
         }
         if (isset($descripter)) {
             $this->initer['descripter'] = $descripter;
         }
         //check if you keep old conf
         if (isset($this->initer['descripter']['update']['keepconfstatic']) && $this->initer['descripter']['update']['keepconfstatic']) {
             if (file_exists("package/" . $packagecodename . "/conf.static.xml")) {
                 unlink("package/" . $packagecodename . "/conf.static.xml");
             }
             rename($this->folderdestarchives . $packagecodename . ".conf.static.xml", "package/" . $packagecodename . "/conf.static.xml");
         }
         if (file_exists($this->folderdestarchives . $packagecodename . ".conf.static.xml")) {
             unlink($this->folderdestarchives . $packagecodename . ".conf.static.xml");
         }
         //load conf package
         $confstatic = null;
         if (file_exists("package/" . $packagecodename . "/conf.static.xml")) {
             $confstatic = simplexml_load_file("package/" . $packagecodename . "/conf.static.xml");
         }
         $this->initer['confstatic'] = $confstatic;
         //load conf form package
         if (isset($_POST['confform'][$packagecodename])) {
             $this->initer['confform'][$packagecodename] = $_POST['confform'][$packagecodename];
         }
         if (isset($_SESSION['confform'][$packagecodename])) {
             $this->initer['confform'][$packagecodename] = $_SESSION['confform'][$packagecodename];
         }
         //reload initer
         $this->reloadIniter();
         //include predeployer static
         if (file_exists("package/" . $packagecodename . "/class/class.static.php")) {
             include "package/" . $packagecodename . "/class/class.static.php";
             eval("\$instanceStatic=new " . $classpackagename . "Static(\$this->initer);");
         }
         if (file_exists("package/" . $packagecodename . "/static/static.predeployer.php")) {
             include "package/" . $packagecodename . "/static/static.predeployer.php";
         }
         //reload initer
         $this->reloadIniter();
         //db static upload
         $filesizeoldsql = 0;
         $filesizenewsql = 0;
         if (file_exists($this->folderdestarchives . $packagecodename . ".static.db.deployer.sql")) {
             $filesizeoldsql = filesize($this->folderdestarchives . $packagecodename . ".static.db.deployer.sql");
             $filesizenewsql = filesize("package/" . $packagecodename . "/static/static.db.deployer.sql");
             unlink($this->folderdestarchives . $packagecodename . ".static.db.deployer.sql");
         }
         if ($filesizeoldsql != $filesizenewsql) {
             //kill db static
             $sqltype = $this->getExtSql();
             if (isset($this->db) && $this->db && file_exists("package/" . $packagecodename . "/static/static.db.destroyer." . $sqltype)) {
                 //start dump
                 $dumper = null;
                 if (class_exists("PratikDump") || isset($this->includer) && $this->includer->include_pratikclass("Dump")) {
                     $dumpname = "dump." . $packagecodename . "___static";
                     $instanceDump = new PratikDump($this->initer, $dumpname);
                     $dumper = $instanceDump->dumpselected;
                     $dumper->startDump();
                 }
                 //get sql file
                 $sqltoload = file_get_contents("package/" . $packagecodename . "/static/static.db.destroyer." . $sqltype);
                 $tabsqltoload = explode(";", $sqltoload);
                 foreach ($tabsqltoload as $sqlcour) {
                     //fill dump for the tables of this sql line (cas drop table)
                     if ($dumper) {
                         $tabtabletokill = $this->checkDropTable($sqlcour);
                         foreach ($tabtabletokill as $tablecour) {
                             $dumper->getTableData($tablecour, false);
                         }
                     }
                     //exec sql line
                     $req = $this->db->query($sqlcour);
                 }
                 //end dump
                 if ($dumper) {
                     $dumper->endDump();
                 }
             }
             //load db static
             $sqltype = $this->getExtSql();
             $chemin_db_static = "package/" . $packagecodename . "/static/static.db.deployer." . $sqltype;
             if (isset($this->db) && $this->db && file_exists($chemin_db_static)) {
                 //sql exec
                 $sqltoload = file_get_contents($chemin_db_static);
                 $tabsqltoload = explode(";", $sqltoload);
                 foreach ($tabsqltoload as $sqlcour) {
                     $req = $this->db->query($sqlcour);
                 }
                 //filename creation
                 $namefilecour = str_replace("package/" . $packagecodename . "/static/", "core/files/db/" . $packagecodename . ".", $chemin_db_static);
                 //conflict resolution "reverse" mode
                 if ($this->conflictresolution != null) {
                     //only if new file
                     if (!file_exists($namefilecour)) {
                         //setup annuaire files in package
                         $this->addToFileIsInPackageFile($packagecodename, $namefilecour);
                         //replace original file
                         file_put_contents($namefilecour, $sqltoload);
                     } else {
                         //find existing conflict
                         $conflictnamefilecour = str_replace("core/files/db/", "core/files/db/___CONFLICTFILE1___", $namefilecour);
                         $conflictfilefound = "";
                         if (file_exists($this->conflictfolder . "/" . $conflictnamefilecour)) {
                             $cptconflict = "1";
                             while (file_exists($this->conflictfolder . "/" . $conflictnamefilecour)) {
                                 include $this->conflictfolder . "/conflict.php";
                                 $tabid = str_replace("/", "-----", $conflictnamefilecour);
                                 if (isset($tabconflict[$tabid]) && $tabconflict[$tabid] == $packagecodename) {
                                     $conflictfilefound = $conflictnamefilecour;
                                     break;
                                 }
                                 $conflictnamefilecour = str_replace("core/files/db/", "core/files/db/___CONFLICTFILE" . $cptconflict++ . "___", $namefilecour);
                             }
                         }
                         //if conflict found
                         if (file_exists($conflictfilefound)) {
                             //if conflict exists, replace only conflict file
                             if (!is_dir($this->conflictfolder . "/core/files/db")) {
                                 mkdir($this->conflictfolder . "/core/files/db", 0777, true);
                             }
                             copy($namefilecour, $this->conflictfolder . "/" . $conflictnamefilecour);
                         } else {
                             //replace original file
                             file_put_contents($namefilecour, $sqltoload);
                         }
                     }
                 } else {
                     //create file
                     file_put_contents($namefilecour, $sqltoload);
                 }
                 //return tab
                 $tabdeployedfiles[] = $namefilecour;
             }
             //recup dump with import
             $dumper = null;
             if (class_exists("PratikDump") || isset($this->includer) && $this->includer->include_pratikclass("Dump")) {
                 $dumpname = "dump." . $packagecodename . "___static";
                 $instanceDump = new PratikDump($this->initer, $dumpname);
                 $packagelastdumptoload = $instanceDump->getLastDump($dumpname);
                 if ($packagelastdumptoload != "") {
                     //load dump
                     $dumper = $instanceDump->dumpselected;
                     $dumper->importDump($packagelastdumptoload);
                 }
             }
         }
         //load files static
         foreach ($this->initer['chaintab'] as $chaincour) {
             $tabfilestoload = $this->loader->charg_dossier_dans_tab("package/" . $packagecodename . "/static/" . $chaincour);
             if (isset($tabfilestoload)) {
                 foreach ($tabfilestoload as $filecour) {
                     $folder = substr($filecour, 0, strrpos($filecour, "/"));
                     $file = substr($filecour, strrpos($filecour, "/"), strlen($filecour) - 0 - strrpos($filecour, "/"));
                     if ($folder == "package/" . $packagecodename . "/static/" . $chaincour) {
                         continue;
                     }
                     $folder = str_replace("package/" . $packagecodename . "/static/" . $chaincour . "/", "", $folder);
                     if (!is_dir($folder)) {
                         mkdir($folder, 0777, true);
                     }
                     //conflict resolution "reverse" mode
                     if ($this->conflictresolution != null) {
                         //only if new file
                         if (!file_exists($folder . $file)) {
                             //setup annuaire files in package
                             $this->addToFileIsInPackageFile($packagecodename, $folder . $file);
                             //replace original file
                             copy($filecour, $folder . $file);
                         } else {
                             //find existing conflict
                             $conflictnamefilecour = "/___CONFLICTFILE1___" . substr($file, 1);
                             $conflictfilefound = "";
                             if (file_exists($this->conflictfolder . "/" . $folder . $conflictnamefilecour)) {
                                 $cptconflict = "1";
                                 while (file_exists($this->conflictfolder . "/" . $folder . $conflictnamefilecour)) {
                                     include $this->conflictfolder . "/conflict.php";
                                     $tabid = str_replace("/", "-----", $folder . $conflictnamefilecour);
                                     if (isset($tabconflict[$tabid]) && $tabconflict[$tabid] == $packagecodename) {
                                         $conflictfilefound = $conflictnamefilecour;
                                         break;
                                     }
                                     $conflictnamefilecour = "/___CONFLICTFILE" . $cptconflict++ . "___" . substr($file, 1);
                                 }
                             }
                             //if conflict found
                             if (file_exists($conflictfilefound)) {
                                 //if conflict exists, replace only conflict file
                                 if (!is_dir($this->conflictfolder . "/" . $folder)) {
                                     mkdir($this->conflictfolder . "/" . $folder, 0777, true);
                                 }
                                 copy($folder . $file, $this->conflictfolder . "/" . $folder . $conflictnamefilecour);
                             } else {
                                 //replace original file
                                 copy($filecour, $folder . $file);
                             }
                         }
                     } else {
                         //file create
                         copy($filecour, $folder . $file);
                     }
                     //return tab
                     $tabdeployedfiles[] = $folder . $file;
                 }
             }
         }
         //include postdeployer static
         if (file_exists("package/" . $packagecodename . "/static/static.postdeployer.php")) {
             include "package/" . $packagecodename . "/static/static.postdeployer.php";
         }
         //reload initer
         $this->reloadIniter();
         //check if you keep old conf
         if (isset($this->initer['descripter']['update']['keepconfgenerator']) && $this->initer['descripter']['update']['keepconfgenerator']) {
             if (file_exists("package/" . $packagecodename . "/conf.generator.xml")) {
                 unlink("package/" . $packagecodename . "/conf.generator.xml");
             }
             rename($this->folderdestarchives . $packagecodename . ".conf.generator.xml", "package/" . $packagecodename . "/conf.generator.xml");
         }
         //load conf package generator
         $confgenerator = null;
         if (file_exists("package/" . $packagecodename . "/conf.generator.xml")) {
             $confgenerator = simplexml_load_file("package/" . $packagecodename . "/conf.generator.xml");
         }
         $this->initer['confgenerator'] = $confgenerator;
         //reload initer
         $this->reloadIniter();
         //include predeployer generator
         $instanceGenerator = new PackageGenerator($this->initer);
         if (file_exists("package/" . $packagecodename . "/class/class.generator.php")) {
             include "package/" . $packagecodename . "/class/class.generator.php";
             eval("\$instanceGenerator=new " . $classpackagename . "Generator(\$this->initer);");
         }
         if (file_exists("package/" . $packagecodename . "/generator/generator.predeployer.php")) {
             include "package/" . $packagecodename . "/generator/generator.predeployer.php";
         }
         //reload initer
         $this->reloadIniter();
         //db generator upload
         $filesizeoldsql = 0;
         $filesizenewsql = 0;
         if (file_exists($this->folderdestarchives . $packagecodename . ".conf.generator.xml")) {
             $filesizeoldsql = filesize($this->folderdestarchives . $packagecodename . ".conf.generator.xml");
             $filesizenewsql = filesize("package/" . $packagecodename . "/conf.generator.xml");
             unlink($this->folderdestarchives . $packagecodename . ".conf.generator.xml");
         }
         if (file_exists($this->folderdestarchives . $packagecodename . ".generator.db.deployer.__INSTANCE__.sql.tpl")) {
             if ($filesizeoldsql == $filesizenewsql) {
                 $filesizeoldsql = filesize($this->folderdestarchives . $packagecodename . ".generator.db.deployer.__INSTANCE__.sql.tpl");
                 $filesizenewsql = filesize("package/" . $packagecodename . "/generator/generator.db.deployer.__INSTANCE__.sql.tpl");
             }
             unlink($this->folderdestarchives . $packagecodename . ".generator.db.deployer.__INSTANCE__.sql.tpl");
         }
         if ($filesizeoldsql != $filesizenewsql) {
             //kill db generator
             $sqltype = $this->getExtSql();
             $chemin_db_generator_tpl = "package/" . $packagecodename . "/generator/generator.db.destroyer.__INSTANCE__." . $sqltype . ".tpl";
             if (isset($this->db) && $this->db && file_exists($chemin_db_generator_tpl)) {
                 //start dump
                 $dumper = null;
                 if (class_exists("PratikDump") || isset($this->includer) && $this->includer->include_pratikclass("Dump")) {
                     $dumpname = "dump." . $packagecodename . "___generator";
                     $instanceDump = new PratikDump($this->initer, $dumpname);
                     $dumper = $instanceDump->dumpselected;
                     $dumper->startDump();
                 }
                 //pour chaque instance à générer
                 foreach ($confgenerator->instance as $instance) {
                     //generate sql
                     $instanceTpl = new Tp($this->conf, $this->log, "backoffice");
                     $tpl = $instanceTpl->tpselected;
                     //include generator conf tpl
                     $tabgeneratorconftpl = $this->loader->charg_generatorconftpl_dans_tab("package/" . $packagecodename . "/generator");
                     $tpl->remplir_template("generatorconf", $tabgeneratorconftpl);
                     //include generator file cour
                     $tpl->remplir_template("chemintpltogenerate", $chemin_db_generator_tpl);
                     //preparedatafortpl
                     $datafortpl = array();
                     if (isset($instanceGenerator)) {
                         $datafortpl = $instanceGenerator->prepareDataForTpl($instance);
                     }
                     foreach ($datafortpl as $iddatafortpl => $contentdatafortpl) {
                         $tpl->remplir_template($iddatafortpl, $contentdatafortpl);
                     }
                     //generate file with tpl
                     $contentfilecour = $tpl->get_template($this->chemingeneratortpl);
                     $namefilecour = str_replace("__INSTANCE__", $instance->name, $chemin_db_generator_tpl);
                     $namefilecour = substr($namefilecour, 0, -4);
                     file_put_contents($namefilecour, $contentfilecour);
                     //load db
                     $sqltoload = file_get_contents($namefilecour);
                     $tabsqltoload = explode(";", $sqltoload);
                     foreach ($tabsqltoload as $sqlcour) {
                         //prepare dump for this sql line (cas drop table)
                         if ($dumper) {
                             $tabtabletokill = $this->checkDropTable($sqlcour);
                             foreach ($tabtabletokill as $tablecour) {
                                 $dumper->getTableData($tablecour, false);
                             }
                         }
                         //exec sql line
                         $req = $this->db->query($sqlcour);
                     }
                 }
                 //end dump
                 if ($dumper) {
                     $dumper->endDump();
                 }
             }
             //load db generator
             $sqltype = $this->getExtSql();
             $chemin_db_generator_tpl = "package/" . $packagecodename . "/generator/generator.db.deployer.__INSTANCE__." . $sqltype . ".tpl";
             if (isset($this->db) && $this->db && file_exists($chemin_db_generator_tpl)) {
                 //pour chaque instance à générer
                 foreach ($confgenerator->instance as $instance) {
                     //generate sql
                     $instanceTpl = new Tp($this->conf, $this->log, "backoffice");
                     $tpl = $instanceTpl->tpselected;
                     //include generator conf tpl
                     $tabgeneratorconftpl = $this->loader->charg_generatorconftpl_dans_tab("package/" . $packagecodename . "/generator");
                     $tpl->remplir_template("generatorconf", $tabgeneratorconftpl);
                     //include generator file cour
                     $tpl->remplir_template("chemintpltogenerate", $chemin_db_generator_tpl);
                     //preparedatafortpl
                     $datafortpl = array();
                     if (isset($instanceGenerator)) {
                         $datafortpl = $instanceGenerator->prepareDataForTpl($instance);
                     }
                     foreach ($datafortpl as $iddatafortpl => $contentdatafortpl) {
                         $tpl->remplir_template($iddatafortpl, $contentdatafortpl);
                     }
                     //generate file with tpl
                     $contentfilecour = $tpl->get_template($this->chemingeneratortpl);
                     $namefilecour = str_replace("__INSTANCE__", $instance->name, $chemin_db_generator_tpl);
                     $namefilecour = substr($namefilecour, 0, -4);
                     $namefilecour = str_replace("package/" . $packagecodename . "/generator/", "core/files/db/" . $packagecodename . ".", $namefilecour);
                     //conflict resolution "reverse" mode
                     if ($this->conflictresolution != null) {
                         //only if new file
                         if (!file_exists($namefilecour)) {
                             //setup annuaire files in package
                             $this->addToFileIsInPackageFile($packagecodename, $namefilecour);
                             //replace original file
                             file_put_contents($namefilecour, $contentfilecour);
                         } else {
                             //find existing conflict
                             $conflictnamefilecour = str_replace("core/files/db/", "core/files/db/___CONFLICTFILE1___", $namefilecour);
                             if (file_exists($this->conflictfolder . "/" . $conflictnamefilecour)) {
                                 $cptconflict = "1";
                                 $conflictfilefound = "";
                                 while (file_exists($this->conflictfolder . "/" . $conflictnamefilecour)) {
                                     include $this->conflictfolder . "/conflict.php";
                                     $tabid = str_replace("/", "-----", $conflictnamefilecour);
                                     if (isset($tabconflict[$tabid]) && $tabconflict[$tabid] == $packagecodename) {
                                         $conflictfilefound = $conflictnamefilecour;
                                         break;
                                     }
                                     $conflictnamefilecour = str_replace("core/files/db/", "core/files/db/___CONFLICTFILE" . $cptconflict++ . "___", $namefilecour);
                                 }
                             }
                             //if conflict found
                             if (file_exists($conflictfilefound)) {
                                 //if conflict exists, replace only conflict file
                                 if (!is_dir($this->conflictfolder . "/core/files/db")) {
                                     mkdir($this->conflictfolder . "/core/files/db", 0777, true);
                                 }
                                 copy($namefilecour, $this->conflictfolder . "/" . $conflictnamefilecour);
                             } else {
                                 //replace original file
                                 file_put_contents($namefilecour, $contentfilecour);
                             }
                         }
                     } else {
                         //file create
                         file_put_contents($namefilecour, $contentfilecour);
                     }
                     //return tab
                     $tabdeployedfiles[] = $namefilecour;
                     //load db
                     $sqltoload = file_get_contents($namefilecour);
                     $tabsqltoload = explode(";", $sqltoload);
                     foreach ($tabsqltoload as $sqlcour) {
                         $req = $this->db->query($sqlcour);
                     }
                 }
             }
             //recup dump with import
             $dumper = null;
             if (class_exists("PratikDump") || isset($this->includer) && $this->includer->include_pratikclass("Dump")) {
                 $dumpname = "dump." . $packagecodename . "___generator";
                 $instanceDump = new PratikDump($this->initer, $dumpname);
                 $packagelastdumptoload = $instanceDump->getLastDump($dumpname);
                 if ($packagelastdumptoload != "") {
                     //load dump
                     $dumper = $instanceDump->dumpselected;
                     $dumper->importDump($packagelastdumptoload);
                 }
             }
         }
         //load files generator
         foreach ($this->initer['chaintab'] as $chaincour) {
             $tabfilestoload = $this->loader->charg_dossier_dans_tab("package/" . $packagecodename . "/generator/" . $chaincour);
             if (isset($tabfilestoload)) {
                 foreach ($tabfilestoload as $filecour) {
                     $folder = substr($filecour, 0, strrpos($filecour, "/"));
                     $file = substr($filecour, strrpos($filecour, "/"), strlen($filecour) - 4 - strrpos($filecour, "/"));
                     if ($folder == "package/" . $packagecodename . "/generator/" . $chaincour) {
                         continue;
                     }
                     $folder = str_replace("package/" . $packagecodename . "/generator/" . $chaincour . "/", "", $folder);
                     if (!is_dir($folder)) {
                         mkdir($folder, 0777, true);
                     }
                     //pour chaque instance à générer
                     if ($confgenerator && $confgenerator->instance) {
                         foreach ($confgenerator->instance as $instance) {
                             //prepare chemin file with instance
                             $file_generate = str_replace("__INSTANCE__", $instance->name, $file);
                             //generate file
                             $instanceTpl = new Tp($this->conf, $this->log, "backoffice");
                             $tpl = $instanceTpl->tpselected;
                             //include generator conf tpl
                             $tabgeneratorconftpl = $this->loader->charg_generatorconftpl_dans_tab("package/" . $packagecodename . "/generator");
                             $tpl->remplir_template("generatorconf", $tabgeneratorconftpl);
                             //include generator file cour
                             $tpl->remplir_template("chemintpltogenerate", $filecour);
                             //preparedatafortpl
                             $datafortpl = array();
                             if (isset($instanceGenerator)) {
                                 $datafortpl = $instanceGenerator->prepareDataForTpl($instance);
                             }
                             foreach ($datafortpl as $iddatafortpl => $contentdatafortpl) {
                                 $tpl->remplir_template($iddatafortpl, $contentdatafortpl);
                             }
                             //generate file with tpl
                             $contentfilecour = $tpl->get_template($this->chemingeneratortpl);
                             //conflict resolution "reverse" mode
                             if ($this->conflictresolution != null) {
                                 //only if new file
                                 if (!file_exists($folder . $file_generate)) {
                                     //setup annuaire files in package
                                     $this->addToFileIsInPackageFile($packagecodename, $folder . $file_generate);
                                     //replace original file
                                     file_put_contents($folder . $file_generate, $contentfilecour);
                                 } else {
                                     //find existing conflict
                                     $conflictnamefilecour = "/___CONFLICTFILE1___" . substr($file_generate, 1);
                                     if (file_exists($this->conflictfolder . "/" . $folder . $conflictnamefilecour)) {
                                         $cptconflict = "1";
                                         $conflictfilefound = "";
                                         while (file_exists($this->conflictfolder . "/" . $folder . $conflictnamefilecour)) {
                                             include $this->conflictfolder . "/conflict.php";
                                             $tabid = str_replace("/", "-----", $folder . $conflictnamefilecour);
                                             if (isset($tabconflict[$tabid]) && $tabconflict[$tabid] == $packagecodename) {
                                                 $conflictfilefound = $conflictnamefilecour;
                                                 break;
                                             }
                                             $conflictnamefilecour = "/___CONFLICTFILE" . $cptconflict++ . "___" . substr($file_generate, 1);
                                         }
                                     }
                                     //if conflict found
                                     if (file_exists($conflictfilefound)) {
                                         //if conflict exists, replace only conflict file
                                         if (!is_dir($this->conflictfolder . "/" . $folder)) {
                                             mkdir($this->conflictfolder . "/" . $folder, 0777, true);
                                         }
                                         copy($folder . $file_generate, $this->conflictfolder . "/" . $folder . $conflictnamefilecour);
                                     } else {
                                         //replace original file
                                         file_put_contents($folder . $file_generate, $contentfilecour);
                                     }
                                 }
                             } else {
                                 //chemin file ok
                                 $chemin_file_generator_tpl = $folder . $file_generate;
                                 file_put_contents($chemin_file_generator_tpl, $contentfilecour);
                             }
                             //return tab
                             $tabdeployedfiles[] = $chemin_file_generator_tpl;
                         }
                     }
                 }
             }
         }
         //include postdeployer generator
         if (file_exists("package/" . $packagecodename . "/generator/generator.postdeployer.php")) {
             include "package/" . $packagecodename . "/generator/generator.postdeployer.php";
         }
         //kill old files which are not in the updated package yet (and put last conflict file instead if exists)
         //a file of $tabisinpackage for the package not in $tabdeployedfiles and a conflictfile for the package not in $tabdeployedfiles ==> tabisinpackage unset or conflictfile unset, kill file (or last conflict replace or reorganize conflict => see destroy)
         include $this->conflictfolder . "/fileisinpackage.php";
         include $this->conflictfolder . "/conflict.php";
         foreach ($tabfileisinpackage as $fileisinpackageconvert => $filepackage) {
             //prepare fileisinpackage with ----- instead of / and folder file separation
             $fileisinpackage = str_replace("-----", "/", $fileisinpackageconvert);
             $folder_isinpackage = substr($fileisinpackage, 0, strrpos($fileisinpackage, "/"));
             $filename_isinpackage = substr($fileisinpackage, strrpos($fileisinpackage, "/"));
             //check file is in package
             $filetosearch = false;
             $conflictfilefound = "";
             if ($filepackage == $packagecodename) {
                 $filetosearch = true;
             } else {
                 //find file in existing conflict
                 $conflictnamefilecour = "/___CONFLICTFILE1___" . substr($filename_isinpackage, 1);
                 if (file_exists($this->conflictfolder . "/" . $folder_isinpackage . $conflictnamefilecour)) {
                     $cptconflict = "1";
                     while (file_exists($this->conflictfolder . "/" . $folder_isinpackage . $conflictnamefilecour)) {
                         include $this->conflictfolder . "/conflict.php";
                         $tabid = str_replace("/", "-----", $folder_isinpackage . $conflictnamefilecour);
                         if (isset($tabconflict[$tabid]) && $tabconflict[$tabid] == $packagecodename) {
                             $conflictfilefound = $conflictnamefilecour;
                             $filetosearch = true;
                             break;
                         }
                         $conflictnamefilecour = "/___CONFLICTFILE" . $cptconflict++ . "___" . substr($filename_isinpackage, 1);
                     }
                 }
             }
             //search file in deployed files, else kill it
             if ($filetosearch) {
                 if (array_search($fileisinpackage, $tabdeployedfiles) === false) {
                     //kill old file
                     if (file_exists($folder_isinpackage . $filename_isinpackage)) {
                         //(conflict "reverse" mode)
                         if ($this->conflictresolution != null) {
                             //maj fileisinpackage.php
                             $this->addToFileIsInPackageFile($packagecodename, $folder_isinpackage . $filename_isinpackage, "unset");
                             if ($this->conflictresolution == "force" || $this->conflictresolution == "keep") {
                                 unlink($folder_isinpackage . $filename_isinpackage);
                             }
                             //check if a conflict file exists ___CONFLICT... else suppr file and continue
                             if (!file_exists($this->conflictfolder . "/" . $folder_isinpackage . "/___CONFLICTFILE1___" . substr($filename_isinpackage, 1))) {
                                 if (file_exists($folder_isinpackage . $filename_isinpackage)) {
                                     unlink($folder_isinpackage . $filename_isinpackage);
                                 }
                                 continue;
                             }
                             //if a conflict file exists, find conflict for this package codename in tabconflict in conflict.php
                             //include $this->conflictfolder."/conflict.php";
                             $cptconflict = "1";
                             $filecour = $folder_isinpackage . "/___CONFLICTFILE" . $cptconflict . "___" . substr($filename_isinpackage, 1);
                             $conflictfile = "";
                             $cptconflictfound = 0;
                             while (file_exists($this->conflictfolder . "/" . $filecour)) {
                                 $tabid = str_replace("/", "-----", $filecour);
                                 if (isset($tabconflict[$tabid]) && $tabconflict[$tabid] == $packagecodename) {
                                     $conflictfile = $filecour;
                                     $cptconflictfound = $cptconflict;
                                     break;
                                 }
                                 $cptconflict++;
                                 $filecour = $folder_isinpackage . "/___CONFLICTFILE" . $cptconflict . "___" . substr($filename_isinpackage, 1);
                             }
                             //if not found, suppr file and move last conflict file instead of it
                             if ($conflictfile == "") {
                                 //suppr file
                                 unlink($folder_isinpackage . $filename_isinpackage);
                                 //move last conflict file to official file
                                 $cptconflictlast = --$cptconflict;
                                 if ($this->conflictresolution == "reverse") {
                                     rename($this->conflictfolder . "/" . $folder_isinpackage . "/___CONFLICTFILE" . $cptconflictlast . "___" . substr($filename_isinpackage, 1), $folder_isinpackage . $filename_isinpackage);
                                 }
                                 //clear last conflict file (check kill and clear in $tabconflict in conflict.php)
                                 if (file_exists($this->conflictfolder . "/" . $folder_isinpackage . "/___CONFLICTFILE" . $cptconflictlast . "___" . substr($filename_isinpackage, 1))) {
                                     unlink($this->conflictfolder . "/" . $folder_isinpackage . "/___CONFLICTFILE" . $cptconflictlast . "___" . substr($filename_isinpackage, 1));
                                 }
                                 //rewrite conflict files in tabconflict in conflict.php (add new lines with unset($tabconflict[lastconflictile]) )
                                 $filecour = $this->conflictfolder . "/" . $folder_isinpackage . "/___CONFLICTFILE" . $cptconflictlast . "___" . substr($filename_isinpackage, 1);
                                 $this->addToConflictFile($filecour, "unset");
                             } else {
                                 //suppr conflict file
                                 unlink($this->conflictfolder . "/" . $conflictfile);
                                 //reorder next conflict files
                                 $cptconflict = ++$cptconflictfound;
                                 $filecour = $folder_isinpackage . "/___CONFLICTFILE" . $cptconflict . "___" . substr($filename_isinpackage, 1);
                                 while (file_exists($this->conflictfolder . "/" . $filecour)) {
                                     //move to prec conflict file
                                     $destfilecour = $folder_isinpackage . "/___CONFLICTFILE" . ($cptconflict - 1) . "___" . substr($filename_isinpackage, 1);
                                     rename($this->conflictfolder . "/" . $filecour, $this->conflictfolder . "/" . $destfilecour);
                                     //rewrite conflict files in tabconflict in conflict.php (add new lines with $tabconflict[cour]=$tabconflict[prec] or unset($tabconflict[cour]) )
                                     $this->addToConflictFile($filecour, "update", array('destfile' => $destfilecour));
                                     //next
                                     $cptconflict++;
                                     $filecour = $folder_isinpackage . "/___CONFLICTFILE" . $cptconflict . "___" . substr($filename_isinpackage, 1);
                                 }
                                 //end rewrite conflict files in tabconflict in conflict.php (unset($tabconflict[cour] for last conflict file) )
                                 $filecour = $folder_isinpackage . "/___CONFLICTFILE" . ($cptconflict - 1) . "___" . substr($filename_isinpackage, 1);
                                 $this->addToConflictFile($filecour, "unset");
                             }
                         } else {
                             //suppr file
                             unlink($folder_isinpackage . $filename_isinpackage);
                         }
                     }
                 }
             }
         }
         //reload initer
         $this->reloadIniter();
         if (isset($this->db) && $this->db) {
             $this->db->query("update `package` set toupdate='0' where nomcodepackage='" . $packagecodename . "'");
         }
         return $tabdeployedfiles;
     }
     return array();
 }
 function update($packagecodename = "example")
 {
     //conflict init
     if ($this->conflictresolution != null && !is_dir($this->conflictfolder)) {
         mkdir($this->conflictfolder, 0777, true);
     }
     //update package
     $this->initer['update'] = "update";
     $this->initer['packagecodename'] = $packagecodename;
     $classpackagename = "";
     $tabclassname = explode(".", $packagecodename);
     foreach ($tabclassname as $classnamecour) {
         $classpackagename .= ucfirst(strtolower($classnamecour));
     }
     if (file_exists("package/" . $packagecodename)) {
         //tab deployed files
         $tabdeployedfiles = array();
         //include descripter
         $this->initer['descripter'] = array();
         if (file_exists("package/" . $packagecodename . "/package.descripter.php")) {
             include "package/" . $packagecodename . "/package.descripter.php";
         }
         if (isset($descripter)) {
             $this->initer['descripter'] = $descripter;
         }
         //load conf package
         $confstatic = null;
         if (file_exists("package/" . $packagecodename . "/conf.package.xml")) {
             $confstatic = simplexml_load_file("package/" . $packagecodename . "/conf.package.xml");
         }
         $this->initer['confstatic'] = $confstatic;
         //load conf form package
         if (isset($_POST['confform'][$packagecodename])) {
             $this->initer['confform'][$packagecodename] = $_POST['confform'][$packagecodename];
         }
         if (isset($_SESSION['confform'][$packagecodename])) {
             $this->initer['confform'][$packagecodename] = $_SESSION['confform'][$packagecodename];
         }
         //reload initer
         $this->reloadIniter();
         //include predeployer static
         if (file_exists("package/" . $packagecodename . "/class/class.static.php")) {
             include "package/" . $packagecodename . "/class/class.static.php";
             eval("\$instanceStatic=new " . $classpackagename . "Static(\$this->initer);");
         }
         if (file_exists("package/" . $packagecodename . "/static/static.predeployer.php")) {
             include "package/" . $packagecodename . "/static/static.predeployer.php";
         }
         //reload initer
         $this->reloadIniter();
         //load db static
         $sqltype = $this->getExtSql();
         $chemin_db_static = "package/" . $packagecodename . "/static/static.db.deployer." . $sqltype;
         if (isset($this->db) && $this->db && file_exists($chemin_db_static)) {
             //sql exec
             $sqltoload = file_get_contents($chemin_db_static);
             $tabsqltoload = explode(";", $sqltoload);
             foreach ($tabsqltoload as $sqlcour) {
                 $req = $this->db->query($sqlcour);
             }
             //filename creation
             $namefilecour = str_replace("package/" . $packagecodename . "/static/", "core/files/db/" . $packagecodename . ".", $chemin_db_static);
             //conflict resolution "reverse" mode
             if ($this->conflictresolution != null) {
                 //only if new file
                 if (!file_exists($namefilecour)) {
                     //setup annuaire files in package
                     $this->addToFileIsInPackageFile($packagecodename, $namefilecour);
                     //replace original file
                     file_put_contents($namefilecour, $sqltoload);
                 } else {
                     //find existing conflict
                     $conflictnamefilecour = str_replace("core/files/db/", "core/files/db/___CONFLICTFILE1___", $namefilecour);
                     $conflictfilefound = "";
                     if (file_exists($this->conflictfolder . "/" . $conflictnamefilecour)) {
                         $cptconflict = "1";
                         while (file_exists($this->conflictfolder . "/" . $conflictnamefilecour)) {
                             include $this->conflictfolder . "/conflict.php";
                             $tabid = str_replace("/", "-----", $conflictnamefilecour);
                             if (isset($tabconflict[$tabid]) && $tabconflict[$tabid] == $packagecodename) {
                                 $conflictfilefound = $conflictnamefilecour;
                                 break;
                             }
                             $conflictnamefilecour = str_replace("core/files/db/", "core/files/db/___CONFLICTFILE" . $cptconflict++ . "___", $namefilecour);
                         }
                     }
                     //if conflict found
                     if (file_exists($conflictfilefound)) {
                         //if conflict exists, replace only conflict file
                         if (!is_dir($this->conflictfolder . "/core/files/db")) {
                             mkdir($this->conflictfolder . "/core/files/db", 0777, true);
                         }
                         copy($namefilecour, $this->conflictfolder . "/" . $conflictnamefilecour);
                     } else {
                         //replace original file
                         file_put_contents($namefilecour, $sqltoload);
                     }
                 }
             } else {
                 //create file
                 file_put_contents($namefilecour, $sqltoload);
             }
             //return tab
             $tabdeployedfiles[] = $namefilecour;
         }
         //load files static
         foreach ($this->initer['chaintab'] as $chaincour) {
             $tabfilestoload = $this->loader->charg_dossier_dans_tab("package/" . $packagecodename . "/static/" . $chaincour);
             if (isset($tabfilestoload)) {
                 foreach ($tabfilestoload as $filecour) {
                     $folder = substr($filecour, 0, strrpos($filecour, "/"));
                     $file = substr($filecour, strrpos($filecour, "/"), strlen($filecour) - 0 - strrpos($filecour, "/"));
                     if ($folder == "package/" . $packagecodename . "/static/" . $chaincour) {
                         continue;
                     }
                     $folder = str_replace("package/" . $packagecodename . "/static/" . $chaincour . "/", "", $folder);
                     if (!is_dir($folder)) {
                         mkdir($folder, 0777, true);
                     }
                     //conflict resolution "reverse" mode
                     if ($this->conflictresolution != null) {
                         //only if new file
                         if (!file_exists($folder . $file)) {
                             //setup annuaire files in package
                             $this->addToFileIsInPackageFile($packagecodename, $folder . $file);
                             //replace original file
                             copy($filecour, $folder . $file);
                         } else {
                             //find existing conflict
                             $conflictnamefilecour = "/___CONFLICTFILE1___" . substr($file, 1);
                             $conflictfilefound = "";
                             if (file_exists($this->conflictfolder . "/" . $folder . $conflictnamefilecour)) {
                                 $cptconflict = "1";
                                 while (file_exists($this->conflictfolder . "/" . $folder . $conflictnamefilecour)) {
                                     include $this->conflictfolder . "/conflict.php";
                                     $tabid = str_replace("/", "-----", $folder . $conflictnamefilecour);
                                     if (isset($tabconflict[$tabid]) && $tabconflict[$tabid] == $packagecodename) {
                                         $conflictfilefound = $conflictnamefilecour;
                                         break;
                                     }
                                     $conflictnamefilecour = "/___CONFLICTFILE" . $cptconflict++ . "___" . substr($file, 1);
                                 }
                             }
                             //if conflict found
                             if (file_exists($conflictfilefound)) {
                                 //if conflict exists, replace only conflict file
                                 if (!is_dir($this->conflictfolder . "/" . $folder)) {
                                     mkdir($this->conflictfolder . "/" . $folder, 0777, true);
                                 }
                                 copy($folder . $file, $this->conflictfolder . "/" . $folder . $conflictnamefilecour);
                             } else {
                                 //replace original file
                                 copy($filecour, $folder . $file);
                             }
                         }
                     } else {
                         //file create
                         copy($filecour, $folder . $file);
                     }
                     //return tab
                     $tabdeployedfiles[] = $folder . $file;
                 }
             }
         }
         //include postdeployer static
         if (file_exists("package/" . $packagecodename . "/static/static.postdeployer.php")) {
             include "package/" . $packagecodename . "/static/static.postdeployer.php";
         }
         //reload initer
         $this->reloadIniter();
         //load conf package generator
         $confgenerator = null;
         if (file_exists("package/" . $packagecodename . "/conf.generator.xml")) {
             $confgenerator = simplexml_load_file("package/" . $packagecodename . "/conf.generator.xml");
         }
         $this->initer['confgenerator'] = $confgenerator;
         //reload initer
         $this->reloadIniter();
         //include predeployer generator
         $instanceGenerator = new PackageGenerator($this->initer);
         if (file_exists("package/" . $packagecodename . "/class/class.generator.php")) {
             include "package/" . $packagecodename . "/class/class.generator.php";
             eval("\$instanceGenerator=new " . $classpackagename . "Generator(\$this->initer);");
         }
         if (file_exists("package/" . $packagecodename . "/generator/generator.predeployer.php")) {
             include "package/" . $packagecodename . "/generator/generator.predeployer.php";
         }
         //reload initer
         $this->reloadIniter();
         //load db generator
         $chemin_db_generator_tpl = "package/" . $packagecodename . "/generator/generator.db.deployer.__INSTANCE__." . $sqltype . ".tpl";
         if (isset($this->db) && $this->db && file_exists($chemin_db_generator_tpl)) {
             //pour chaque instance à générer
             foreach ($confgenerator->instance as $instance) {
                 //generate sql
                 $instanceTpl = new Tp($this->conf, $this->log, "backoffice");
                 $tpl = $instanceTpl->tpselected;
                 //include generator conf tpl
                 $tabgeneratorconftpl = $this->loader->charg_generatorconftpl_dans_tab("package/" . $packagecodename . "/generator");
                 $tpl->remplir_template("generatorconf", $tabgeneratorconftpl);
                 //include generator file cour
                 $tpl->remplir_template("chemintpltogenerate", $chemin_db_generator_tpl);
                 //preparedatafortpl
                 $datafortpl = array();
                 if (isset($instanceGenerator)) {
                     $datafortpl = $instanceGenerator->prepareDataForTpl($instance);
                 }
                 foreach ($datafortpl as $iddatafortpl => $contentdatafortpl) {
                     $tpl->remplir_template($iddatafortpl, $contentdatafortpl);
                 }
                 //generate file with tpl
                 $contentfilecour = $tpl->get_template($this->chemingeneratortpl);
                 $namefilecour = str_replace("__INSTANCE__", $instance->name, $chemin_db_generator_tpl);
                 $namefilecour = substr($namefilecour, 0, -4);
                 $namefilecour = str_replace("package/" . $packagecodename . "/generator/", "core/files/db/" . $packagecodename . ".", $namefilecour);
                 //conflict resolution "reverse" mode
                 if ($this->conflictresolution != null) {
                     //only if new file
                     if (!file_exists($namefilecour)) {
                         //setup annuaire files in package
                         $this->addToFileIsInPackageFile($packagecodename, $namefilecour);
                         //replace original file
                         file_put_contents($namefilecour, $contentfilecour);
                     } else {
                         //find existing conflict
                         $conflictnamefilecour = str_replace("core/files/db/", "core/files/db/___CONFLICTFILE1___", $namefilecour);
                         if (file_exists($this->conflictfolder . "/" . $conflictnamefilecour)) {
                             $cptconflict = "1";
                             $conflictfilefound = "";
                             while (file_exists($this->conflictfolder . "/" . $conflictnamefilecour)) {
                                 include $this->conflictfolder . "/conflict.php";
                                 $tabid = str_replace("/", "-----", $conflictnamefilecour);
                                 if (isset($tabconflict[$tabid]) && $tabconflict[$tabid] == $packagecodename) {
                                     $conflictfilefound = $conflictnamefilecour;
                                     break;
                                 }
                                 $conflictnamefilecour = str_replace("core/files/db/", "core/files/db/___CONFLICTFILE" . $cptconflict++ . "___", $namefilecour);
                             }
                         }
                         //if conflict found
                         if (file_exists($conflictfilefound)) {
                             //if conflict exists, replace only conflict file
                             if (!is_dir($this->conflictfolder . "/core/files/db")) {
                                 mkdir($this->conflictfolder . "/core/files/db", 0777, true);
                             }
                             copy($namefilecour, $this->conflictfolder . "/" . $conflictnamefilecour);
                         } else {
                             //replace original file
                             file_put_contents($namefilecour, $contentfilecour);
                         }
                     }
                 } else {
                     //file create
                     file_put_contents($namefilecour, $contentfilecour);
                 }
                 //return tab
                 $tabdeployedfiles[] = $namefilecour;
                 //load db
                 $sqltoload = file_get_contents($namefilecour);
                 $tabsqltoload = explode(";", $sqltoload);
                 foreach ($tabsqltoload as $sqlcour) {
                     $req = $this->db->query($sqlcour);
                 }
             }
         }
         //load files generator
         foreach ($this->initer['chaintab'] as $chaincour) {
             $tabfilestoload = $this->loader->charg_dossier_dans_tab("package/" . $packagecodename . "/generator/" . $chaincour);
             if (isset($tabfilestoload)) {
                 foreach ($tabfilestoload as $filecour) {
                     $folder = substr($filecour, 0, strrpos($filecour, "/"));
                     $file = substr($filecour, strrpos($filecour, "/"), strlen($filecour) - 4 - strrpos($filecour, "/"));
                     if ($folder == "package/" . $packagecodename . "/generator/" . $chaincour) {
                         continue;
                     }
                     $folder = str_replace("package/" . $packagecodename . "/generator/" . $chaincour . "/", "", $folder);
                     if (!is_dir($folder)) {
                         mkdir($folder, 0777, true);
                     }
                     //pour chaque instance à générer
                     if ($confgenerator && $confgenerator->instance) {
                         foreach ($confgenerator->instance as $instance) {
                             //prepare chemin file with instance
                             $file_generate = str_replace("__INSTANCE__", $instance->name, $file);
                             //generate file
                             $instanceTpl = new Tp($this->conf, $this->log, "backoffice");
                             $tpl = $instanceTpl->tpselected;
                             //include generator conf tpl
                             $tabgeneratorconftpl = $this->loader->charg_generatorconftpl_dans_tab("package/" . $packagecodename . "/generator");
                             $tpl->remplir_template("generatorconf", $tabgeneratorconftpl);
                             //include generator file cour
                             $tpl->remplir_template("chemintpltogenerate", $filecour);
                             //preparedatafortpl
                             $datafortpl = array();
                             if (isset($instanceGenerator)) {
                                 $datafortpl = $instanceGenerator->prepareDataForTpl($instance);
                             }
                             foreach ($datafortpl as $iddatafortpl => $contentdatafortpl) {
                                 $tpl->remplir_template($iddatafortpl, $contentdatafortpl);
                             }
                             //generate file with tpl
                             $contentfilecour = $tpl->get_template($this->chemingeneratortpl);
                             //conflict resolution "reverse" mode
                             if ($this->conflictresolution != null) {
                                 //only if new file
                                 if (!file_exists($folder . $file_generate)) {
                                     //setup annuaire files in package
                                     $this->addToFileIsInPackageFile($packagecodename, $folder . $file_generate);
                                     //replace original file
                                     file_put_contents($folder . $file_generate, $contentfilecour);
                                 } else {
                                     //find existing conflict
                                     $conflictnamefilecour = "/___CONFLICTFILE1___" . substr($file_generate, 1);
                                     if (file_exists($this->conflictfolder . "/" . $folder . $conflictnamefilecour)) {
                                         $cptconflict = "1";
                                         $conflictfilefound = "";
                                         while (file_exists($this->conflictfolder . "/" . $folder . $conflictnamefilecour)) {
                                             include $this->conflictfolder . "/conflict.php";
                                             $tabid = str_replace("/", "-----", $folder . $conflictnamefilecour);
                                             if (isset($tabconflict[$tabid]) && $tabconflict[$tabid] == $packagecodename) {
                                                 $conflictfilefound = $conflictnamefilecour;
                                                 break;
                                             }
                                             $conflictnamefilecour = "/___CONFLICTFILE" . $cptconflict++ . "___" . substr($file_generate, 1);
                                         }
                                     }
                                     //if conflict found
                                     if (file_exists($conflictfilefound)) {
                                         //if conflict exists, replace only conflict file
                                         if (!is_dir($this->conflictfolder . "/" . $folder)) {
                                             mkdir($this->conflictfolder . "/" . $folder, 0777, true);
                                         }
                                         copy($folder . $file_generate, $this->conflictfolder . "/" . $folder . $conflictnamefilecour);
                                     } else {
                                         //replace original file
                                         file_put_contents($folder . $file_generate, $contentfilecour);
                                     }
                                 }
                             } else {
                                 //chemin file ok
                                 $chemin_file_generator_tpl = $folder . $file_generate;
                                 file_put_contents($chemin_file_generator_tpl, $contentfilecour);
                             }
                             //return tab
                             $tabdeployedfiles[] = $chemin_file_generator_tpl;
                         }
                     }
                 }
             }
         }
         //include postdeployer generator
         if (file_exists("package/" . $packagecodename . "/generator/generator.postdeployer.php")) {
             include "package/" . $packagecodename . "/generator/generator.postdeployer.php";
         }
         //reload initer
         $this->reloadIniter();
         if (isset($this->db) && $this->db) {
             $this->db->query("update `package` set toupdate='0' where nomcodepackage='" . $packagecodename . "'");
         }
         return $tabdeployedfiles;
     }
     return array();
 }