Gossamer Forum
Quote Reply
15-digit category code
I want to have 15-digits, instead of 10-digits for the category codes.

Links Admin does not provide for that change, so:

I manually changed the relevant .def files, and the relevant mysql tables.

Now, everything that is, or refers to the category codes is a BIGINT, size 15.

I can import data with 15-digits into the category table.

But when I tell Links Admin to rebuild the category tree, I get a fatal error:

No parent category found for [my category with a more-than-10-digit category code]!
Your Category table is corrupted. at [the directory] Upgrade.pm line 162.

Is there something I need to change somewhere in the perl that allows for these larger category codes?
Quote Reply
Re: [tora] 15-digit category code In reply to
Hi,

I'm not sure really what your asking? Are you saying your trying to increase the ID field to 15 digits long?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] 15-digit category code In reply to
Yes, what are the steps I need to do that?

So far I changed: .def files and mysql tables.
Quote Reply
Re: [tora] 15-digit category code In reply to
tora wrote:

But when I tell Links Admin to rebuild the category tree, I get a fatal error:

No parent category found for [my category with a more-than-10-digit category code]!
Your Category table is corrupted. at [the directory] Upgrade.pm line 162.

Is there something I need to change somewhere in the perl that allows for these larger category codes?


If you are importing the data, that is probably the problem.

I can't check, but Upgrade.pm probably does a sanity check on the fields, and might be sharing routines for the rebuild that are primarily used for the upgrade. But, therein probably lies the problem.

If you only changed the category table, you need to change all the other fields that use the category number such as the parent category, and all the dependencies. In the latest releases there was also a node builder of some sort, which would also need fields changed. It's been awhile since I have been working on this, and i don't have FTP access on this machine yet,. but I'll be working back into the development and support of Links SQL again.

This is something that probably should have been done via a plugin/script so that all the changes would be made at one time, while the system was off-line (down for maint, or whatever it's called).

While the .defs are in the defs directory, there are some embedded defs (or there were) for fields that were assumed not to ever change. such as the category ID. You might have to swat them or grep for any reference to ".def" in the code (if they use the standard table open call, they would use the def files in the def directory).

This is not a simple thing, in other words.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] 15-digit category code In reply to
Thanks, Pugdog.

Data import into mysql was fine.

I looked for all the other fields that need to be changed because they hold the category's ID, and I think I changed them all.

But where in the perl are those specs for fields you refer to?

Thanks so much to you, and everyone else, for helping me out!
Quote Reply
Re: [tora] 15-digit category code In reply to
tora wrote:
But where in the perl are those specs for fields you refer to?

Thanks so much to you, and everyone else, for helping me out!

I couldn't tell you :) I just remember bumping into them once or twice. I'm sure they are in the install routines, and perhaps in the upgrade routines. Then again, they might have been removed, finally. I haven't really looked into that code in almost 2 years. If your system runs, great. Just realize that if you apply an update or upgrade, you might hit some issues, and it would be related to that.

Also, if those are the files that are downloaded from GT to your system for an upgrade, it wouldn't matter if you changed them on your system.

So, if everything seems to run, great :) just be aware that it might stop working, and the reason is embedded defaults. And, the upgrade system might not work, if GT is using standard defaults on those fields....

More of a caution than fact.

Also, I remember working with the categories, and if categories were added outside of the normal update, the system needed to be rebuilt from the ground up, and it wasn't completely reliable. At one point I flattened the categories, and had a script import them as if they were user input. It's been way too long since I looked into this, so I can't say for sure. You might want to search for old threads, they would be 2+ years old, most likely, on rebuilding the categories. Might be flagged to my username. I'm just getting back into this, so it will take me some time to refresh myself on all the old stuff.

*BUT* if you are still getting the errors, in Upgrade.pm, the error seemed to be that the parent category didn't exist, which means some fields the software was expecting to hold a value, didn't. This means you have to rebuild the "tree" from the ground up. It was a tricky thing, and if you need 15-digit category codes... might even be a bit trickier. This was added in the last release or two of GL, and was supposed to add functionality in walking the categories, but it had some issues if not done just exactly right.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] 15-digit category code In reply to
I tried a few searches, but the closest I came was this post:

http://www.gossamer-threads.com//perl/gforum/gforum.cgi?post=292793#p292793

