noalyss Version-9
package_plugin.class.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * PhpCompta is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * NOALYSS is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with PhpCompta; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
21
22/**
23 * @file
24 * @brief Manage the installation of plug
25 */
26
27/**
28 * @class Package_Plugin
29 * @brief Manage the installation of plug
30 */
32{
33
34 public function install()
35 {
36 $zip=new ZipArchive ();
37 // open the file
38 if ($zip->open(NOALYSS_HOME."/tmp/".$this->get_file()))
39 {
40 // try to unzip and overwrite current
41 if (!$zip->extractTo(NOALYSS_PLUGIN))
42 {
43 throw new Exception(_("Echec installation plugin "), 1);
44 }
45 }
46 else
47 {
48 throw new Exception(_("Ce n'est pas un fichier valide"), 2);
49 }
50 }
51
52 /**
53 * Check the NOALYSS_PLUGIN is writeable
54 */
55 public function can_install()
56 {
57 if (is_writable(NOALYSS_PLUGIN))
58 {
59 return TRUE;
60 }
61 return FALSE;
62 }
63
64
65}
package noalyss is the mother class of the class to install and download package
Manage the installation of plug.
can_install()
Check the NOALYSS_PLUGIN is writeable.