Post by jrr » Wed Sep 04, 2024 3:04 pm

I'm trying to clean up my database from a few extensions that refuse to go cleanly. I deactivated them in extensions/modifications or extensions/extensions - then deleted them from extensions/installer, but bits of them remain and pop up at inopportune times as
Fatal error: Uncaught Exception: Error: Could not load model extension
or other bits of junk.

So I went into the database - and found under extensions three fields:

1: extension: extension_id, type, code
2: extension_install: extension_install_id, extension_download_id, filename
3: extension_path: extension_path_id, extension_install_id, path, date added

and I take a look in those...

#1 extension - the extension_id looks like it is a number assigned to a subsection of an extension and each id defines where that part goes in the extension tables such as type-payment - code-cod, type-total - code-shipping, type-total - code-handling, type-module - code-account and so on for a while, and then it reaches things like type-report - code-sale_coupon, type-dashboard - code-abandonedcarts (thought I deleted that!), type-total - code-customer_feediscount (I did delete that!). There seem to be leftovers here, but which are safe to delete? Certainly some are from deleted extensions.

However I moved on to

#2 extension_install - this looks good, as all that are listed (extension_install_id 6, 14, 19, 20, 22, 23, 24, 26, 29, &30) are one family of extensions that I didn't want to expunge. let's move on to

#3 extension_path - this too looks good - the paths are only related to the extension_install_id that I have in #2, so I don't think there are any problems here.

What remains then is how to safely clean up #1 extension - I am using MaxD's wonderful test_site extension for all this mucking around, sure saves breaking the site, and it allows me to experiment with deleting or modifying code in the test_site area leaving the real code and database unaffected.

Code: Select all

extension_id	 			type 		code 	
1 					payment 	cod
2 					total 		shipping
3 					total 		sub_total
4 					total 		tax
5 					total 		total
6 					module 		banner
7 					module 		carousel
8 					total 		credit
9 					shipping 	flat
10 					total 		handling
11 					total 		low_order_fee
12 					total 		coupon
13 					module 		category
14 					module 		account
15 					total 		reward
16 					total 		voucher
18 					module 		featured
19 					module 		slideshow
20 					theme 		default
21 					dashboard 	activity
22 					dashboard 	sale
23 					dashboard 	recent
24 					dashboard 	order
25 					dashboard 	online
26 					dashboard 	map
27 					dashboard 	customer
28 					dashboard 	chart
29 					report 		sale_coupon
31 					report 		customer_search
32 					report 		customer_transaction
33 					report 		product_purchased
34 					report 		product_viewed
35 					report 		sale_return
36 					report 		sale_order
37 					report 		sale_shipping
38 					report 		sale_tax
39 					report 		customer_activity
40 					report 		customer_order
41 					report 		customer_reward
42 					advertise 	google
43 					payment 	paypal
44 					payment 	cheque
45 					payment 	bank_transfer
48 					shipping 	pickup
60 					module 	paypal_smart_button
64 					captcha 	google
149 				payment 	squareup
74 					dashboard 	abandonedcarts
82 					analytics 	google
138 				total 	customer_feediscount
159 				module 	amazon_pay
164 				fraud 	ip
165 				fraud 	maxmind
168 				dashboard 	missing
169 				feed 	google_sitemap
170 				feed 	google_base
185 				hbseo 	hb_brokenlinks
186 				hbseo 	hb_sitemap
What do you think I can safely delete here? Understanding that I only have one added extension purposefully saved...which is a shipping extension. I think everything from report 28 through 186 can be deleted fairly safely...

Or is there something I can read up on that will explain how this is all extension install/uninstall is all put together for those of us brave (foolish) enough to dig into myphpadmin?

Thanks as always!

John :-#)#

jrr
Active Member

Posts

Joined
Mon Nov 20, 2017 1:48 pm

Post by by mona » Wed Sep 04, 2024 3:21 pm

Definitely do not even attempt to do what you are thinking about doing.

1. Back your site up
2. Find a backup from before you started deleting stuff and keep it safe

You uninstall in extension => modules
You delete from extension => installer
Any remnants, you remove the offending FILES using ftp

If you have a list and a back up you can find the files using your column type and this structure https://docs.opencart.com/en-gb/developer/module/
You should also be able to see which tables have been created if you really want to clean that. BE VERY VERY VERY CAREFUL

You do not remove any extensions from Opencart default - you can uninstall them in extension => extensions (in their relevant groups) this will remove the data from the db - but you leave the tables and the files exactly where they are.

Practically all those on your list are Opencart default.
These are not
dashboard abandonedcarts
dashboard missing
hbseo hb_brokenlinks
hbseo hb_sitemap

When you install an extension OCMOD makes a note of the files installed and deletes them when you delete it.
When you install in extensions => extensions => group, if the extension has been built "with standards" it creates the db tables
When you uninstall in extensions => extensions => group, if the extension has been built "with standards" is deletes the tables it created on install.

If you can not see it in the extension => installer list, it is usually OC default

