PDA

View Full Version : Template Edit / Revert Problem


Kier
Tue 15th Jun '04, 11:08am
If you are finding that when you edit or revert a template, especially from the Common Template Editor (http://www.vbulletin.com/docs/html/stylemanager_common_templates), you may find this document helpful.

This problem is usually caused by an incorrect index being set on your template table in the database. There are two ways to check for this problem:

Checking for the problem via SSH/Telnet command line


For technically proficient users, the command line is the quickest way to run the check. Open a telnet/SSH session to your server and run the following command:mysqldump -uusername -p --no-data databasename template


Towards the end of the output, you will see a line that looks either like this:

UNIQUE KEY title (title,styleid)
or like this:
KEY title (title,styleid)
If your output is missing the 'UNIQUE' part of the definition, you will need to continue reading this document to fix the table and create the correct index.

Checking for the problem via phpMyAdmin
If the command line is too scary for you, you can check the state of your table indexes using phpMyAdmin. Open up phpMyAdmin and browse through until you can see the structure of the template table in the database where you installed vBulletin.

Looking just below the main structure you will see a smaller section detailing your indexes. The first in the list will be a PRIMARY index on templateid. The second index listed should have a keyname of title and a type of UNIQUE. If the type is not UNIQUE, and instead says INDEX, you will need to read on to fix the problem.

Fixing the problem
Having identified that your database is affected by this problem (which is very rare) you will need to follow the following steps to fix it.

Firstly, run the following query through phpMyAdmin:
SELECT title, styleid, COUNT(*) AS instances
FROM template
GROUP BY title, styleid
HAVING instances > 1

This query will identify any duplicate templates that will prevent you from fixing the incorrect index.

You may find that the 'header' template for styleid 4 has 8 instances. You will need to delete all but the newest instance. To do this, run a search to find all templates called 'header' with styleid = 4, then delete every one of them except for the last one in the list. Repeat this procedure with each of the templates identified by the first query.

When you have finished removing all the duplicate templates, run the query above again to ensure that your work is complete. If it is, the query will return no results.

Finally, go back to the structure of the template table and click the Edit button next to the title/INDEX index. Change the Index type to UNIQUE and hit save.

If you have deleted the duplicate templates correctly, this index type change will work without a problem, and your edit/revert wierdness will be gone.

nostalgia
Wed 23rd Jun '04, 9:10am
I've some problem.
Sorry my English...

I tested my database with your patch(Template Edit / Revert Problem ).
----------------------------------------------------------------------------
->Run my Database : mysqldump -uusername -p --no-data databasename template
->I found : KEY title (title,styleid)
->Run query
-> -------------title --------styleid------- instances
editor_jsoptions_font ----------1 -------------3
--------------header ----------1 -------------14

->I can't find "styleid = 4"
->I searching "'header' with styleid = 4". But I can't find "'header' with styleid = 4".
->And I can't change from Index to UNIQUE with error.
----------------------------------------------------------------------------


->But, Till now my database has no problem.
I don't have any "Template Edit / Revert Problem".
What can I do for my database.

Thanks.

Kier
Wed 23rd Jun '04, 9:30am
Looking at your query result, you have 3 occurences of the editor_jsoptions_font template in styleid 1, and 14 instances of header also in styleid 1.

You will need to delete all of these except for one of each template, then you will be able to create the unique index.

Alternatively, wait for vB 3.0.2, to which I have added a repair system that will do all this for you for ALL affected database tables :)

starfantazy
Fri 20th Aug '04, 5:04am
im not sure but i think my problem may be related to this. for some reason, all my image links are broken and an apache error comes up stating

Not Acceptable

An appropriate representation of the requested resource /forums/admincp/misc.php could not be found on this server. i went and checked the server status and everything looks ok. i have no clue as to what is wrong and i also went into phpmyadmin and repaired all the tables...:confused:

Steve Machol
Fri 20th Aug '04, 2:39pm
Are you hosted by IMHOSTED.COM?

http://www.vbulletin.com/forum/showthread.php?p=722054#post722054

starfantazy
Sat 21st Aug '04, 3:29am
www.shadowhosting.com (http://www.shadowhosting.com/)