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.
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.