/** * @file * @brief Manage the installation of plug */ require_once NOALYSS_INCLUDE."/class/package_noalyss.class.php"; /** * @class * @brief Manage the installation of plug */ class Package_Plugin extends Package_Noalyss { public function install() { $zip=new ZipArchive (); // open the file if ($zip->open(NOALYSS_HOME."/tmp/".$this->get_file())) { // try to unzip and overwrite current if (!$zip->extractTo(NOALYSS_PLUGIN)) { throw new Exception(_("Echec installation plugin "), 1); } } else { throw new Exception(_("Ce n'est pas un fichier valide"), 2); } } /** * Check the NOALYSS_PLUGIN is writeable */ public function can_install() { if (is_writable(NOALYSS_PLUGIN)) { return TRUE; } return FALSE; } }