Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0.2.2] Extension uninstall delete all extension with same code and other #12708

Open
Scorpio256 opened this issue Sep 20, 2023 · 4 comments
Open

Comments

@Scorpio256
Copy link

I'm having problems with states and installing extensions. Mostly the biggest problem now is if I want to uninstall an extension that has the same name as, for example, the original one. I have a module that is in my extension folder normally goes to install and reports under a different extension code. However the extension is also called banner and if I click on uninstall banner extension from opencart it uninstalls mine as well.

If you look at the code, install correctly takes into account both the extension and the code but uninstall only the code

public function uninstall(string $type, string $code): void {

The second problem I'm referring to extension states should also take extension into account. It can happen that extensions have the same name and then report the same status. I've solved this for now by using an event. But I don't think I can completely replace the previous problem with an event.

public function event_extensionAllBefore(&$route, &$data,&$code) {
        if(count(explode("/",$route))>2){return;}
        foreach($data['extensions'] as $key => $extension) {
            $url = parse_url($extension['edit']);
            parse_str($url['query'], $query);
            $item = explode("/",$query['route']);
            $status_code = $item[2]."_".$item[1]."_".$item[3]."_status";
            if($this->config->get($status_code) && $extension['installed']) {
                $data['extensions'][$key]['status'] = $this->language->get('text_enabled');
            }
        }
    }
@danielkerr
Copy link
Member

are u unable to come up with a unique name for ur extension

@stalker780
Copy link
Contributor

This will always happen with third party modules.
The more extensions/modules you use the more is probability of duplicate module names. Every developer will create a simple module name. The same simple name :)

Otherwise all exensions and module names must look like this developer_myextension/developer_mymodule.
I would also include a developer birthday_qwerty123 to the name, just in case :)

You already have a unique extension code. What the sense in the unique module name? Just a waste of characters all over the code and stupid class names as a result.

OC4 needs to store/access all modules with extension prefix everywhere in the code.

@danielkerr danielkerr reopened this Dec 30, 2023
@Scorpio256
Copy link
Author

This will always happen with third party modules.
The more extensions/modules you use the more is probability of duplicate module names. Every developer will create a simple module name. The same simple name :)

Otherwise all exensions and module names must look like this developer_myextension/developer_mymodule.
I would also include a developer birthday_qwerty123 to the name, just in case :)

You already have a unique extension code. What the sense in the unique module name? Just a waste of characters all over the code and stupid class names as a result.

OC4 needs to store/access all modules with extension prefix everywhere in the code.

Yes, becouse of this I was forced to stupid naming for all extension just in case someone use same basic name. And becouse I have multiple modules in same extension directory this completely loose the potencional of moving extensions outside of base directories.

@mhcwebdesign
Copy link
Collaborator

@stalker780 : Given several extensions using e.g. module/banner.php where exactly what there be a clash? For example after an install it would look something like this:

extension//admin/controller/module/banner.php
....
extension//admin/controller/module/banner.php

These classes would be uniquely identified thanks to different namespaces:

Opencart\Admin\Controller\Extension<Ext-1>\Module\Banner
.....
Opencart\Admin\Controller\Extension<Ext-n>\Module\Banner

So where exactly do clashes occur between the different extensions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants