setUpdateModus();
}
if ($buttonText === $gL10n->get('INS_UPDATE_DATABASE'))
{
$onClickText = $gL10n->get('INS_DATABASE_IS_UPDATED');
}
$form->setFormDescription($message);
$form->addSubmitButton('next_page', $buttonText, array('icon' => $buttonIcon, 'onClickText' => $onClickText));
echo $form->show();
exit();
}
/**
* prueft, ob die Mindestvoraussetzungen bei PHP und MySQL eingehalten werden
* @param Database $database
* @return string
*/
function checkDatabaseVersion(Database $database)
{
global $gL10n;
// check database version
if (version_compare($database->getVersion(), $database->getMinimumRequiredVersion(), '<'))
{
return $gL10n->get('SYS_DATABASE_VERSION') . ': ' . $database->getVersion() . '
' .
$gL10n->get('INS_WRONG_MYSQL_VERSION', array(ADMIDIO_VERSION_TEXT, $database->getMinimumRequiredVersion(),
'', ''));
}
return '';
}
/**
* Read data from sql file and execute all statements to the current database
* @param Database $db
* @param string $sqlFileName
* @return true|string Returns true no error occurs ales error message is returned
*/
function querySqlFile(Database $db, $sqlFileName)
{
global $gL10n;
$sqlPath = ADMIDIO_PATH . '/adm_program/installation/db_scripts/';
$sqlFilePath = $sqlPath . $sqlFileName;
if (!is_file($sqlFilePath))
{
return $gL10n->get('INS_DATABASE_FILE_NOT_FOUND', array($sqlFileName, $sqlPath));
}
try
{
$sqlStatements = Database::getSqlStatementsFromSqlFile($sqlFilePath);
}
catch (\RuntimeException $exception)
{
return $gL10n->get('INS_ERROR_OPEN_FILE', array($sqlFilePath));
}
foreach ($sqlStatements as $sqlStatement)
{
$db->queryPrepared($sqlStatement);
}
return true;
}
/**
* @param Database $db
*/
function disableSoundexSearchIfPgSql(Database $db)
{
if (DB_ENGINE === Database::PDO_ENGINE_PGSQL || DB_ENGINE === 'postgresql') // for backwards compatibility "postgresql"
{
// soundex is not a default function in PostgreSQL
$sql = 'UPDATE ' . TBL_PREFERENCES . '
SET prf_value = \'0\'
WHERE prf_name = \'system_search_similar\'';
$db->queryPrepared($sql);
}
}
/**
* prueft, ob die Mindestvoraussetzungen bei PHP und MySQL eingehalten werden
* @deprecated 3.3.0:4.0.0 Dropped without replacement.
* @return string
*/
function checkPhpVersion()
{
global $gL10n, $gLogger;
$gLogger->warning('DEPRECATED: "checkPhpVersion()" is deprecated without replacement!');
// check PHP version
if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '<'))
{
return $gL10n->get('SYS_PHP_VERSION') . ': ' . PHP_VERSION . '
' .
$gL10n->get('INS_WRONG_PHP_VERSION', array(ADMIDIO_VERSION_TEXT, MIN_PHP_VERSION,
'', ''));
}
return '';
}
/**
* @deprecated 3.3.0:4.0.0 Dropped without replacement.
* @param string $message
* @return string
*/
function getErrorMessage($message)
{
global $gLogger;
$gLogger->warning('DEPRECATED: "getErrorMessage()" is deprecated without replacement!');
return '