Jump to content
TNG Community
Michel KIRSCH

SOLVED : Inserting a New table in TNG

Recommended Posts

Michel KIRSCH

This situation appears with mods "sosa" and "Special List". May be with others mods...

Inserting a new table in the TNG structure is done easily with :

1. Say somewhere (personnal cfg file, customconfig.php,... ) $xxx_table = "xxx_table";

2. insert a line in the list of tables in admin_utilities with   :   doRow( $xxx_table, "Text for XXX  table" );  ("XXX Table" may be "$text[']" language dependent variable)

And that's all. You can backup, restore and optimize your new table by clicking on the appropriate button in admin_utilities.php

BUT

If you want your table to be included in the list of tables to be backuped/restored/... when clicked "select all",
you must insert the name of the new table in the list of tables into admin_backup.restore.oprtimize.php files...
at the statement $tablelist = array( ....)

There is the problem...

Inserting the name by mod with :

%target:admin_backup.php%
%location:%
$dna_groups_table, $dna_links_table, $dna_tests_table
%end:%
%triminsert:after%
 , $xxx_table
%end:%

... works fine.

BUT if another mod makes the same (logical) reference to insert his new other_table,

%target:admin_backup.php%
%location:%
$dna_groups_table, $dna_links_table, $dna_tests_table
%end:%
%triminsert:after%
 , $other_table
%end:%

the first mod becomes "partially installed" and vice-versa, depending of the installation's order...

Both mods are functionning but one of the two stay "partially installed"

Have someone an idea to solve this type of conflict ??

For myself, I think that a tng_table containing  table_names is the only solution...

BR

Michel

Share this post


Link to post
Share on other sites
Ken Roy

Michel,

I have several mods that add new tables to TNG and do not have this problem.  Maybe your mod or the Special List mod needs to be updated to use a different technique

Share this post


Link to post
Share on other sites
Ken Roy

Michel,

I installed the Special List mod and both it and your Sosa mod show installed. 

38 minutes ago, Michel KIRSCH said:

Both mods are functionning but one of the two stay "partially installed"

Which mod shows partially installed?  Please indicate version numbers for the mods.

Share this post


Link to post
Share on other sites
Michel KIRSCH

Yes Ken,

Kare had the problem and  I edit a new version of sosa (the 6d you surely download) to fix the problem with "Special List".

The problem was with v6c and before...

Do you have some mods names which uses new tables in TNG?

Share this post


Link to post
Share on other sites
Michel KIRSCH

... And Special List is the actual online version 12.0.3.3 (april 2019)

Share this post


Link to post
Share on other sites
Ken Roy
37 minutes ago, Michel KIRSCH said:

Do you have some mods names which uses new tables in TNG?

The Census Plus International mod adds 6 new tables to the TNG database, the Same Person LinkPersistent Bookmarks each add a table to the TNG database, the Cousins mod adds 2 tables, and their might be others.  The mods listed are the ones I use.

With 242 mods shown in the Mods for TNG v12, it is only normal to have to resolve conflicts between mods.

Bart Degryse also created a Personal Table Maintenance mod that can be used to optimize, backup, and restore tables without having to modify the TNG programs.

 

Share this post


Link to post
Share on other sites
Michel KIRSCH

Thanks Ken,

reading the code of Bart gives me the solution :

instead inserting the name directly hard-coded in the list of tables,

modif the admin_backup.php (and _restore and _optimize..) with this statement :

array_push($tablelist,$xxx_table);

So your new table will be taking in account for the "All tables" operations.

No more problems...

Bart Degrijse's Personal Table Maintenance  is a good solution for personnal tables, but

shall not work for mod's distributed tables.

Thanks again Ken.

Michel

Share this post


Link to post
Share on other sites
Ken Roy
12 minutes ago, Michel KIRSCH said:

modif the admin_backup.php (and _restore and _optimize..) with this statement :

array_push($tablelist,$xxx_table);

My Same Person Link uses

	$tablelist = array_merge($tablelist, (array)$sameperson_table);

which is code that I copied from Bart's Persistent Bookmarks mod

Glad that my links helped you find a solution

Share this post


Link to post
Share on other sites
Michel KIRSCH

It was just a really little problem of PHP knowledge from my part...

the particular syntax ....array_merge ($tablelist, (array)$namesperson_table); used by Bart (= push in the array something that is NOT an array)

gives the same result as array_push($...) which is clearest.

Michel

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×