示例#1
0
function plugin_genericobject_install()
{
    global $DB;
    //check directories rights
    if (!check_directories()) {
        return false;
    }
    $migration = new Migration('2.1.0');
    foreach (array('PluginGenericobjectField', 'PluginGenericobjectType', 'PluginGenericobjectProfile', 'PluginGenericobjectTypeFamily') as $itemtype) {
        if ($plug = isPluginItemType($itemtype)) {
            $plugname = strtolower($plug['plugin']);
            $dir = GLPI_ROOT . "/plugins/{$plugname}/inc/";
            $item = strtolower($plug['class']);
            if (file_exists("{$dir}{$item}.class.php")) {
                include_once "{$dir}{$item}.class.php";
                $itemtype::install($migration);
            }
        }
    }
    if (!is_dir(GENERICOBJECT_CLASS_PATH)) {
        @mkdir(GENERICOBJECT_CLASS_PATH, 0777, true) or die("Can't create folder " . GENERICOBJECT_CLASS_PATH);
    }
    //Init plugin & types
    plugin_init_genericobject();
    //Init profiles
    PluginGenericobjectProfile::changeProfile();
    return true;
}
示例#2
0
function plugin_genericobject_install()
{
    global $DB;
    include_once GLPI_ROOT . "/plugins/genericobject/inc/object.class.php";
    include_once GLPI_ROOT . "/plugins/genericobject/inc/type.class.php";
    $migration = new Migration('2.4.0');
    foreach (array('PluginGenericobjectField', 'PluginGenericobjectCommonDropdown', 'PluginGenericobjectCommonTreeDropdown', 'PluginGenericobjectProfile', 'PluginGenericobjectType', 'PluginGenericobjectTypeFamily') as $itemtype) {
        if ($plug = isPluginItemType($itemtype)) {
            $plugname = strtolower($plug['plugin']);
            $dir = GLPI_ROOT . "/plugins/{$plugname}/inc/";
            $item = strtolower($plug['class']);
            if (file_exists("{$dir}{$item}.class.php")) {
                include_once "{$dir}{$item}.class.php";
                if (method_exists($itemtype, 'install')) {
                    $itemtype::install($migration);
                }
            }
        }
    }
    if (!is_dir(GENERICOBJECT_CLASS_PATH)) {
        @mkdir(GENERICOBJECT_CLASS_PATH, 0777, true) or die("Can't create folder " . GENERICOBJECT_CLASS_PATH);
    }
    //Init plugin & types
    plugin_init_genericobject();
    //Init profiles
    PluginGenericobjectProfile::changeProfile();
    return true;
}