//@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é");