It is often better to start with a fresh install anyway and transfer the data across.
Most people use something like https://www.opencart.com/index.php?rout ... sion_id=17
Or if you want to "delve into the db" - you can update the db manually yourself and that way you will learn how it all fits.
You would reinstall any extensions via the OCMOD installer - and install via extensions => extensions
That way when you uninstall everything works as it should.

BTW I forgot to mention
Fatal error: Uncaught Exception: Error: Could not load model extension
is not remnants - the opposite - you deleted a file you should not have done.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by jrr » Wed Sep 04, 2024 10:16 pm

Mona, thanks for taking the time to reply!

I appreciate the notes, I will read those areas over the next few days and see where it gets me. That really helps.

I am NOT doing any of these things to the 'real' store, these are all using MaxD's (Lightning) Test Site extension which allows me to muck around with a 'live' site and see what I end up with.

Actually, the full line of the error was:
Fatal error: Uncaught Exception: Error: Could not load model extension/total/productbundlestotal! in /(stuff)/test_site/system/storage/modification/system/engine/loader.php:89


This was with the clean install (and all extensions removed) of OC 3.0.4.0 in the test_site directory (using my database test_site copy) and I was getting that error after turning on the error display (white screen original result). What I did to bring the test site back to life was I removed the line in the dbase extension that had productbundlestotal!, much like the lines that have hb_sitemap, bank_transfer, etc. that are all added in from various extensions. Now the test_site is basically running but I haven't tested it.

The above was indeed done after I did the deactivates and deletions exactly as you said above. These are remnants of extensions that did not go into the dying of the light. And the others are (as you point out) part of OC and can't be messed with.

I'll do some digging around following your advice and report back here in the next day or two what I find....And I shall track down productbundlestotal! using ftp to see what is left in the various extension folders.

"A little knowledge is a dangerous thing..."

John :-#)#

jrr
Active Member

Posts

Joined
Mon Nov 20, 2017 1:48 pm

Post by by mona » Thu Sep 05, 2024 1:27 am

OC3.0.3.6 had a problem with the modification system.
I presume you had a fix for it or double refreshed.
Maybe you have deleted the fix?

A modification is calling for model/extension/productbundlestotal.php and the file is not there.
Which means maybe you deleted the extension but did not refresh the modification system or maybe deleted the ocmod fix required for 3.0.3.6 or maybe uninstalled the productbundlestotal and maybe did not disable the modification.

Playing around to learn is good, but this is definitely NOT the correct way to "clean your site". It does not achieve a clean site and causes all sorts of problems that might only be discovered 3months down the line.


All you are doing is removing lines from the database that are there for a reason. However, I do not disagree that it is the errors that teach you.
If there is a line in the db that says that dashboard abandonedcarts is still there, then it is still there - and it will still be there when you delete that line of code - you may not see that it is there, but it is .. "fur coat and no knickers". You are hiding the truth, not cleaning your site.

You copy data (like customers,products, categories, options etc. not modules, extensions, permissions etc.). If you copy over everything in the db, you are copying what was installed on 3.0.3.6 and either none existent or not yet been installed on 3.0.4.0.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by jrr » Thu Sep 05, 2024 3:26 pm

You copy data (like customers,products, categories, options etc. not modules, extensions, permissions etc.). If you copy over everything in the db, you are copying what was installed on 3.0.3.6 and either none existent or not yet been installed on 3.0.4.0.
I think what you are saying here is - it would be much better for me to simply build a clean 3.0.4.0 site, then install my complete DB backup onto that new empty DB. This would copy all the data, with none of the extension files or remnants - other than whatever DB tables that were added by the extensions. Then I would reinstall the extensions I still want and move forward from there. I would hope that the data in those extension DB tables will be reopened when I reinstall the extensions that I still want.

That is what I am hoping (as the cleanest, and simplest) is what you are recommending.

You also said:
OC3.0.3.6 had a problem with the modification system.
I presume you had a fix for it or double refreshed.
Maybe you have deleted the fix?
This problem with the modification system was something I wasn't fully aware of or had forgotten existed if I had once heard of it. I don't think I ever had a fix, although I did install a couple of extensions that were designed to fix a number of 3.0.3.6 shortcomings such as Clear Thinking's 3.0BugFixes and another that purported to help with twig issues Oc 3.0.3.6 Fix OCMOD (Not working with Twig).

Thanks,

John :-#)#

jrr
Active Member

Posts

Joined
Mon Nov 20, 2017 1:48 pm

Post by by mona » Fri Sep 06, 2024 6:27 am

What I was saying [ noting that this is a forum where others search, read and can blindly follow ] - you do not delete lines of code in the db.

There are many posts how to upgrade and generally not to upgrade but rather to install from fresh, rebuild and add YOUR data.
For example (which leads to another):
viewtopic.php?f=181&t=232146#p862037

The YOUR data part is important.
YOUR data will include YOUR DATA from used extensions, reinstalled to match your new OC version, but not the installation data.

That does not mean to clean the old db before your start and import everything.
It means import ONLY the relevant data that is YOUR data from the old database into the new one.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am
Who is online

Users browsing this forum: Semrush [Bot] and 5 guests