Post by andywoodrow » Tue Jan 21, 2020 9:53 pm

This is probably an extremely simplistic way to put it, but I'd like to know what actually happens when you click the 'Install' button for a newly installed plugin? I used OCMOD to install a plugin and got a 500 in the admin area pretty much immediately. I then backed out the changes using GIT and then uploaded all of the files from the plugin using the File Manager manually and now I have the 'Install' plugin viewable from the Modules list and I'd just like to understand what happens in the background when you click this button?

New member

Posts

Joined
Mon Nov 02, 2015 5:48 pm

Post by OSWorX » Tue Jan 21, 2020 10:24 pm

Basically 2 tasks:

1. copying the files from the upload folder from inside the package (.zip) to the server (same structure)
2. registering the modification in the database (table modification)

OpenCart 2.x had one important additional task (removed later with OpenCart 3.x): if the installer package contained a install.php, those commands were also made (e.g. copying files/folders, getting additional files, creatign database tables . .whatever the developer told to do ..) - could be very dangerous (that was one reason to remove that feature later).
For OpenCart 2.x that's it.

With OpenCart 3.x a few more tasks are intruduced:

3. storing title and date of the extension in the table extension_install (can be seen in the History Tab below the installer process)
4. storing the used extension files path in the table extension_path > this to remove the whole and complete Extension with all folders and files to avoid not used files anymore after an uninstalling process

That's it.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by thekrotek » Tue Jan 21, 2020 10:40 pm

OSWorX wrote:
Tue Jan 21, 2020 10:24 pm
That's it.
You've described Extension Installer functionality. When you click Install in Modules section, it registers the module does what module has coded in install() function (add database tables, events etc).

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by OSWorX » Tue Jan 21, 2020 11:18 pm

thekrotek wrote:
Tue Jan 21, 2020 10:40 pm
OSWorX wrote:
Tue Jan 21, 2020 10:24 pm
That's it.
You've described Extension Installer functionality. When you click Install in Modules section, it registers the module does what module has coded in install() function (add database tables, events etc).
Yes, sorry .. was too fast ..

But there is one important fact under OpenCart 2.x many forget (when included in package): the installer.php and install.sql
First could do everything, second only database related tasks.
Both are removed with OpenCart 3.x and OC 1.5 never had.

What was introduced with OpenCart 3.0.2.x is, that there are a few restrictions for extensions (primary for the OpenCart Cloud Solution):

List of allowed directories to be written to:

Code: Select all

'admin/controller/extension/',
		'admin/language/',
		'admin/model/extension/',
		'admin/view/image/',
		'admin/view/javascript/',
		'admin/view/stylesheet/',
		'admin/view/template/extension/',

		'catalog/controller/extension/',
		'catalog/language/',
		'catalog/model/extension/',
		'catalog/view/javascript/',
		'catalog/view/theme/',

		'system/config/',
		'system/library/',
		'image/catalog/'
And allowed folder for third party extensions:

Code: Select all

'extension/dashboard',
'extension/analytics',
'extension/captcha',
'extension/extension',
'extension/feed',
'extension/fraud',
'extension/module',
'extension/payment',
'extension/shipping',
'extension/theme',
'extension/total'
Just to mention that, because there exist one (or more) extensions which override these limitation.
I can only recommend NOT TO USE these hacks, the are some good reasons why these limitations exist!

Guess that all should be known, because there are several ways (especially OC 2.x) a system can be "destroyed" if the extension is not well coded.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by straightlight » Tue Jan 21, 2020 11:39 pm

Added in FAQ. Thanks.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 45 guests