Bug : Cannot upgrade core

This commit is contained in:
Dany De Bontridder 2018-03-12 22:26:30 +01:00
parent c77ba0812e
commit 0a54848ec8
2 changed files with 13 additions and 4 deletions

View file

@ -33,7 +33,12 @@ class Package_Core extends Package_Noalyss
*/
public function can_install()
{
if (! is_writable(NOALYSS_HOME)) {
return 0;
}
if ( !is_writable(NOALYSS_INCLUDE)) {
return 0;
}
}
/**
@ -44,6 +49,10 @@ class Package_Core extends Package_Noalyss
*/
public function install()
{
if ( $this->can_install() == 0 )
{
throw new Exception(sprintf(_("Permission incorrecte : ne peut écrire dans %s ou %s"),NOALYSS_HOME,NOALYSS_INCLUDE),3);
}
$zip=new ZipArchive ();
// open the file
if ($zip->open(NOALYSS_HOME."/tmp/".$this->get_file()))
@ -51,7 +60,7 @@ class Package_Core extends Package_Noalyss
// try to unzip and overwrite current
if (!$zip->extractTo(NOALYSS_HOME."/../"))
{
throw new Exception(_("Echec mis à jour"), 1);
throw new Exception(_("Echec mise à jour"), 1);
}
}
else

View file

@ -22,13 +22,13 @@
if (!defined('ALLOWED')) die('Appel direct ne sont pas permis');
if ( ! defined ('ALLOWED_ADMIN')) { die (_('Non autorisé'));}
global $version_noalyss;
require_once NOALYSS_INCLUDE.'/class/package_repository.class.php';
/**
* @file
* @brief
*/
printf (_(" La version de votre installaiton est %s "),NOALYSS_VERSION);
printf (_(" La version de votre installation est %s "),$version_noalyss);
$core=new Package_Repository();
$xml=$core->getContent();