e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
320 stars 214 forks source link

UEF - plugin UEF are always deleted if plugin is uninstalled #5028

Open Jimmi08 opened 1 year ago

Jimmi08 commented 1 year ago

Bug Description

Always deleting user extended fields when installing plugin

How to Reproduce

Expected Behavior

not touch UEF

Screenshots

image

image

image

PHP Version

PHP 8.2
Jimmi08 commented 1 year ago

I found this: those fields are created and deleted: file e_user.php

    /**
     * The same field format as admin-ui, with the addition of 'fieldType', 'read', 'write', 'appliable' and 'required' as used in extended fields table.
     *
     * @return array
     */
    function settings()
    {
        $fields = array();
        $fields['field1'] = array('title' => "Field 1",  'fieldType' => 'varchar(30)',  'read'=> e_UC_ADMIN, 'write'=>e_UC_MEMBER, 'type' => 'text', 'writeParms' => array('size' => 'xxlarge'));
        $fields['field2'] = array('title' => "Field 2",  'fieldType' => 'int(2)',       'type' => 'number', 'data'=>'int');
        $fields['field3'] = array('title' => "Field 3",  'fieldType' => 'int(1)',       'type' => 'method', 'data'=>'str', 'required'=>true); // see below.

        return $fields;

    }

But deleting plugins detects UEF by $eufields .= $spacer.'plugin_'.$plug_vars['folder'].'_'.$eu['@attributes']['name'];

from plugin.xml

    <extendedFields>
        <field name="custom" type='EUF_TEXTAREA' default='0' active="true" />
    </extendedFields>

image

The field from plugin.xml is not visible in UEF, but it is not deleted either, so the setting during installation is respected for this field.

Other fields shouldn't be deleted when I set not delete plugin tables. From the code is clear that they are always deleted if they are in the settings method in e_user.