xoops forums

irmtfan

Module Developer
Posted on: 2013/5/8 11:38
irmtfan
irmtfan (Show more)
Module Developer
Posts: 3419
Since: 2003/12/7
#1

xoops256 bug (very important): template duplicate issue

I found a very old and bad bug in "tplfile" table.

if module template type was not "module" (if its type was admin) it will created countless duplicate templates with each update.

you can easily find this bug by updating system module several times then go to phpmyadmin and table "tplfile" and search for tpl_module = system
SELECT FROM PREFIX_tplfile WHERE tpl_module "system"


You can find duplicate rows.

to solve that i change 2 files + version in xoops_version.php
1- xoops256/modules/system/admin/modulesadmin/main.php
2- xoops256/modules/system/include/update.php
3- xoops256/modules/system/xoops_version.php

in xoops_version.php i just change the version from 2.10 to 2.11 to warn user to update system module.

I create a patch for this bug.
www.jadoogaran.org/d/XOOPS256_patch_duplicate_template.zip

also i update persian trunk:
http://svn.code.sf.net/p/xoops/svn//X ... uages/persian/core/trunk/

to implement:
1- upload and overwrite files.
2- go to admin > modules > system > modules > update "system module"
3- clear all caches in admin > modules > system > maintenance

Please test this patch first and then use it with your own risk in running websites.

irmtfan

Module Developer
Posted on: 2013/5/11 4:33
irmtfan
irmtfan (Show more)
Module Developer
Posts: 3419
Since: 2003/12/7
#2

Re: xoops256 bug (very important): template duplicate issue

I implement this bug fix in some small websites and the result is amazing. Now i dont need to use Altsys.
I think this bug is solved:
http://sourceforge.net/p/xoops/bugs/1221/
so please somebody refer to this bug comments.
If you see below very old core file, you can find a previous core developer tried to solve this bug a long time ago:
http://svn.code.sf.net/p/xoops/svn/Xo ... system/include/update.php
but he failed.
I used his code (I could use better codes too) to show you it can be solved.

irmtfan

Module Developer
Posted on: 2013/5/28 5:03
irmtfan
irmtfan (Show more)
Module Developer
Posts: 3419
Since: 2003/12/7
#3

Re: xoops256 bug (very important): template duplicate issue

Please somebody add this bug to sf.net tracker and if possible include the patch.
thank you.

Mamba

Moderator
Posted on: 2013/5/28 5:25
Mamba
Mamba (Show more)
Moderator
Posts: 10770
Since: 2004/4/23
#4

Re: xoops256 bug (very important): template duplicate issue

Done. See:
https://sourceforge.net/p/xoops/bugs/1273/
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

Mamba

Moderator
Posted on: 2013/9/15 1:34
Mamba
Mamba (Show more)
Moderator
Posts: 10770
Since: 2004/4/23
#5

Re: xoops256 bug (very important): template duplicate issue

This is been now tested and committed to SVN for "new" installations.

TODO: provide Upgrade for existing installation, which will require to remove duplicate records, or empty the table and then update all installed modules.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

irmtfan

Module Developer
Posted on: 2013/9/15 13:30
irmtfan
irmtfan (Show more)
Module Developer
Posts: 3419
Since: 2003/12/7
#6

Re: xoops256 bug (very important): template duplicate issue

Quote:

TODO: provide Upgrade for existing installation, which will require to remove duplicate records, or empty the table and then update all installed modules.


It is already done. user need to update system module after upgrade to newer xoops version and duplicate templates will be removed from table.

Mamba

Moderator
Posted on: 2013/9/15 13:42
Mamba
Mamba (Show more)
Moderator
Posts: 10770
Since: 2004/4/23
#7

Re: xoops256 bug (very important): template duplicate issue

I wish, it would be so easy!

You need to change the structure of the database, but since you have duplicate records, you can not add a "unique index key" to the database. So we need to either remove the duplicate records, or empty the table and then update the modules.

OK, unless I am missing something here

I admit, I have tried to add the unique key manually via phpMyAdmin, so I didn't try to just update the module.

So are you saying that I should try that, and it will work?

That would be cool
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

irmtfan

Module Developer
Posted on: 2013/9/28 1:54
irmtfan
irmtfan (Show more)
Module Developer
Posts: 3419
Since: 2003/12/7
#8

Re: xoops256 bug (very important): template duplicate issue

This fix is for upgrade previous xoops versions.
For a fresh install adding a unique key is enough.

irmtfan

Module Developer
Posted on: 2013/10/4 4:40
irmtfan
irmtfan (Show more)
Module Developer
Posts: 3419
Since: 2003/12/7
#9

Re: xoops256 bug (very important): template duplicate issue

Are we ready to implement this solution?
As I described earlier this solution is not the most efficient way for deleting duplicate templates. (It deleted duplicate templates one by one but they can be deleted at once)
We can improve it if you or core team prefer before implement to 2.5.7
But anyway IMO efficiency is not too important in update processes because update will be done only one time.
In update process accuracy and logs are important.