diff --git a/html/admin-noalyss.php b/html/admin-noalyss.php
index 4cb8235d7..d5046f813 100644
--- a/html/admin-noalyss.php
+++ b/html/admin-noalyss.php
@@ -29,6 +29,7 @@ if (file_exists("../include/config.inc.php") ) {
* installed
*/
define ('ALLOWED',1);
+ define ('ALLOWED_ADMIN',1);
require_once '../include/constant.php';
require_once NOALYSS_INCLUDE.'/admin_repo.inc.php';
} else {
diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 70f4f9387..5da6df56b 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -203,6 +203,10 @@ $path = array(
"modele_drop"=>"ajax_admin",
// From admin, display the information of a template you can modify
"modele_modify"=>"ajax_admin",
+ // From admin , upgrade Noalyss
+ "upgradeCore"=>"ajax_admin",
+ // From admin , upgrade or install plugin
+ "upgradePlugin"=>"ajax_admin",
// From dashboard, display detail about last operation
"action_show"=>"ajax_gestion",
// From dashboard, display form for a new event
diff --git a/html/index.php b/html/index.php
index 716ffdb61..828b682f5 100644
--- a/html/index.php
+++ b/html/index.php
@@ -132,12 +132,14 @@
*
*/
+
if ( ! file_exists('..'.DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'config.inc.php'))
{
header("Location: install.php",true, 307);
exit(0);
}
+
echo '
"._("Tout est installé")." ". $succeed;
+ echo "
"._("Tout est installé")." ". $succeed;
?>
';
- /* If multi folders */
- $Resdossier=$rep->exec_sql("select dos_id, dos_name from ac_dossier");
- $MaxDossier=$rep->size($Resdossier);
-
- //----------------------------------------------------------------------
- // Upgrade the account_repository
- //----------------------------------------------------------------------
- echo "
"._("Mise à jour de la base de données principale")."
";
- $cn=new Database();
- if (DEBUG==false)
- ob_start();
- $MaxVersion=DBVERSIONREPO-1;
- for ($i=4; $i<=$MaxVersion; $i++)
+ ?>
+
+
+ get_version()<=$i)
- {
- $cn->execute_script(NOALYSS_INCLUDE.'/sql/patch/ac-upgrade'.$i.'.sql');
- }
+ echo '
';
+
+ Dossier::upgrade();
+
+ echo '
';
+ return;
}
- //----------------------------------------------------------------------
- // Upgrade the folders
- //----------------------------------------------------------------------
- echo "
"._("Mise à jour dossiers")."
";
-
- for ($e=0; $e<$MaxDossier; $e++)
- {
- $db_row=Database::fetch_array($Resdossier, $e);
- $name=$rep->format_name($db_row['dos_id'], 'dos');
- echo "
Patching ".$db_row['dos_name'].'
';
- echo _('Base de données')." ".$name;
-
- if ($rep->exist_database($name)>0)
- {
- $db=new Database($db_row['dos_id'], 'dos');
- $db->apply_patch($db_row['dos_name']);
- Dossier::synchro_admin($db_row['dos_id']);
- User::remove_inexistant_user($db_row['dos_id']);
- $db->clean_orphan_lob();
- }
- else
- {
- echo_warning(_("Dossier inexistant")." $name");
- }
- }
-
- //----------------------------------------------------------------------
- // Upgrade the template
- //----------------------------------------------------------------------
- $Resdossier=$rep->exec_sql("select mod_id, mod_name from modeledef");
- $MaxDossier=$rep->size();
- echo "
"._("Mise à jour modèles")."
";
-
- for ($e=0; $e<$MaxDossier; $e++)
- {
- $db_row=Database::fetch_array($Resdossier, $e);
- $name=$rep->format_name($db_row['mod_id'], 'mod');
- echo "
Patching ".$db_row['mod_name']."
";
- echo _('Base de données')." ".$name;
- if ($rep->exist_database($name)>0)
- {
- $db=new Database($db_row['mod_id'], 'mod');
- $db->apply_patch($db_row['mod_name']);
- $db->clean_orphan_lob();
- }
- else
- {
- echo_warning(_("Modèle inexistant")." $name");
- }
- }
-
}
+// Import the file with the package
+//------------------------------------------------------------------------------
+// Upgrade Main application, show all the info from the NOALYSS_PACKAGE site
+//------------------------------------------------------------------------------
+if ($sb=="application")
+{
+ require NOALYSS_INCLUDE."/upgrade-core.php";
+}
+//------------------------------------------------------------------------------
+// Install or Upgrade Extension, show all the info from the NOALYSS_PACKAGE site
+//------------------------------------------------------------------------------
+if ($sb=="plugin")
+{
+ require NOALYSS_INCLUDE."/upgrade-plugin.php";
+
+}
+//-------------------------------------------------------------------------------------------------------------------------------
+// Install template
+//-------------------------------------------------------------------------------------------------------------------------------
+if ( $sb == 'template')
+{
+ require NOALYSS_INCLUDE."/upgrade-template.php";
+
+}
+
?>
diff --git a/scenario/package_repository.test.php b/scenario/package_repository.test.php
new file mode 100644
index 000000000..5c14014b5
--- /dev/null
+++ b/scenario/package_repository.test.php
@@ -0,0 +1,103 @@
+
+//@description:Test class Package_Repository
+$_GET=array ();
+$_POST=array ();
+$_POST['gDossier']=$gDossierLogInput;
+$_GET['gDossier']=$gDossierLogInput;
+ $_REQUEST=array_merge($_GET,$_POST);
+
+ require_once NOALYSS_INCLUDE.'/class/package_repository.class.php';
+
+ $package_repository=new Package_Repository();
+ $package_repository->display_noalyss_info();
+
+ echo $package_repository->can_download();
+
+ $xml=$package_repository->getContent();
+
+ $a_plugin=$xml->xpath('//plugins/plugin');
+ $nb_plugin=count($a_plugin);
+ $a_coprop="";
+ echo "
";
+ for ( $i=0;$i < $nb_plugin;$i++)
+ {
+ echo "- ";
+ echo $a_plugin[$i]->name;
+ echo "- - - - - - ";
+ echo $a_plugin[$i]->path;
+ echo "- - - - - - ";
+ echo $a_plugin[$i]->author;
+ echo "- - - - - - ";
+ echo $a_plugin[$i]->code;
+ echo "
";
+ if (trim($a_plugin[$i]->code)=="AMORTIS")
+ {
+ $a_coprop=$a_plugin[$i];
+ var_dump($a_coprop);
+ }
+ }
+ echo "
";
+
+ // find a specific plugin
+$spec_plugin=$xml->xpath("//plugins/plugin[code='AMORTIS']");
+var_dump($spec_plugin);
+
+
+
+ $a_noalyss=$xml->xpath("//core");
+
+echo "description core ".$a_noalyss[0]->description;
+
+// Download fake core
+echo h1(_("Download core"));
+$core=$package_repository->make_object("core", "");
+$core->download();
+
+//download fake plugin
+echo h1("Plugin : download and install ");
+$plugin=$package_repository->make_object("plugin","COPRO");
+$plugin->download();
+echo h2("Install in noalyss/include/ext/copro-fake");
+$plugin->install();
+
+
+echo h1("Available template");
+ $a_template=$xml->xpath('//database_template/dbtemplate');
+ $nb_template=count($a_template);
+ echo "
";
+ for ( $i=0;$i < $nb_template;$i++)
+ {
+ echo "- ";
+ echo $a_template[$i]->name;
+ echo "- - - - - - ";
+ echo $a_template[$i]->description;
+ echo "- - - - - - ";
+ echo $a_template[$i]->path;
+ echo "
";
+ }
+ echo "
";
+
+ echo h1("Create new database");
+$template=$package_repository->make_object("template", "mod1");
+$template->download();
+$template->install();
+echo h2( $template->get_name()." est installé");
\ No newline at end of file