mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-16 18:31:26 +01:00
Formatting and comment adjustment
This commit is contained in:
parent
9f76c46b29
commit
21f0653bde
@ -20,7 +20,7 @@
|
|||||||
$this->m_sStatementTerminator = ";";
|
$this->m_sStatementTerminator = ";";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return a type suitable for DDL abstracted array
|
/* Return a type suitable for DDL abstracted array */
|
||||||
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
|
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
|
||||||
{
|
{
|
||||||
$sTranslated = $sType;
|
$sTranslated = $sType;
|
||||||
|
@ -11,332 +11,332 @@
|
|||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
class schema_proc_mssql
|
class schema_proc_mssql
|
||||||
{
|
|
||||||
var $m_sStatementTerminator;
|
|
||||||
// Following added to convert sql to array
|
|
||||||
var $sCol = array();
|
|
||||||
var $pk = array();
|
|
||||||
var $fk = array();
|
|
||||||
var $ix = array();
|
|
||||||
var $uc = array();
|
|
||||||
|
|
||||||
function schema_proc_mssql()
|
|
||||||
{
|
{
|
||||||
$this->m_sStatementTerminator = ";";
|
var $m_sStatementTerminator;
|
||||||
}
|
/* Following added to convert sql to array */
|
||||||
|
var $sCol = array();
|
||||||
|
var $pk = array();
|
||||||
|
var $fk = array();
|
||||||
|
var $ix = array();
|
||||||
|
var $uc = array();
|
||||||
|
|
||||||
// Return a type suitable for DDL
|
function schema_proc_mssql()
|
||||||
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
|
|
||||||
{
|
|
||||||
$sTranslated = "";
|
|
||||||
switch($sType)
|
|
||||||
{
|
{
|
||||||
case "auto":
|
$this->m_sStatementTerminator = ';';
|
||||||
$sTranslated = "int identity(1,1)";
|
|
||||||
break;
|
|
||||||
case "blob":
|
|
||||||
$sTranslated = "image"; // wonder how well PHP will support this???
|
|
||||||
break;
|
|
||||||
case "char":
|
|
||||||
if ($iPrecision > 0 && $iPrecision < 256)
|
|
||||||
{
|
|
||||||
$sTranslated = sprintf("char(%d)", $iPrecision);
|
|
||||||
}
|
|
||||||
if ($iPrecision > 255)
|
|
||||||
{
|
|
||||||
$sTranslated = "text";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "date":
|
|
||||||
$sTranslated = "smalldatetime";
|
|
||||||
break;
|
|
||||||
case "decimal":
|
|
||||||
$sTranslated = sprintf("decimal(%d,%d)", $iPrecision, $iScale);
|
|
||||||
break;
|
|
||||||
case "float":
|
|
||||||
switch ($iPrecision)
|
|
||||||
{
|
|
||||||
case 4:
|
|
||||||
$sTranslated = "float";
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
$sTranslated = "real";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "int":
|
|
||||||
switch ($iPrecision)
|
|
||||||
{
|
|
||||||
case 2:
|
|
||||||
$sTranslated = "smallint";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
case 8:
|
|
||||||
$sTranslated = "int";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "longtext":
|
|
||||||
$sTranslated = "longtext";
|
|
||||||
break;
|
|
||||||
case "text":
|
|
||||||
$sTranslated = "text";
|
|
||||||
break;
|
|
||||||
case "timestamp":
|
|
||||||
$sTranslated = "datetime";
|
|
||||||
break;
|
|
||||||
case "varchar":
|
|
||||||
if ($iPrecision > 0 && $iPrecision < 256)
|
|
||||||
{
|
|
||||||
$sTranslated = sprintf("varchar(%d)", $iPrecision);
|
|
||||||
}
|
|
||||||
if ($iPrecision > 255)
|
|
||||||
{
|
|
||||||
$sTranslated = "text";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (strlen($sTranslated) > 0);
|
/* Return a type suitable for DDL */
|
||||||
}
|
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
|
||||||
|
|
||||||
function TranslateDefault($sDefault)
|
|
||||||
{
|
|
||||||
switch ($sDefault)
|
|
||||||
{
|
{
|
||||||
case "current_date":
|
$sTranslated = '';
|
||||||
case "current_timestamp":
|
switch($sType)
|
||||||
return "GetDate()";
|
{
|
||||||
|
case 'auto':
|
||||||
|
$sTranslated = 'int identity(1,1)';
|
||||||
|
break;
|
||||||
|
case 'blob':
|
||||||
|
$sTranslated = 'image'; /* wonder how well PHP will support this??? */
|
||||||
|
break;
|
||||||
|
case 'char':
|
||||||
|
if ($iPrecision > 0 && $iPrecision < 256)
|
||||||
|
{
|
||||||
|
$sTranslated = sprintf("char(%d)", $iPrecision);
|
||||||
|
}
|
||||||
|
if ($iPrecision > 255)
|
||||||
|
{
|
||||||
|
$sTranslated = 'text';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'date':
|
||||||
|
$sTranslated = 'smalldatetime';
|
||||||
|
break;
|
||||||
|
case 'decimal':
|
||||||
|
$sTranslated = sprintf("decimal(%d,%d)", $iPrecision, $iScale);
|
||||||
|
break;
|
||||||
|
case 'float':
|
||||||
|
switch ($iPrecision)
|
||||||
|
{
|
||||||
|
case 4:
|
||||||
|
$sTranslated = 'float';
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
$sTranslated = 'real';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'int':
|
||||||
|
switch ($iPrecision)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
$sTranslated = 'smallint';
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
case 8:
|
||||||
|
$sTranslated = 'int';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'longtext':
|
||||||
|
$sTranslated = 'longtext';
|
||||||
|
break;
|
||||||
|
case 'text':
|
||||||
|
$sTranslated = 'text';
|
||||||
|
break;
|
||||||
|
case 'timestamp':
|
||||||
|
$sTranslated = 'datetime';
|
||||||
|
break;
|
||||||
|
case 'varchar':
|
||||||
|
if ($iPrecision > 0 && $iPrecision < 256)
|
||||||
|
{
|
||||||
|
$sTranslated = sprintf("varchar(%d)", $iPrecision);
|
||||||
|
}
|
||||||
|
if ($iPrecision > 255)
|
||||||
|
{
|
||||||
|
$sTranslated = 'text';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (strlen($sTranslated) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $sDefault;
|
function TranslateDefault($sDefault)
|
||||||
}
|
{
|
||||||
|
switch ($sDefault)
|
||||||
|
{
|
||||||
|
case 'current_date':
|
||||||
|
case 'current_timestamp':
|
||||||
|
return 'GetDate()';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sDefault;
|
||||||
|
}
|
||||||
|
|
||||||
// Inverse of above, convert sql column types to array info
|
// Inverse of above, convert sql column types to array info
|
||||||
function rTranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
|
function rTranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
|
||||||
{
|
|
||||||
$sTranslated = '';
|
|
||||||
if ($sType == 'int' || $sType == 'tinyint' || $sType == 'smallint')
|
|
||||||
{
|
{
|
||||||
if ($iPrecision > 8)
|
$sTranslated = '';
|
||||||
|
if ($sType == 'int' || $sType == 'tinyint' || $sType == 'smallint')
|
||||||
{
|
{
|
||||||
$iPrecision = 8;
|
if ($iPrecision > 8)
|
||||||
|
{
|
||||||
|
$iPrecision = 8;
|
||||||
|
}
|
||||||
|
elseif($iPrecision > 4)
|
||||||
|
{
|
||||||
|
$iPrecision = 4;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$iPrecision = 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elseif($iPrecision > 4)
|
switch($sType)
|
||||||
{
|
{
|
||||||
$iPrecision = 4;
|
case 'tinyint':
|
||||||
|
case 'smallint':
|
||||||
|
$sTranslated = "'type' => 'int', 'precision' => 2";
|
||||||
|
break;
|
||||||
|
case 'int':
|
||||||
|
$sTranslated = "'type' => 'int', 'precision' => 4";
|
||||||
|
break;
|
||||||
|
case 'char':
|
||||||
|
if ($iPrecision > 0 && $iPrecision < 256)
|
||||||
|
{
|
||||||
|
$sTranslated = "'type' => 'char', 'precision' => $iPrecision";
|
||||||
|
}
|
||||||
|
if ($iPrecision > 255)
|
||||||
|
{
|
||||||
|
$sTranslated = "'type' => 'text'";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'decimal':
|
||||||
|
$sTranslated = "'type' => 'decimal', 'precision' => $iPrecision, 'scale' => $iScale";
|
||||||
|
break;
|
||||||
|
case 'float':
|
||||||
|
case 'double':
|
||||||
|
$sTranslated = "'type' => 'float', 'precision' => $iPrecision";
|
||||||
|
break;
|
||||||
|
case 'smalldatetime':
|
||||||
|
$sTranslated = "'type' => 'date'";
|
||||||
|
break;
|
||||||
|
case 'datetime':
|
||||||
|
$sTranslated = "'type' => 'timestamp'";
|
||||||
|
break;
|
||||||
|
case 'varchar':
|
||||||
|
if ($iPrecision > 0 && $iPrecision < 256)
|
||||||
|
{
|
||||||
|
$sTranslated = "'type' => 'varchar', 'precision' => $iPrecision";
|
||||||
|
}
|
||||||
|
if ($iPrecision > 255)
|
||||||
|
{
|
||||||
|
$sTranslated = "'type' => 'text'";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'image':
|
||||||
|
$sTranslated = "'type' => 'blob'";
|
||||||
|
break;
|
||||||
|
case 'text':
|
||||||
|
$sTranslated = "'type' => '$sType'";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return (strlen($sTranslated) > 0);
|
||||||
$iPrecision = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch($sType)
|
|
||||||
{
|
|
||||||
case "tinyint":
|
|
||||||
case "smallint":
|
|
||||||
$sTranslated = "'type' => 'int', 'precision' => 2";
|
|
||||||
break;
|
|
||||||
case "int":
|
|
||||||
$sTranslated = "'type' => 'int', 'precision' => 4";
|
|
||||||
break;
|
|
||||||
case "char":
|
|
||||||
if ($iPrecision > 0 && $iPrecision < 256)
|
|
||||||
{
|
|
||||||
$sTranslated = "'type' => 'char', 'precision' => $iPrecision";
|
|
||||||
}
|
|
||||||
if ($iPrecision > 255)
|
|
||||||
{
|
|
||||||
$sTranslated = "'type' => 'text'";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "decimal":
|
|
||||||
$sTranslated = "'type' => 'decimal', 'precision' => $iPrecision, 'scale' => $iScale";
|
|
||||||
break;
|
|
||||||
case "float":
|
|
||||||
case "double":
|
|
||||||
$sTranslated = "'type' => 'float', 'precision' => $iPrecision";
|
|
||||||
break;
|
|
||||||
case "smalldatetime":
|
|
||||||
$sTranslated = "'type' => 'date'";
|
|
||||||
break;
|
|
||||||
case "datetime":
|
|
||||||
$sTranslated = "'type' => 'timestamp'";
|
|
||||||
break;
|
|
||||||
case "varchar":
|
|
||||||
if ($iPrecision > 0 && $iPrecision < 256)
|
|
||||||
{
|
|
||||||
$sTranslated = "'type' => 'varchar', 'precision' => $iPrecision";
|
|
||||||
}
|
|
||||||
if ($iPrecision > 255)
|
|
||||||
{
|
|
||||||
$sTranslated = "'type' => 'text'";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "image":
|
|
||||||
$sTranslated = "'type' => 'blob'";
|
|
||||||
break;
|
|
||||||
case "text":
|
|
||||||
$sTranslated = "'type' => '$sType'";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (strlen($sTranslated) > 0);
|
function GetPKSQL($sFields)
|
||||||
}
|
{
|
||||||
|
return "PRIMARY KEY($sFields)";
|
||||||
|
}
|
||||||
|
|
||||||
function GetPKSQL($sFields)
|
function GetUCSQL($sFields)
|
||||||
{
|
{
|
||||||
return "PRIMARY KEY($sFields)";
|
return "UNIQUE($sFields)";
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetUCSQL($sFields)
|
function _GetColumns($oProc, $sTableName, &$sColumns, $sDropColumn = '')
|
||||||
{
|
{
|
||||||
return "UNIQUE($sFields)";
|
$sColumns = '';
|
||||||
}
|
$this->pk = array();
|
||||||
|
$this->fk = array();
|
||||||
function _GetColumns($oProc, $sTableName, &$sColumns, $sDropColumn = "")
|
$this->ix = array();
|
||||||
{
|
$this->uc = array();
|
||||||
$sColumns = "";
|
|
||||||
$this->pk = array();
|
|
||||||
$this->fk = array();
|
|
||||||
$this->ix = array();
|
|
||||||
$this->uc = array();
|
|
||||||
|
|
||||||
// Field, Type, Null, Key, Default, Extra
|
// Field, Type, Null, Key, Default, Extra
|
||||||
$oProc->m_odb->query("exec sp_columns '$sTableName'");
|
$oProc->m_odb->query("exec sp_columns '$sTableName'");
|
||||||
while ($oProc->m_odb->next_record())
|
while ($oProc->m_odb->next_record())
|
||||||
{
|
|
||||||
$type = $default = $null = $nullcomma = $prec = $scale = $ret = $colinfo = $scales = '';
|
|
||||||
if ($sColumns != "")
|
|
||||||
{
|
{
|
||||||
$sColumns .= ",";
|
$type = $default = $null = $nullcomma = $prec = $scale = $ret = $colinfo = $scales = '';
|
||||||
}
|
if ($sColumns != '')
|
||||||
$sColumns .= $oProc->m_odb->f(0);
|
{
|
||||||
|
$sColumns .= ',';
|
||||||
|
}
|
||||||
|
$sColumns .= $oProc->m_odb->f(0);
|
||||||
|
|
||||||
// The rest of this is used only for SQL->array
|
// The rest of this is used only for SQL->array
|
||||||
$colinfo = explode('(',$oProc->m_odb->f(1));
|
$colinfo = explode('(',$oProc->m_odb->f(1));
|
||||||
$prec = ereg_replace(')','',$colinfo[1]);
|
$prec = ereg_replace(')','',$colinfo[1]);
|
||||||
$scales = explode(',',$prec);
|
$scales = explode(',',$prec);
|
||||||
if ($scales[1])
|
if ($scales[1])
|
||||||
{
|
{
|
||||||
$prec = $scales[0];
|
$prec = $scales[0];
|
||||||
$scale = $scales[1];
|
$scale = $scales[1];
|
||||||
}
|
}
|
||||||
$this->rTranslateType($colinfo[0], $prec, $scale, &$type);
|
$this->rTranslateType($colinfo[0], $prec, $scale, &$type);
|
||||||
|
|
||||||
if ($oProc->m_odb->f(2) == 'YES')
|
if ($oProc->m_odb->f(2) == 'YES')
|
||||||
{
|
{
|
||||||
$null = "'nullable' => True";
|
$null = "'nullable' => True";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$null = "'nullable' => False";
|
$null = "'nullable' => False";
|
||||||
}
|
}
|
||||||
if ($oProc->m_odb->f(4))
|
if ($oProc->m_odb->f(4))
|
||||||
{
|
{
|
||||||
$default = "'default' => '".$oProc->m_odb->f(4)."'";
|
$default = "'default' => '".$oProc->m_odb->f(4)."'";
|
||||||
$nullcomma = ',';
|
$nullcomma = ',';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$default = '';
|
$default = '';
|
||||||
$nullcomma = '';
|
$nullcomma = '';
|
||||||
}
|
}
|
||||||
if ($oProc->m_odb->f(5))
|
if ($oProc->m_odb->f(5))
|
||||||
{
|
{
|
||||||
$type = "'type' => 'auto'";
|
$type = "'type' => 'auto'";
|
||||||
}
|
}
|
||||||
$this->sCol[] = "\t\t\t\t'" . $oProc->m_odb->f(0)."' => array(" . $type . ',' . $null . $nullcomma . $default . '),' . "\n";
|
$this->sCol[] = "\t\t\t\t'" . $oProc->m_odb->f(0)."' => array(" . $type . ',' . $null . $nullcomma . $default . '),' . "\n";
|
||||||
if ($oProc->m_odb->f(3) == 'PRI')
|
if ($oProc->m_odb->f(3) == 'PRI')
|
||||||
{
|
{
|
||||||
$this->pk[] = $oProc->m_odb->f(0);
|
$this->pk[] = $oProc->m_odb->f(0);
|
||||||
}
|
}
|
||||||
if ($oProc->m_odb->f(3) == 'UNI')
|
if ($oProc->m_odb->f(3) == 'UNI')
|
||||||
{
|
{
|
||||||
$this->uc[] = $oProc->m_odb->f(0);
|
$this->uc[] = $oProc->m_odb->f(0);
|
||||||
}
|
}
|
||||||
// Hmmm, MUL could also mean unique, or not...
|
/* Hmmm, MUL could also mean unique, or not... */
|
||||||
if ($oProc->m_odb->f(3) == 'MUL')
|
if ($oProc->m_odb->f(3) == 'MUL')
|
||||||
{
|
{
|
||||||
$this->ix[] = $oProc->m_odb->f(0);
|
$this->ix[] = $oProc->m_odb->f(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
/* ugly as heck, but is here to chop the trailing comma on the last element (for php3) */
|
||||||
|
$this->sCol[count($this->sCol) - 1] = substr($this->sCol[count($this->sCol) - 1],0,-2) . "\n";
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
// ugly as heck, but is here to chop the trailing comma on the last element (for php3)
|
|
||||||
$this->sCol[count($this->sCol) - 1] = substr($this->sCol[count($this->sCol) - 1],0,-2) . "\n";
|
|
||||||
|
|
||||||
return false;
|
function DropTable($oProc, &$aTables, $sTableName)
|
||||||
}
|
{
|
||||||
|
return !!($oProc->m_odb->query("DROP TABLE " . $sTableName));
|
||||||
|
}
|
||||||
|
|
||||||
function DropTable($oProc, &$aTables, $sTableName)
|
function DropColumn($oProc, &$aTables, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true)
|
||||||
{
|
{
|
||||||
return !!($oProc->m_odb->query("DROP TABLE " . $sTableName));
|
return !!($oProc->m_odb->query("ALTER TABLE $sTableName DROP COLUMN $sColumnName"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function DropColumn($oProc, &$aTables, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true)
|
function RenameTable($oProc, &$aTables, $sOldTableName, $sNewTableName)
|
||||||
{
|
{
|
||||||
return !!($oProc->m_odb->query("ALTER TABLE $sTableName DROP COLUMN $sColumnName"));
|
return !!($oProc->m_odb->query("EXEC sp_rename '$sOldTableName', '$sNewTableName'"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function RenameTable($oProc, &$aTables, $sOldTableName, $sNewTableName)
|
function RenameColumn($oProc, &$aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
|
||||||
{
|
{
|
||||||
return !!($oProc->m_odb->query("EXEC sp_rename '$sOldTableName', '$sNewTableName'"));
|
|
||||||
}
|
|
||||||
|
|
||||||
function RenameColumn($oProc, &$aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
|
|
||||||
{
|
|
||||||
// This really needs testing - it can affect primary keys, and other table-related objects
|
// This really needs testing - it can affect primary keys, and other table-related objects
|
||||||
// like sequences and such
|
// like sequences and such
|
||||||
global $DEBUG;
|
global $DEBUG;
|
||||||
if ($DEBUG) { echo '<br>RenameColumn: calling _GetFieldSQL for ' . $sNewColumnName; }
|
if ($DEBUG) { echo '<br>RenameColumn: calling _GetFieldSQL for ' . $sNewColumnName; }
|
||||||
if ($oProc->_GetFieldSQL($aTables[$sTableName]["fd"][$sNewColumnName], $sNewColumnSQL))
|
if ($oProc->_GetFieldSQL($aTables[$sTableName]["fd"][$sNewColumnName], $sNewColumnSQL))
|
||||||
{
|
|
||||||
return !!($oProc->m_odb->query("EXEC sp_rename '$sTableName.$sOldColumnName', '$sNewColumnName'"));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function AlterColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef, $bCopyData = true)
|
|
||||||
{
|
|
||||||
global $DEBUG;
|
|
||||||
if ($DEBUG) { echo '<br>AlterColumn: calling _GetFieldSQL for ' . $sNewColumnName; }
|
|
||||||
if ($oProc->_GetFieldSQL($aTables[$sTableName]["fd"][$sColumnName], $sNewColumnSQL))
|
|
||||||
{
|
|
||||||
return !!($oProc->m_odb->query("ALTER TABLE $sTableName ALTER COLUMN $sColumnName " . $sNewColumnSQL));
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function AddColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef)
|
|
||||||
{
|
|
||||||
$oProc->_GetFieldSQL($aColumnDef, $sFieldSQL);
|
|
||||||
$query = "ALTER TABLE $sTableName ADD COLUMN $sColumnName $sFieldSQL";
|
|
||||||
|
|
||||||
return !!($oProc->m_odb->query($query));
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetSequenceSQL($sTableName, &$sSequenceSQL)
|
|
||||||
{
|
|
||||||
$sSequenceSQL = "";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function CreateTable($oProc, &$aTables, $sTableName, $aTableDef)
|
|
||||||
{
|
|
||||||
if ($oProc->_GetTableSQL($sTableName, $aTableDef, $sTableSQL, $sSequenceSQL))
|
|
||||||
{
|
|
||||||
// create sequence first since it will be needed for default
|
|
||||||
if ($sSequenceSQL != "")
|
|
||||||
{
|
{
|
||||||
$oProc->m_odb->query($sSequenceSQL);
|
return !!($oProc->m_odb->query("EXEC sp_rename '$sTableName.$sOldColumnName', '$sNewColumnName'"));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function AlterColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef, $bCopyData = true)
|
||||||
|
{
|
||||||
|
global $DEBUG;
|
||||||
|
if ($DEBUG) { echo '<br>AlterColumn: calling _GetFieldSQL for ' . $sNewColumnName; }
|
||||||
|
if ($oProc->_GetFieldSQL($aTables[$sTableName]["fd"][$sColumnName], $sNewColumnSQL))
|
||||||
|
{
|
||||||
|
return !!($oProc->m_odb->query("ALTER TABLE $sTableName ALTER COLUMN $sColumnName " . $sNewColumnSQL));
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = "CREATE TABLE $sTableName ($sTableSQL)";
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function AddColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef)
|
||||||
|
{
|
||||||
|
$oProc->_GetFieldSQL($aColumnDef, $sFieldSQL);
|
||||||
|
$query = "ALTER TABLE $sTableName ADD COLUMN $sColumnName $sFieldSQL";
|
||||||
|
|
||||||
return !!($oProc->m_odb->query($query));
|
return !!($oProc->m_odb->query($query));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
function GetSequenceSQL($sTableName, &$sSequenceSQL)
|
||||||
}
|
{
|
||||||
}
|
$sSequenceSQL = '';
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CreateTable($oProc, &$aTables, $sTableName, $aTableDef)
|
||||||
|
{
|
||||||
|
if ($oProc->_GetTableSQL($sTableName, $aTableDef, $sTableSQL, $sSequenceSQL))
|
||||||
|
{
|
||||||
|
// create sequence first since it will be needed for default
|
||||||
|
if ($sSequenceSQL != '')
|
||||||
|
{
|
||||||
|
$oProc->m_odb->query($sSequenceSQL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = "CREATE TABLE $sTableName ($sTableSQL)";
|
||||||
|
return !!($oProc->m_odb->query($query));
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
class schema_proc_mysql
|
class schema_proc_mysql
|
||||||
{
|
{
|
||||||
var $m_sStatementTerminator;
|
var $m_sStatementTerminator;
|
||||||
// Following added to convert sql to array
|
/* Following added to convert sql to array */
|
||||||
var $sCol = array();
|
var $sCol = array();
|
||||||
var $pk = array();
|
var $pk = array();
|
||||||
var $fk = array();
|
var $fk = array();
|
||||||
@ -26,7 +26,7 @@
|
|||||||
$this->m_sStatementTerminator = ';';
|
$this->m_sStatementTerminator = ';';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return a type suitable for DDL
|
/* Return a type suitable for DDL */
|
||||||
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
|
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
|
||||||
{
|
{
|
||||||
$sTranslated = '';
|
$sTranslated = '';
|
||||||
@ -115,7 +115,7 @@
|
|||||||
return $sDefault;
|
return $sDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inverse of above, convert sql column types to array info
|
/* Inverse of above, convert sql column types to array info */
|
||||||
function rTranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
|
function rTranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
|
||||||
{
|
{
|
||||||
$sTranslated = '';
|
$sTranslated = '';
|
||||||
@ -166,7 +166,7 @@
|
|||||||
$sTranslated = "'type' => 'timestamp'";
|
$sTranslated = "'type' => 'timestamp'";
|
||||||
break;
|
break;
|
||||||
case 'enum':
|
case 'enum':
|
||||||
// Here comes a nasty assumption
|
/* Here comes a nasty assumption */
|
||||||
$sTranslated = "'type' => 'varchar', 'precision' => 255";
|
$sTranslated = "'type' => 'varchar', 'precision' => 255";
|
||||||
break;
|
break;
|
||||||
case 'varchar':
|
case 'varchar':
|
||||||
@ -208,7 +208,7 @@
|
|||||||
$this->ix = array();
|
$this->ix = array();
|
||||||
$this->uc = array();
|
$this->uc = array();
|
||||||
|
|
||||||
// Field, Type, Null, Key, Default, Extra
|
/* Field, Type, Null, Key, Default, Extra */
|
||||||
$oProc->m_odb->query("describe $sTableName");
|
$oProc->m_odb->query("describe $sTableName");
|
||||||
while ($oProc->m_odb->next_record())
|
while ($oProc->m_odb->next_record())
|
||||||
{
|
{
|
||||||
@ -219,7 +219,7 @@
|
|||||||
}
|
}
|
||||||
$sColumns .= $oProc->m_odb->f(0);
|
$sColumns .= $oProc->m_odb->f(0);
|
||||||
|
|
||||||
// The rest of this is used only for SQL->array
|
/* The rest of this is used only for SQL->array */
|
||||||
$colinfo = explode('(',$oProc->m_odb->f(1));
|
$colinfo = explode('(',$oProc->m_odb->f(1));
|
||||||
$prec = ereg_replace(')','',$colinfo[1]);
|
$prec = ereg_replace(')','',$colinfo[1]);
|
||||||
$scales = explode(',',$prec);
|
$scales = explode(',',$prec);
|
||||||
@ -261,13 +261,13 @@
|
|||||||
{
|
{
|
||||||
$this->uc[] = $oProc->m_odb->f(0);
|
$this->uc[] = $oProc->m_odb->f(0);
|
||||||
}
|
}
|
||||||
// Hmmm, MUL could also mean unique, or not...
|
/* Hmmm, MUL could also mean unique, or not... */
|
||||||
if ($oProc->m_odb->f(3) == 'MUL')
|
if ($oProc->m_odb->f(3) == 'MUL')
|
||||||
{
|
{
|
||||||
$this->ix[] = $oProc->m_odb->f(0);
|
$this->ix[] = $oProc->m_odb->f(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ugly as heck, but is here to chop the trailing comma on the last element (for php3)
|
/* ugly as heck, but is here to chop the trailing comma on the last element (for php3) */
|
||||||
$this->sCol[count($this->sCol) - 1] = substr($this->sCol[count($this->sCol) - 1],0,-2) . "\n";
|
$this->sCol[count($this->sCol) - 1] = substr($this->sCol[count($this->sCol) - 1],0,-2) . "\n";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -290,8 +290,10 @@
|
|||||||
|
|
||||||
function RenameColumn($oProc, &$aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
|
function RenameColumn($oProc, &$aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
|
||||||
{
|
{
|
||||||
// This really needs testing - it can affect primary keys, and other table-related objects
|
/*
|
||||||
// like sequences and such
|
TODO: This really needs testing - it can affect primary keys, and other table-related objects
|
||||||
|
like sequences and such
|
||||||
|
*/
|
||||||
global $DEBUG;
|
global $DEBUG;
|
||||||
if ($DEBUG) { echo '<br>RenameColumn: calling _GetFieldSQL for ' . $sNewColumnName; }
|
if ($DEBUG) { echo '<br>RenameColumn: calling _GetFieldSQL for ' . $sNewColumnName; }
|
||||||
if ($oProc->_GetFieldSQL($aTables[$sTableName]["fd"][$sNewColumnName], $sNewColumnSQL))
|
if ($oProc->_GetFieldSQL($aTables[$sTableName]["fd"][$sNewColumnName], $sNewColumnSQL))
|
||||||
@ -332,7 +334,7 @@
|
|||||||
{
|
{
|
||||||
if ($oProc->_GetTableSQL($sTableName, $aTableDef, $sTableSQL, $sSequenceSQL))
|
if ($oProc->_GetTableSQL($sTableName, $aTableDef, $sTableSQL, $sSequenceSQL))
|
||||||
{
|
{
|
||||||
// create sequence first since it will be needed for default
|
/* create sequence first since it will be needed for default */
|
||||||
if ($sSequenceSQL != '')
|
if ($sSequenceSQL != '')
|
||||||
{
|
{
|
||||||
$oProc->m_odb->query($sSequenceSQL);
|
$oProc->m_odb->query($sSequenceSQL);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
class schema_proc_pgsql
|
class schema_proc_pgsql
|
||||||
{
|
{
|
||||||
var $m_sStatementTerminator;
|
var $m_sStatementTerminator;
|
||||||
// Following added to convert sql to array
|
/* Following added to convert sql to array */
|
||||||
var $sCol = array();
|
var $sCol = array();
|
||||||
var $pk = array();
|
var $pk = array();
|
||||||
var $fk = array();
|
var $fk = array();
|
||||||
@ -30,7 +30,7 @@
|
|||||||
$this->m_sStatementTerminator = ';';
|
$this->m_sStatementTerminator = ';';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return a type suitable for DDL
|
/* Return a type suitable for DDL */
|
||||||
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
|
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
|
||||||
{
|
{
|
||||||
switch($sType)
|
switch($sType)
|
||||||
@ -105,7 +105,7 @@
|
|||||||
return $sDefault;
|
return $sDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inverse of above, convert sql column types to array info
|
/* Inverse of above, convert sql column types to array info */
|
||||||
function rTranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
|
function rTranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
|
||||||
{
|
{
|
||||||
$sTranslated = '';
|
$sTranslated = '';
|
||||||
@ -234,7 +234,7 @@
|
|||||||
and a.attrelid = c.oid
|
and a.attrelid = c.oid
|
||||||
and a.atttypid = t.oid
|
and a.atttypid = t.oid
|
||||||
ORDER BY a.attnum";
|
ORDER BY a.attnum";
|
||||||
// attnum field type length lengthvar notnull(Yes/No)
|
/* attnum field type length lengthvar notnull(Yes/No) */
|
||||||
$sdb->query($sql_get_fields);
|
$sdb->query($sql_get_fields);
|
||||||
while ($sdb->next_record())
|
while ($sdb->next_record())
|
||||||
{
|
{
|
||||||
@ -341,7 +341,7 @@
|
|||||||
$this->uc[] = $sdc->f(2);
|
$this->uc[] = $sdc->f(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ugly as heck, but is here to chop the trailing comma on the last element (for php3)
|
/* ugly as heck, but is here to chop the trailing comma on the last element (for php3) */
|
||||||
$this->sCol[count($this->sCol) - 1] = substr($this->sCol[count($this->sCol) - 1],0,-2) . "\n";
|
$this->sCol[count($this->sCol) - 1] = substr($this->sCol[count($this->sCol) - 1],0,-2) . "\n";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -526,8 +526,10 @@
|
|||||||
|
|
||||||
function RenameColumn($oProc, &$aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
|
function RenameColumn($oProc, &$aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
|
||||||
{
|
{
|
||||||
// This really needs testing - it can affect primary keys, and other table-related objects
|
/*
|
||||||
// like sequences and such
|
This really needs testing - it can affect primary keys, and other table-related objects
|
||||||
|
like sequences and such
|
||||||
|
*/
|
||||||
if ($bCopyData)
|
if ($bCopyData)
|
||||||
{
|
{
|
||||||
$oProc->m_odb->query("SELECT * INTO $sTableName" . "_tmp FROM $sTableName");
|
$oProc->m_odb->query("SELECT * INTO $sTableName" . "_tmp FROM $sTableName");
|
||||||
@ -565,10 +567,12 @@
|
|||||||
$this->CreateTable($oProc, $aTables, $sTableName, $aTables[$sTableName], True);
|
$this->CreateTable($oProc, $aTables, $sTableName, $aTables[$sTableName], True);
|
||||||
$this->_GetColumns($oProc, $sTableName . "_tmp", $sColumns, '', $sColumnName, $aColumnDef['type'] == 'auto' ? 'int4' : $aColumnDef['type']);
|
$this->_GetColumns($oProc, $sTableName . "_tmp", $sColumns, '', $sColumnName, $aColumnDef['type'] == 'auto' ? 'int4' : $aColumnDef['type']);
|
||||||
|
|
||||||
// TODO: analyze the type of change and determine if this is used or _CopyAlteredTable
|
/*
|
||||||
// this is a performance consideration only, _CopyAlteredTable should be safe
|
TODO: analyze the type of change and determine if this is used or _CopyAlteredTable
|
||||||
//$query = "INSERT INTO $sTableName SELECT $sColumns FROM $sTableName" . "_tmp";
|
this is a performance consideration only, _CopyAlteredTable should be safe
|
||||||
//$bRet = !!($oProc->m_odb->query($query));
|
$query = "INSERT INTO $sTableName SELECT $sColumns FROM $sTableName" . "_tmp";
|
||||||
|
$bRet = !!($oProc->m_odb->query($query));
|
||||||
|
*/
|
||||||
|
|
||||||
$bRet = $this->_CopyAlteredTable($oProc, $aTables, $sTableName . '_tmp', $sTableName);
|
$bRet = $this->_CopyAlteredTable($oProc, $aTables, $sTableName . '_tmp', $sTableName);
|
||||||
|
|
||||||
@ -594,7 +598,7 @@
|
|||||||
global $DEBUG;
|
global $DEBUG;
|
||||||
if ($oProc->_GetTableSQL($sTableName, $aTableDef, $sTableSQL, $sSequenceSQL))
|
if ($oProc->_GetTableSQL($sTableName, $aTableDef, $sTableSQL, $sSequenceSQL))
|
||||||
{
|
{
|
||||||
// create sequence first since it will be needed for default
|
/* create sequence first since it will be needed for default */
|
||||||
if ($bCreateSequence && $sSequenceSQL != '')
|
if ($bCreateSequence && $sSequenceSQL != '')
|
||||||
{
|
{
|
||||||
if ($DEBUG) { echo '<br>Making sequence using: ' . $sSequenceSQL; }
|
if ($DEBUG) { echo '<br>Making sequence using: ' . $sSequenceSQL; }
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
$GLOBALS['phpgw_info']['server']['api_inc'] = PHPGW_SERVER_ROOT . '/phpgwapi/inc';
|
$GLOBALS['phpgw_info']['server']['api_inc'] = PHPGW_SERVER_ROOT . '/phpgwapi/inc';
|
||||||
}
|
}
|
||||||
include($GLOBALS['phpgw_info']['server']['api_inc'] . '/class.db_'.$GLOBALS['phpgw_domain'][$ConfigDomain]['db_type'].'.inc.php');
|
include($GLOBALS['phpgw_info']['server']['api_inc'] . '/class.db_'.$GLOBALS['phpgw_domain'][$ConfigDomain]['db_type'].'.inc.php');
|
||||||
$this->db = new db;
|
$this->db = new db;
|
||||||
$this->db->Host = $GLOBALS['phpgw_domain'][$ConfigDomain]['db_host'];
|
$this->db->Host = $GLOBALS['phpgw_domain'][$ConfigDomain]['db_host'];
|
||||||
$this->db->Type = $GLOBALS['phpgw_domain'][$ConfigDomain]['db_type'];
|
$this->db->Type = $GLOBALS['phpgw_domain'][$ConfigDomain]['db_type'];
|
||||||
$this->db->Database = $GLOBALS['phpgw_domain'][$ConfigDomain]['db_name'];
|
$this->db->Database = $GLOBALS['phpgw_domain'][$ConfigDomain]['db_name'];
|
||||||
@ -75,15 +75,15 @@
|
|||||||
$FormLogout == 'ldapimport' ||
|
$FormLogout == 'ldapimport' ||
|
||||||
$FormLogout == 'sqltoarray')
|
$FormLogout == 'sqltoarray')
|
||||||
{
|
{
|
||||||
setcookie('ConfigPW'); // scrub the old one
|
setcookie('ConfigPW'); /* scrub the old one */
|
||||||
setcookie('ConfigDomain'); // scrub the old one
|
setcookie('ConfigDomain'); /* scrub the old one */
|
||||||
setcookie('ConfigLang');
|
setcookie('ConfigLang');
|
||||||
$GLOBALS['phpgw_info']['setup']['ConfigLoginMSG'] = 'You have successfully logged out';
|
$GLOBALS['phpgw_info']['setup']['ConfigLoginMSG'] = 'You have successfully logged out';
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
elseif($FormLogout == 'header')
|
elseif($FormLogout == 'header')
|
||||||
{
|
{
|
||||||
setcookie('HeaderPW'); // scrub the old one
|
setcookie('HeaderPW'); /* scrub the old one */
|
||||||
$GLOBALS['phpgw_info']['setup']['HeaderLoginMSG'] = 'You have successfully logged out';
|
$GLOBALS['phpgw_info']['setup']['HeaderLoginMSG'] = 'You have successfully logged out';
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
@ -92,8 +92,8 @@
|
|||||||
{
|
{
|
||||||
if ($ConfigPW != $GLOBALS['phpgw_domain'][$ConfigDomain]['config_passwd'] && $auth_type == 'Config')
|
if ($ConfigPW != $GLOBALS['phpgw_domain'][$ConfigDomain]['config_passwd'] && $auth_type == 'Config')
|
||||||
{
|
{
|
||||||
setcookie('ConfigPW'); // scrub the old one
|
setcookie('ConfigPW'); /* scrub the old one */
|
||||||
setcookie('ConfigDomain'); // scrub the old one
|
setcookie('ConfigDomain'); /* scrub the old one */
|
||||||
setcookie('ConfigLang');
|
setcookie('ConfigLang');
|
||||||
$GLOBALS['phpgw_info']['setup']['ConfigLoginMSG'] = 'Invalid session cookie (cookies must be enabled)';
|
$GLOBALS['phpgw_info']['setup']['ConfigLoginMSG'] = 'Invalid session cookie (cookies must be enabled)';
|
||||||
return False;
|
return False;
|
||||||
@ -109,7 +109,7 @@
|
|||||||
{
|
{
|
||||||
if ($FormPW == $GLOBALS['phpgw_domain'][$FormDomain]['config_passwd'] && $auth_type == 'Config')
|
if ($FormPW == $GLOBALS['phpgw_domain'][$FormDomain]['config_passwd'] && $auth_type == 'Config')
|
||||||
{
|
{
|
||||||
setcookie('HeaderPW'); // scrub the old one
|
setcookie('HeaderPW'); /* scrub the old one */
|
||||||
setcookie('ConfigPW',$FormPW);
|
setcookie('ConfigPW',$FormPW);
|
||||||
setcookie('ConfigDomain',$FormDomain);
|
setcookie('ConfigDomain',$FormDomain);
|
||||||
setcookie('ConfigLang',$ConfigLang);
|
setcookie('ConfigLang',$ConfigLang);
|
||||||
@ -140,7 +140,7 @@
|
|||||||
{
|
{
|
||||||
if ($HeaderPW != $GLOBALS['phpgw_info']['server']['header_admin_password'] && $auth_type == 'Header')
|
if ($HeaderPW != $GLOBALS['phpgw_info']['server']['header_admin_password'] && $auth_type == 'Header')
|
||||||
{
|
{
|
||||||
setcookie('HeaderPW'); // scrub the old one
|
setcookie('HeaderPW'); /* scrub the old one */
|
||||||
$GLOBALS['phpgw_info']['setup']['HeaderLoginMSG'] = 'Invalid session cookie (cookies must be enabled)';
|
$GLOBALS['phpgw_info']['setup']['HeaderLoginMSG'] = 'Invalid session cookie (cookies must be enabled)';
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
@ -232,7 +232,7 @@
|
|||||||
if($GLOBALS['DEBUG'])
|
if($GLOBALS['DEBUG'])
|
||||||
{
|
{
|
||||||
echo '<br>register_app(): ' . $appname . ', version: ' . $setup_info[$appname]['version'] . ', table: ' . $appstbl . '<br>';
|
echo '<br>register_app(): ' . $appname . ', version: ' . $setup_info[$appname]['version'] . ', table: ' . $appstbl . '<br>';
|
||||||
//var_dump($setup_info[$appname]);
|
// _debug_array($setup_info[$appname]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($setup_info[$appname]['version'])
|
if ($setup_info[$appname]['version'])
|
||||||
@ -298,7 +298,7 @@
|
|||||||
if($GLOBALS['DEBUG'])
|
if($GLOBALS['DEBUG'])
|
||||||
{
|
{
|
||||||
echo '<br>app_registered(): checking ' . $appname . ', table: ' . $appstbl;
|
echo '<br>app_registered(): checking ' . $appname . ', table: ' . $appstbl;
|
||||||
//var_dump($setup_info[$appname]);
|
// _debug_array($setup_info[$appname]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->query("SELECT COUNT(app_name) FROM $appstbl WHERE app_name='".$appname."'");
|
$this->db->query("SELECT COUNT(app_name) FROM $appstbl WHERE app_name='".$appname."'");
|
||||||
@ -345,7 +345,7 @@
|
|||||||
if($GLOBALS['DEBUG'])
|
if($GLOBALS['DEBUG'])
|
||||||
{
|
{
|
||||||
echo '<br>update_app(): ' . $appname . ', version: ' . $setup_info[$appname]['currentver'] . ', table: ' . $appstbl . '<br>';
|
echo '<br>update_app(): ' . $appname . ', version: ' . $setup_info[$appname]['currentver'] . ', table: ' . $appstbl . '<br>';
|
||||||
//var_dump($setup_info[$appname]);
|
// _debug_array($setup_info[$appname]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->query("SELECT COUNT(app_name) FROM $appstbl WHERE app_name='".$appname."'");
|
$this->db->query("SELECT COUNT(app_name) FROM $appstbl WHERE app_name='".$appname."'");
|
||||||
@ -453,7 +453,7 @@
|
|||||||
|
|
||||||
if ($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.8pre5') && ($setup_info['phpgwapi']['currentver'] != ''))
|
if ($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.8pre5') && ($setup_info['phpgwapi']['currentver'] != ''))
|
||||||
{
|
{
|
||||||
// No phpgw_hooks table yet.
|
/* No phpgw_hooks table yet. */
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,7 +496,7 @@
|
|||||||
|
|
||||||
if ($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.8pre5'))
|
if ($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.8pre5'))
|
||||||
{
|
{
|
||||||
// No phpgw_hooks table yet.
|
/* No phpgw_hooks table yet. */
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,7 +598,7 @@
|
|||||||
$less++;
|
$less++;
|
||||||
if ($i<3)
|
if ($i<3)
|
||||||
{
|
{
|
||||||
// Ensure that this is definitely smaller
|
/* Ensure that this is definitely smaller */
|
||||||
if ($DEBUG) { echo" This is the $num[$i] octet, so A is definitely less than B."; }
|
if ($DEBUG) { echo" This is the $num[$i] octet, so A is definitely less than B."; }
|
||||||
$less = 5;
|
$less = 5;
|
||||||
break;
|
break;
|
||||||
@ -610,7 +610,7 @@
|
|||||||
$less--;
|
$less--;
|
||||||
if ($i<2)
|
if ($i<2)
|
||||||
{
|
{
|
||||||
// Ensure that this is definitely greater
|
/* Ensure that this is definitely greater */
|
||||||
if ($DEBUG) { echo" This is the $num[$i] octet, so A is definitely greater than B."; }
|
if ($DEBUG) { echo" This is the $num[$i] octet, so A is definitely greater than B."; }
|
||||||
$less = -5;
|
$less = -5;
|
||||||
break;
|
break;
|
||||||
@ -679,7 +679,7 @@
|
|||||||
$less++;
|
$less++;
|
||||||
if ($i<3)
|
if ($i<3)
|
||||||
{
|
{
|
||||||
// Ensure that this is definitely greater
|
/* Ensure that this is definitely greater */
|
||||||
if ($DEBUG) { echo" This is the $num[$i] octet, so A is definitely greater than B."; }
|
if ($DEBUG) { echo" This is the $num[$i] octet, so A is definitely greater than B."; }
|
||||||
$less = 5;
|
$less = 5;
|
||||||
break;
|
break;
|
||||||
@ -691,7 +691,7 @@
|
|||||||
$less--;
|
$less--;
|
||||||
if ($i<2)
|
if ($i<2)
|
||||||
{
|
{
|
||||||
// Ensure that this is definitely smaller
|
/* Ensure that this is definitely smaller */
|
||||||
if ($DEBUG) { echo" This is the $num[$i] octet, so A is definitely less than B."; }
|
if ($DEBUG) { echo" This is the $num[$i] octet, so A is definitely less than B."; }
|
||||||
$less = -5;
|
$less = -5;
|
||||||
break;
|
break;
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
$setup_info[$this->db->f('app_name')]['currentver'] = $this->db->f('app_version');
|
$setup_info[$this->db->f('app_name')]['currentver'] = $this->db->f('app_version');
|
||||||
$setup_info[$this->db->f('app_name')]['enabled'] = $this->db->f('app_enabled');
|
$setup_info[$this->db->f('app_name')]['enabled'] = $this->db->f('app_enabled');
|
||||||
}
|
}
|
||||||
// This is to catch old setup installs that did not have phpgwapi listed as an app
|
/* This is to catch old setup installs that did not have phpgwapi listed as an app */
|
||||||
if (!$setup_info['phpgwapi']['currentver'])
|
if (!$setup_info['phpgwapi']['currentver'])
|
||||||
{
|
{
|
||||||
$tmp = $setup_info['phpgwapi']['version']; /* save the file version */
|
$tmp = $setup_info['phpgwapi']['version']; /* save the file version */
|
||||||
@ -106,7 +106,7 @@
|
|||||||
while (list ($key, $value) = each ($setup_info))
|
while (list ($key, $value) = each ($setup_info))
|
||||||
{
|
{
|
||||||
//echo '<br>'.$setup_info[$key]['name'].'STATUS: '.$setup_info[$key]['status'];
|
//echo '<br>'.$setup_info[$key]['name'].'STATUS: '.$setup_info[$key]['status'];
|
||||||
// Only set this if it has not already failed to upgrade - Milosch
|
/* Only set this if it has not already failed to upgrade - Milosch */
|
||||||
if (!( ($setup_info[$key]['status'] == 'F') || ($setup_info[$key]['status'] == 'C') ))
|
if (!( ($setup_info[$key]['status'] == 'F') || ($setup_info[$key]['status'] == 'C') ))
|
||||||
{
|
{
|
||||||
//if ($setup_info[$key]['currentver'] > $setup_info[$key]['version'])
|
//if ($setup_info[$key]['currentver'] > $setup_info[$key]['version'])
|
||||||
@ -118,7 +118,6 @@
|
|||||||
{
|
{
|
||||||
$setup_info[$key]['status'] = 'C';
|
$setup_info[$key]['status'] = 'C';
|
||||||
}
|
}
|
||||||
//elseif ($setup_info[$key]['currentver'] < $setup_info[$key]['version'])
|
|
||||||
elseif ($this->alessthanb($setup_info[$key]['currentver'],$setup_info[$key]['version']))
|
elseif ($this->alessthanb($setup_info[$key]['currentver'],$setup_info[$key]['version']))
|
||||||
{
|
{
|
||||||
$setup_info[$key]['status'] = 'U';
|
$setup_info[$key]['status'] = 'U';
|
||||||
@ -151,9 +150,7 @@
|
|||||||
while (list ($depskey, $depsvalue) = each ($value['depends'][$depkey]['versions']))
|
while (list ($depskey, $depsvalue) = each ($value['depends'][$depkey]['versions']))
|
||||||
{
|
{
|
||||||
$major = $this->get_major($setup_info[$value['depends'][$depkey]['appname']]['currentver']);
|
$major = $this->get_major($setup_info[$value['depends'][$depkey]['appname']]['currentver']);
|
||||||
//echo $major;
|
|
||||||
if ($major == $depsvalue)
|
if ($major == $depsvalue)
|
||||||
//if ($setup_info[$value['depends'][$depkey]['appname']]['currentver'] == $depsvalue )
|
|
||||||
{
|
{
|
||||||
$setup_info['depends'][$depkey]['status'] = True;
|
$setup_info['depends'][$depkey]['status'] = True;
|
||||||
}
|
}
|
||||||
@ -162,14 +159,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Finally I will loop thru the dependencies again look for apps that still have a failure status */
|
/*
|
||||||
/* If we find one we set the apps overall status as a dependency failure */
|
Finally, we loop through the dependencies again to look for apps that still have a failure status
|
||||||
|
If we find one, we set the apps overall status as a dependency failure.
|
||||||
|
*/
|
||||||
reset ($value['depends']);
|
reset ($value['depends']);
|
||||||
while (list ($depkey, $depvalue) = each ($value['depends']))
|
while (list ($depkey, $depvalue) = each ($value['depends']))
|
||||||
{
|
{
|
||||||
if ($setup_info['depends'][$depkey]['status'] == False)
|
if ($setup_info['depends'][$depkey]['status'] == False)
|
||||||
{
|
{
|
||||||
// Only set this if it has not already failed to upgrade - Milosch
|
/* Only set this if it has not already failed to upgrade - Milosch */
|
||||||
if (!( ($setup_info[$key]['status'] == 'F') || ($setup_info[$key]['status'] == 'C') ))
|
if (!( ($setup_info[$key]['status'] == 'F') || ($setup_info[$key]['status'] == 'C') ))
|
||||||
{
|
{
|
||||||
$setup_info[$key]['status'] = 'D';
|
$setup_info[$key]['status'] = 'D';
|
||||||
@ -242,7 +241,6 @@
|
|||||||
$this->db->query('CREATE TABLE phpgw_testrights ( testfield varchar(5) NOT NULL )');
|
$this->db->query('CREATE TABLE phpgw_testrights ( testfield varchar(5) NOT NULL )');
|
||||||
if (! $this->db->Errno)
|
if (! $this->db->Errno)
|
||||||
{
|
{
|
||||||
//if (isset($isdb)){
|
|
||||||
$this->db->query('DROP TABLE phpgw_testrights');
|
$this->db->query('DROP TABLE phpgw_testrights');
|
||||||
$GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage 3 (Install Applications)';
|
$GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage 3 (Install Applications)';
|
||||||
return 3;
|
return 3;
|
||||||
@ -258,9 +256,12 @@
|
|||||||
function check_config()
|
function check_config()
|
||||||
{
|
{
|
||||||
$this->db->Halt_On_Error = 'no';
|
$this->db->Halt_On_Error = 'no';
|
||||||
if ($GLOBALS['phpgw_info']['setup']['stage']['db'] != 10){return '';}
|
if ($GLOBALS['phpgw_info']['setup']['stage']['db'] != 10)
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
// Since 0.9.10pre6 config table is named as phpgw_config
|
/* Since 0.9.10pre6 config table is named as phpgw_config */
|
||||||
$config_table = 'config';
|
$config_table = 'config';
|
||||||
$ver = explode('.',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
|
$ver = explode('.',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
|
||||||
|
|
||||||
@ -332,7 +333,7 @@
|
|||||||
|
|
||||||
if($setup_info[$appname]['tables'])
|
if($setup_info[$appname]['tables'])
|
||||||
{
|
{
|
||||||
// Make a copy, else we send some callers into an infinite loop
|
/* Make a copy, else we send some callers into an infinite loop */
|
||||||
$copy = $setup_info;
|
$copy = $setup_info;
|
||||||
$this->db->Halt_On_Error = 'no';
|
$this->db->Halt_On_Error = 'no';
|
||||||
$tablenames = $this->db->table_names();
|
$tablenames = $this->db->table_names();
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
/*!
|
/*!
|
||||||
@function generate_header
|
@function generate_header
|
||||||
@abstract generate header.inc.php file output - NOT a generic html header function
|
@abstract generate header.inc.php file output - NOT a generic html header function
|
||||||
*/
|
*/
|
||||||
function generate_header()
|
function generate_header()
|
||||||
{
|
{
|
||||||
$setting = $GLOBALS['HTTP_POST_VARS']['setting'];
|
$setting = $GLOBALS['HTTP_POST_VARS']['setting'];
|
||||||
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
function setup_tpl_dir($app_name='setup')
|
function setup_tpl_dir($app_name='setup')
|
||||||
{
|
{
|
||||||
// hack to get tpl dir
|
/* hack to get tpl dir */
|
||||||
if (is_dir(PHPGW_SERVER_ROOT))
|
if (is_dir(PHPGW_SERVER_ROOT))
|
||||||
{
|
{
|
||||||
$srv_root = PHPGW_SERVER_ROOT . SEP . "$app_name" . SEP;
|
$srv_root = PHPGW_SERVER_ROOT . SEP . "$app_name" . SEP;
|
||||||
@ -71,7 +71,7 @@
|
|||||||
$GLOBALS['setup_tpl']->set_var('pgw_ver',$phpgw_info['server']['versions']['phpgwapi']);
|
$GLOBALS['setup_tpl']->set_var('pgw_ver',$phpgw_info['server']['versions']['phpgwapi']);
|
||||||
$GLOBALS['setup_tpl']->set_var('logoutbutton',$btn_logout);
|
$GLOBALS['setup_tpl']->set_var('logoutbutton',$btn_logout);
|
||||||
$GLOBALS['setup_tpl']->pparse('out','T_head');
|
$GLOBALS['setup_tpl']->pparse('out','T_head');
|
||||||
//$setup_tpl->set_var('T_head','');
|
/* $setup_tpl->set_var('T_head',''); */
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_footer()
|
function show_footer()
|
||||||
@ -111,14 +111,16 @@
|
|||||||
|
|
||||||
function login_form()
|
function login_form()
|
||||||
{
|
{
|
||||||
// begin use TEMPLATE login_main.tpl
|
/* begin use TEMPLATE login_main.tpl */
|
||||||
$GLOBALS['setup_tpl']->set_var('ConfigLoginMSG',$GLOBALS['phpgw_info']['setup']['ConfigLoginMSG']);
|
$GLOBALS['setup_tpl']->set_var('ConfigLoginMSG',$GLOBALS['phpgw_info']['setup']['ConfigLoginMSG']);
|
||||||
$GLOBALS['setup_tpl']->set_var('HeaderLoginMSG',$GLOBALS['phpgw_info']['setup']['HeaderLoginMSG']);
|
$GLOBALS['setup_tpl']->set_var('HeaderLoginMSG',$GLOBALS['phpgw_info']['setup']['HeaderLoginMSG']);
|
||||||
|
|
||||||
if ($GLOBALS['phpgw_info']['setup']['stage']['header'] == '10')
|
if ($GLOBALS['phpgw_info']['setup']['stage']['header'] == '10')
|
||||||
{
|
{
|
||||||
// begin use SUB-TEMPLATE login_stage_header,
|
/*
|
||||||
// fills V_login_stage_header used inside of login_main.tpl
|
Begin use SUB-TEMPLATE login_stage_header,
|
||||||
|
fills V_login_stage_header used inside of login_main.tpl
|
||||||
|
*/
|
||||||
$GLOBALS['setup_tpl']->set_var('lang_select',lang_select());
|
$GLOBALS['setup_tpl']->set_var('lang_select',lang_select());
|
||||||
if (count($GLOBALS['phpgw_domain']) > 1)
|
if (count($GLOBALS['phpgw_domain']) > 1)
|
||||||
{
|
{
|
||||||
@ -132,33 +134,36 @@
|
|||||||
reset($GLOBALS['phpgw_domain']);
|
reset($GLOBALS['phpgw_domain']);
|
||||||
$default_domain = each($GLOBALS['phpgw_domain']);
|
$default_domain = each($GLOBALS['phpgw_domain']);
|
||||||
$GLOBALS['setup_tpl']->set_var('default_domain_zero',$default_domain[0]);
|
$GLOBALS['setup_tpl']->set_var('default_domain_zero',$default_domain[0]);
|
||||||
|
|
||||||
// use BLOCK B_single_domain inside of login_stage_header
|
/* Use BLOCK B_single_domain inside of login_stage_header */
|
||||||
$GLOBALS['setup_tpl']->parse('V_single_domain','B_single_domain');
|
$GLOBALS['setup_tpl']->parse('V_single_domain','B_single_domain');
|
||||||
// // in this case, the multi domain block needs to be nothing
|
/* in this case, the multi domain block needs to be nothing */
|
||||||
$GLOBALS['setup_tpl']->set_var('V_multi_domain','');
|
$GLOBALS['setup_tpl']->set_var('V_multi_domain','');
|
||||||
}
|
}
|
||||||
// end use SUB-TEMPLATE login_stage_header
|
/*
|
||||||
// put all this into V_login_stage_header for use inside login_main
|
End use SUB-TEMPLATE login_stage_header
|
||||||
|
put all this into V_login_stage_header for use inside login_main
|
||||||
|
*/
|
||||||
$GLOBALS['setup_tpl']->parse('V_login_stage_header','T_login_stage_header');
|
$GLOBALS['setup_tpl']->parse('V_login_stage_header','T_login_stage_header');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// begin SKIP SUB-TEMPLATE login_stage_header
|
/* begin SKIP SUB-TEMPLATE login_stage_header */
|
||||||
$GLOBALS['setup_tpl']->set_var('V_multi_domain','');
|
$GLOBALS['setup_tpl']->set_var('V_multi_domain','');
|
||||||
$GLOBALS['setup_tpl']->set_var('V_single_domain','');
|
$GLOBALS['setup_tpl']->set_var('V_single_domain','');
|
||||||
$GLOBALS['setup_tpl']->set_var('V_login_stage_header','');
|
$GLOBALS['setup_tpl']->set_var('V_login_stage_header','');
|
||||||
}
|
}
|
||||||
// end use TEMPLATE login_main.tpl
|
/*
|
||||||
// now out the login_main template
|
end use TEMPLATE login_main.tpl
|
||||||
|
now out the login_main template
|
||||||
|
*/
|
||||||
$GLOBALS['setup_tpl']->pparse('out','T_login_main');
|
$GLOBALS['setup_tpl']->pparse('out','T_login_main');
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_template_list()
|
function get_template_list()
|
||||||
{
|
{
|
||||||
$d = dir(PHPGW_SERVER_ROOT . '/phpgwapi/templates');
|
$d = dir(PHPGW_SERVER_ROOT . '/phpgwapi/templates');
|
||||||
//$list['user_choice']['name'] = 'user_choice';
|
|
||||||
//$list['user_choice']['title'] = 'Users Choice';
|
|
||||||
while($entry=$d->read())
|
while($entry=$d->read())
|
||||||
{
|
{
|
||||||
if ($entry != 'CVS' && $entry != '.' && $entry != '..')
|
if ($entry != 'CVS' && $entry != '.' && $entry != '..')
|
||||||
|
@ -152,7 +152,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
if ($i == 20) // Then oops it broke
|
if ($i == 20) /* Then oops it broke */
|
||||||
{
|
{
|
||||||
echo '<br>Setup failure: excess looping in process_pass():'."\n";
|
echo '<br>Setup failure: excess looping in process_pass():'."\n";
|
||||||
echo '<br>Pass:<br>'."\n";
|
echo '<br>Pass:<br>'."\n";
|
||||||
@ -165,7 +165,7 @@
|
|||||||
$passing_string = implode (':', $passing);
|
$passing_string = implode (':', $passing);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now return the list
|
/* now return the list */
|
||||||
@reset($passed);
|
@reset($passed);
|
||||||
while(list($key,$value) = @each($passed))
|
while(list($key,$value) = @each($passed))
|
||||||
{
|
{
|
||||||
@ -188,7 +188,7 @@
|
|||||||
}
|
}
|
||||||
$this->oProc->m_bDeltaOnly = False;
|
$this->oProc->m_bDeltaOnly = False;
|
||||||
|
|
||||||
// The following is built so below we won't try to drop a table that isn't there
|
/* The following is built so below we won't try to drop a table that isn't there. */
|
||||||
$tablenames = $this->db->table_names();
|
$tablenames = $this->db->table_names();
|
||||||
while(list($key,$val) = @each($tablenames))
|
while(list($key,$val) = @each($tablenames))
|
||||||
{
|
{
|
||||||
@ -214,15 +214,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done, return current status
|
/* Done, return current status */
|
||||||
return ($setup_info);
|
return ($setup_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: This duplicates the old newtables behavior, using schema_proc
|
|
||||||
/*!
|
/*!
|
||||||
@function process_current
|
@function process_current
|
||||||
@abstract process current table setup in each application/setup dir
|
@abstract process current table setup in each application/setup dir
|
||||||
@param $appinfo array of application info from setup.inc.php files, etc.
|
@param $appinfo array of application info from setup.inc.php files, etc.
|
||||||
|
@discussion This duplicates the old newtables behavior, using schema_proc
|
||||||
*/
|
*/
|
||||||
function process_current($setup_info,$DEBUG=False)
|
function process_current($setup_info,$DEBUG=False)
|
||||||
{
|
{
|
||||||
@ -265,7 +265,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// script processing failed
|
/* script processing failed */
|
||||||
if($DEBUG) { echo '<br>process_current(): Failed for ' . $appname . ',status: '. $setup_info[$key]['status']; }
|
if($DEBUG) { echo '<br>process_current(): Failed for ' . $appname . ',status: '. $setup_info[$key]['status']; }
|
||||||
$setup_info[$key]['status'] = 'F';
|
$setup_info[$key]['status'] = 'F';
|
||||||
}
|
}
|
||||||
@ -273,8 +273,10 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if($DEBUG) { echo '<br>process_current(): No current tables for ' . $apptitle . "\n"; }
|
if($DEBUG) { echo '<br>process_current(): No current tables for ' . $apptitle . "\n"; }
|
||||||
// add the app, but disable it if it has tables defined
|
/*
|
||||||
// a manual sql script install is needed, but we do add the hooks
|
Add the app, but disable it if it has tables defined.
|
||||||
|
A manual sql script install is needed, but we do add the hooks
|
||||||
|
*/
|
||||||
$enabled = 99;
|
$enabled = 99;
|
||||||
if ($setup_info[$key]['tables'][0] != '')
|
if ($setup_info[$key]['tables'][0] != '')
|
||||||
{
|
{
|
||||||
@ -295,7 +297,7 @@
|
|||||||
if($DEBUG) { echo '<br>process_current(): Outgoing status: ' . $appname . ',status: '. $setup_info[$key]['status']; }
|
if($DEBUG) { echo '<br>process_current(): Outgoing status: ' . $appname . ',status: '. $setup_info[$key]['status']; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done, return current status
|
/* Done, return current status */
|
||||||
return ($setup_info);
|
return ($setup_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,10 +331,10 @@
|
|||||||
include ($appdir.'default_records.inc.php');
|
include ($appdir.'default_records.inc.php');
|
||||||
$this->oProc->m_odb->transaction_commit();
|
$this->oProc->m_odb->transaction_commit();
|
||||||
}
|
}
|
||||||
//$setup_info[$key]['status'] = 'C';
|
/* $setup_info[$key]['status'] = 'C'; */
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done, return current status
|
/* Done, return current status */
|
||||||
return ($setup_info);
|
return ($setup_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,7 +356,7 @@
|
|||||||
echo '<br>process_add_langs(): Translations added for ' . $appname . "\n";
|
echo '<br>process_add_langs(): Translations added for ' . $appname . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Done, return current status
|
/* Done, return current status */
|
||||||
return ($setup_info);
|
return ($setup_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +378,7 @@
|
|||||||
echo '<br>process_drop_langs(): Translations removed for ' . $appname . "\n";
|
echo '<br>process_drop_langs(): Translations removed for ' . $appname . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Done, return current status
|
/* Done, return current status */
|
||||||
return ($setup_info);
|
return ($setup_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,7 +406,7 @@
|
|||||||
echo '<br>process_upgrade_langs(): Translations reinstalled for ' . $appname . "\n";
|
echo '<br>process_upgrade_langs(): Translations reinstalled for ' . $appname . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Done, return current status
|
/* Done, return current status */
|
||||||
return ($setup_info);
|
return ($setup_info);
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
@ -440,7 +442,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done, return current status
|
/* Done, return current status */
|
||||||
return ($setup_info);
|
return ($setup_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,8 +474,8 @@
|
|||||||
$this->oProc->GenerateScripts($phpgw_baseline, $DEBUG);
|
$this->oProc->GenerateScripts($phpgw_baseline, $DEBUG);
|
||||||
$this->post_process($phpgw_baseline,$DEBUG);
|
$this->post_process($phpgw_baseline,$DEBUG);
|
||||||
|
|
||||||
// Update the array values for return below
|
/* Update the array values for return below */
|
||||||
//$setup_info[$key]['status'] = 'R';
|
/* $setup_info[$key]['status'] = 'R'; */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -485,7 +487,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done, return current status
|
/* Done, return current status */
|
||||||
return ($setup_info);
|
return ($setup_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -551,7 +553,7 @@
|
|||||||
}
|
}
|
||||||
include ($appdir.'tables_baseline.inc.php');
|
include ($appdir.'tables_baseline.inc.php');
|
||||||
$this->oProc->m_aTables = $phpgw_baseline;
|
$this->oProc->m_aTables = $phpgw_baseline;
|
||||||
//$this->oProc->GenerateScripts($phpgw_baseline, $DEBUG);
|
/* $this->oProc->GenerateScripts($phpgw_baseline, $DEBUG); */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -568,7 +570,7 @@
|
|||||||
include ($appdir . 'tables_update.inc.php');
|
include ($appdir . 'tables_update.inc.php');
|
||||||
$this->updateincluded[$appname] = True;
|
$this->updateincluded[$appname] = True;
|
||||||
|
|
||||||
// $test array comes from update file, it is a list of available upgrade functions
|
/* $test array comes from update file. It is a list of available upgrade functions */
|
||||||
@reset($test);
|
@reset($test);
|
||||||
while (list($x,$value) = @each($test))
|
while (list($x,$value) = @each($test))
|
||||||
{
|
{
|
||||||
@ -590,7 +592,7 @@
|
|||||||
if ($value == $targetver)
|
if ($value == $targetver)
|
||||||
{
|
{
|
||||||
$this->oProc->m_bDeltaOnly = False;
|
$this->oProc->m_bDeltaOnly = False;
|
||||||
// Done upgrading
|
/* Done upgrading */
|
||||||
if($DEBUG)
|
if($DEBUG)
|
||||||
{
|
{
|
||||||
echo '<br>process_upgrade(): Upgrade of ' . $appname . ' to ' . $targetver . ' is completed.' . "\n";
|
echo '<br>process_upgrade(): Upgrade of ' . $appname . ' to ' . $targetver . ' is completed.' . "\n";
|
||||||
@ -611,13 +613,11 @@
|
|||||||
//break;
|
//break;
|
||||||
}
|
}
|
||||||
elseif (($value == $currentver) || !$currentver)
|
elseif (($value == $currentver) || !$currentver)
|
||||||
//elseif ($this->alessthanb($value,$targetver,True) &&
|
|
||||||
// $this->alessthanb($currentver,$value,True))
|
|
||||||
{
|
{
|
||||||
// start upgrading db in addition to baseline
|
/* start upgrading db in addition to baseline */
|
||||||
$this->oProc->m_bDeltaOnly = False;
|
$this->oProc->m_bDeltaOnly = False;
|
||||||
if ($DEBUG) { echo '<br>process_upgrade(): running ' . $function; }
|
if ($DEBUG) { echo '<br>process_upgrade(): running ' . $function; }
|
||||||
// run upgrade function
|
/* run upgrade function */
|
||||||
$success = $function();
|
$success = $function();
|
||||||
if ($success != False)
|
if ($success != False)
|
||||||
{
|
{
|
||||||
@ -717,7 +717,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done with this app, update status
|
/* Done with this app, update status */
|
||||||
$setup_info[$key]['status'] = $appstatus;
|
$setup_info[$key]['status'] = $appstatus;
|
||||||
if ($DEBUG)
|
if ($DEBUG)
|
||||||
{
|
{
|
||||||
@ -725,8 +725,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done, return current status
|
/* Done, return current status */
|
||||||
|
|
||||||
return ($setup_info);
|
return ($setup_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -762,8 +761,7 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function sql_to_array
|
@function sql_to_array
|
||||||
@abstract send this a table name, returns printable column spec and keys for the table from
|
@abstract send this a table name, returns printable column spec and keys for the table from schema_proc
|
||||||
schema_proc
|
|
||||||
@param $tablename table whose array you want to see
|
@param $tablename table whose array you want to see
|
||||||
*/
|
*/
|
||||||
function sql_to_array($tablename = '')
|
function sql_to_array($tablename = '')
|
||||||
|
@ -233,7 +233,7 @@
|
|||||||
|
|
||||||
if(file_exists(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php'))
|
if(file_exists(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php'))
|
||||||
{
|
{
|
||||||
include(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php'); // To set the current core version
|
include(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php'); /* To set the current core version */
|
||||||
/* This will change to just use setup_info */
|
/* This will change to just use setup_info */
|
||||||
$GLOBALS['phpgw_info']['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header'];
|
$GLOBALS['phpgw_info']['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header'];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user