CORE POS - IS4C
The CORE POS front end
Static Public Member Functions | Public Attributes | List of all members
InstallUtilities Class Reference
Inheritance diagram for InstallUtilities:
LibraryClass

Static Public Member Functions

static whoami ()
 
static checkWritable ($filename, $optional=False, $template=False)
 
static confsave ($key, $value, $prefer_local=false)
 
static confRemove ($key, $local=false)
 
static confExists ($key, $local=False)
 
static paramSave ($key, $value)
 
static loadSampleData ($sql, $table, $quiet=false)
 
static dbTestConnect ($host, $type, $db, $user, $pw)
 
static duplicateStructure ($dbms, $table1, $table2)
 
static createIfNeeded ($con, $dbms, $db_name, $table_name, $stddb, &$errors=array())
 
static dbStructureModify ($sql, $struct_name, $queries, &$errors=array())
 
static normalizeDbName ($name)
 
static installTextField ($name, $default_value='', $storage=self::EITHER_SETTING, $quoted=true, $attributes=array())
 
static installSelectField ($name, $options, $default_value='', $storage=self::EITHER_SETTING, $quoted=true, $attributes=array())
 
static installCheckboxField ($name, $label, $default_value=0, $storage=self::EITHER_SETTING, $choices=array(0, 1))
 
static validateConfiguration ()
 
static createOpDBs ($db, $name)
 
static createTransDBs ($db, $name)
 
static createMinServer ($db, $name)
 

Public Attributes

const INI_SETTING = 1
 
const PARAM_SETTING = 2
 
const EITHER_SETTING = 3
 

Member Function Documentation

static InstallUtilities::confRemove (   $key,
  $local = false 
)
static

Remove a value from config file(s)

Parameters
$keystring key
$localboolean optional default false remove from ini-local.php if applicable
Returns
boolean success
static InstallUtilities::confsave (   $key,
  $value,
  $prefer_local = false 
)
static

Save entry to config file(s)

Parameters
$keystring key
$valuestring value
$prefer_localuse ini-local if it exists
Returns
boolean success

Values are written to a file and must be valid PHP code. For example, a PHP string should include single or double quote delimiters in $value.

static InstallUtilities::createOpDBs (   $db,
  $name 
)
static

Create opdata tables and views

Parameters
$db[SQLManager] database connection
$name[string] database name
Returns
[array] of error messages
static InstallUtilities::createTransDBs (   $db,
  $name 
)
static

Create translog tables and views

Parameters
$db[SQLManager] database connection
$name[string] database name
Returns
[array] of error messages

Not using models for receipt views. Hopefully many of these can go away as deprecated.

static InstallUtilities::installSelectField (   $name,
  $options,
  $default_value = '',
  $storage = self::EITHER_SETTING,
  $quoted = true,
  $attributes = array() 
)
static

Render configuration variable as an <select> tag Process any form submissions Write configuration variable to config.php

Parameters
$name[string] name of the variable
$options[array] list of options This can be a keyed array in which case the keys are what is written to config.php and the values are what is shown in the user interface, or it can simply be an array of valid values.
$default_value[mixed, default empty string] default value for the setting
$quoted[boolean, default true] write value to config.php with single quotes
Returns
[string] html select field
static InstallUtilities::installTextField (   $name,
  $default_value = '',
  $storage = self::EITHER_SETTING,
  $quoted = true,
  $attributes = array() 
)
static

Render configuration variable as an <input> tag Process any form submissions Write configuration variable to config.php

Parameters
$name[string] name of the variable
$default_value[mixed, default empty string] default value for the setting
$quoted[boolean, default true] write value to config.php with single quotes
$attributes[array, default empty] array of <input> tag attribute names and values
Returns
[string] html input field

If default is array, value is probably supposed to be an array Split quoted values on whitespace, commas, and semicolons Split non-quoted values on non-numeric characters

static InstallUtilities::loadSampleData (   $sql,
  $table,
  $quiet = false 
)
static

Load sample data into the table

Parameters
$sql[SQLManager object] connected to database
$table[string] table name
$quiet[boolean, default false] suppress output
Returns
[boolean] success
alternate implementation

for non-mysql and/or LOAD DATA LOCAL not allowed

static InstallUtilities::paramSave (   $key,
  $value 
)
static

Save value to the parameters table.

static InstallUtilities::validateConfiguration ( )
static

Opposite of normal. Load the parameters table values first, then include ini.php second. If the resulting $CORE_LOCAL does not match the paramters table, that means ini.php overwrote a setting with a different value.

Again backwards. Check lane-specific parameters first

Now check global parameters

Finally, re-save any conflicting values. This should rewrite them in ini.php if that file is writable.


The documentation for this class was generated from the following file: