Extension:TableEdit/Loader

Execution Syntax/ Usage
The loader is a PHP class which must be instantiated to use.

See the Example script below.

The loader has a few options that can be set in the instantiation code.

Example
TableEdit ships with a sample script, but I'll add it here, too. This is a basic script which will:
 * 1) set up the wiki to be used ( by setting the variable $wikidir)
 * 2) include the loader class ( by giving the right path to the loader class in the require_once)
 * 3) make an object from the loader class
 * 4) set up some options for the object (verbosity, etc)
 * 5) load info into the tables in the wiki ( by calling the method loadFromFile)

running the script (loading information into the wiki)
Once you have a script like above, with the right variables and paths, you can then run that script to do the loading. In a command-line window, browse to the path where your script lives, and run it using the command php5 loader.sample.php /path/to/input_file

If you want to save the output into a file for later viewing, you can pipe the output like so: php5 loader.sample.php >& output.txt

You can also separate the output based on STDOUT and STDERR with this type of command: (php5 loader.sample.php > load.out) >& load.err

I/O
It takes a path to a formatted input file, and has a few options.

Input
The loader currently will accept one type of input:
 * 1) Extension:TableEdit/IFALT format

Output
On the commandline the loader will tell you what page it's working on. It will print any error messages to STDERR.

logic cases
There is a key method in the loader class which compares two rows. There are four return values:
 * 1) exact 	: the two rows match data regardless of whitespace
 * 2) disjoint	: the two rows are totally different
 * 3) subset	: the old row is a subset of the new row
 * 4) different	: they could have some common elements, but are regarded as different

How it works

 * 1) constructor sets up variables to use later
 * 2) options are set
 * 3) grabs a line from ifalt, parses it into data-structure
 * 4) creates object for page
 * 5) * if the page doesn't exist, check if the gene name redirects to another article, and use this one (follow the redirect)
 * 6) get content from the page
 * 7) create object for page template, get content
 * 8) get content from table template
 * 9) get the box_uid from the database using the page_uid
 * 10) * if that fails, try getting the box_uid from the database using the page_name
 * 11) * if that fails, then try and grab the box out of the wikitext of the page
 * 12) * if that fails, forget it--throw an error
 * 13) make a box object from the table info, make sure we've got the wikitext equivalent
 * 14) check what type of action we are doing (append, merge, clear)
 * 15) * if append:
 * 16) ** append rows and save metadata
 * 17) * if merge:
 * 18) ** compare new row to every row in the existing box
 * 19) ** we can do a plethora of things here, see above
 * 20) * if clear, clear old rows from table
 * 21) save the box object to the database
 * 22) replace the any old wikitext with the new wikitext and save the page
 * 23) unset the box object to keep from messing up next iteration