opencart
opencart copied to clipboard
[4.0.2.2] Extension uninstall delete all extension with same code and other
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 https://github.com/opencart/opencart/blob/9d79e3f299e85a1fcd2573d592fa4bfe6730981c/upload/admin/model/setting/extension.php#L75
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');
}
}
}
are u unable to come up with a unique name for ur extension
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.
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.
@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/
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?