Which simply acknowledged an issue with category importing, and no time to figure out exactly why. So, I might be hitting it again.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] 15-digit category code In reply to
Thanks, it is possible that this is not in past posts.

Is there anywhere in the perl files that refers to specifications of the tables or their fields, other than the .def files?

Maybe I need to do some tweaking of those perl files so I don't get errors.

The manuals don't seem to cover this.
Quote Reply
Re: [tora] 15-digit category code In reply to
>> Maybe I need to do some tweaking of those perl files so I don't get errors.

Are you still getting errors?

If not, just go with it :)

But realize, that any time you do an upgrade, there might be problems because this is a customization that changes the very core functionality of GLinks.

So, if you do an upgrade, and things don't work, you will have to retrace the steps you did to make it work this time.
But more likely, the upgrade will simply fail.... and you'd have to apply it manually.
This would/could happen because during the upgrade, GLinks/Upgrader would replace some of the modified files (that it never expected to be modified) with the current version. There's no way around this for this sort of mod. If it happens, just keep in mind why, and how to fix it. (eg: retrace your original steps). But, it might not happen....

Again - I remember hitting .def info in some of the files, but this might have been cleaned up. It was for speed/efficiency and was for system fields as such which were never, ever, expected to change. If all the calls go through the standard links interface this will not be a problem.

If it's working, just go with it. If it's not working, what are the errors you are still getting?

NOTE also, that this should not affect the running of the program, just *potentially* functions like import, rebuild the base tree, or upgrades eg: management/maint functions. The rest of the code has always behaved according to the rules. These maint functions often assume things because they were never meant to be "user friendly" on a lower level.

When changing core functionality of the program, any program, expect some rough times.


Going through my notes, there were problems with importing/moving huge portions of the category trees. I ended up fixing most of them manually, using scripts to make changes. So, if that is still the issue, I guess I don't have the answer. The new category tree needs things in a very specific format to make sure it has all the data needed to operate as expected. The older structures were a bit more lenient because they didn't have any of the tree-walking/browsing functions available. I had problems with some of my older/modified sites during the upgrade process, while others just sailed through without a hitch.

Andy (I believe) had a fix-tree or fix-cat script that would try to fix up things, but I'm not sure it was for the latest version of the category structure.

So:
1) if everything is working great :)
2) if you are still having problems, what are they?


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [tora] 15-digit category code In reply to
If you're changing the category ID to be bigints, then you need to make sure you also update the FatherID column as well as the tree_id_fk and tree_anc_id_fk columns in the Category_tree table, CategoryID in the CatLinks table, cp_cat_id_fk in CatPrice table, CategoryID in CatRelations, CategoryID in Editors, and lastly CategoryID in the NewsletterSubscription table. Also note there's a small possibility of breaking future upgrades by doing this.

Adrian

Last edited by:

brewt: Apr 25, 2008, 4:27 PM
Quote Reply
Re: [brewt] 15-digit category code In reply to
Yes, thanks.

I have also changed:

CatRoot in the Category table
and
RelatedID in the CatRelations table

I can change these again when there are upgrades, or just not upgrade.

But I cannot figure out why it does not work now - this is a new installation.

If it is just a matter of creating the category tree, I can maybe do that manually, but I would rather not.

I am concerned that other things will not work properly - where in the perl is there reference to the size of the category field?

BTW, Gossamer-Threads hosts my site, so it is not a hosting-problem.
Quote Reply
Re: [tora] 15-digit category code In reply to
>> I am concerned that other things will not work properly - where in the perl is there reference to the size of the category field?

This is a hard thing to find/explain. But brewt supported the potential for broken upgrades.

If this is a new install, eg: no data in the tables at all.

1) make your changes. Remember when you edit the tables to resave the .def files. This is why doing it from a script is sometimes easier. Once you do that, you have to edit the fk_ relations as indicated.

2) try inputting data. If it works, you are in the right direction. It it doesn't you need to show us the error messages.

3) Keep a GOOD LIST of any changes you make and to what files. It will save your butt in the long run.

If you are trying to bulk-add data you need to make sure all the data is "cleaned" scrubbed and verified to fit all the required fields.

4) If you are using any plugins, make sure they are not saving the category ID, and are making "official" calls to the open table so the current (15 digit) def file is used.

post any error messages.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [tora] 15-digit category code In reply to
If you tell me which server, username and domain you're on, I can take a quick look.

What exactly isn't working?

Adrian