LimeSurvey API - Master branch

updatedb_helper.php

Table of Contents

Functions

db_upgrade_all()  : mixed
updateEncryptedValues450()  : mixed
Update previous encrpted values to new encryption
decryptCPDBTable450()  : void
Update encryption for CPDB participants
decryptParticipantTables450()  : void
Update encryption for survey participants
decryptResponseTables450()  : void
Update encryption for survey responses
decryptArchivedTables450()  : void
Update Encryption for archived tables
createFieldMap450()  : array<string|int, mixed>
Returns the fieldmap for responses
upgradeArchivedTableSettings446()  : void
Import previously archived tables to ArchivedTableSettings
extendDatafields429()  : mixed
upgradeSurveyTables402()  : mixed
upgradeTokenTables402()  : mixed
extendDatafields364()  : mixed
upgradeSurveyTimings350()  : mixed
resetTutorials337()  : void
upgrade333()  : void
upgrade331()  : void
upgrade330()  : void
upgrade328()  : void
upgrade327()  : void
transferPasswordFieldToText()  : mixed
createSurveyMenuTable()  : void
createSurveysGroupSettingsTable()  : void
createSurveyGroupTables306()  : void
upgradeTemplateTables304()  : void
upgradeTemplateTables298()  : void
upgradeTokenTables256()  : mixed
upgradeSurveyTables255()  : mixed
upgradeSurveyTables254()  : mixed
upgradeSurveyTables253()  : mixed
upgradeBoxesTable251()  : mixed
createBoxes250()  : mixed
Create boxes table
fixKCFinder184()  : mixed
upgradeSurveyTables183()  : mixed
upgradeSurveyTables181()  : mixed
upgradeTokenTables181()  : mixed
upgradeTokenTables179()  : mixed
upgradeSurveys177()  : mixed
upgradeTokens176()  : mixed
This function removes the old CPDB fields in token tables replaces them with standard attribute fields and records the mapping information in the attributedescription field in the survey table instead
upgradeCPDBAttributeDefaultNames173()  : mixed
upgradePermissions166()  : mixed
Converts global permissions from users table to the new permission system, and converts template permissions from template_rights to new permission table
upgradeSurveyTables164()  : string|null
Make sure all active tables have the right sized token field
upgradeSurveys156()  : mixed
upgradeTokens148()  : mixed
upgradeQuestionAttributes148()  : mixed
upgradeSurveyTimings146()  : mixed
upgradeTokens145()  : mixed
upgradeSurveys145()  : mixed
upgradeSurveyPermissions145()  : mixed
upgradeTables143()  : mixed
upgradeQuestionAttributes142()  : mixed
upgradeSurveyTables139()  : mixed
upgradeTokenTables134()  : mixed
alterColumn()  : mixed
addColumn()  : mixed
setTransactionBookmark()  : mixed
Set a transaction bookmark - this is critical for Postgres because a transaction in Postgres cannot be continued unless you roll back to the transaction bookmark first
rollBackToTransactionBookmark()  : mixed
Roll back to a transaction bookmark
dropDefaultValueMSSQL()  : mixed
Drop a default value in MSSQL
dropUniqueKeyMSSQL()  : mixed
This function drops a unique Key of an MSSQL database field by using the field name and the table name
dropSecondaryKeyMSSQL()  : mixed
This function drops a secondary key of an MSSQL database field by using the field name and the table name
dropPrimaryKey()  : mixed
Drops the primary key of a table
addPrimaryKey()  : mixed
modifyPrimaryKey()  : mixed
Modifies a primary key in one command - this is only tested on MySQL
fixMySQLCollations()  : mixed
dropColumn()  : mixed
Drops a column, automatically removes blocking default value on MSSQL
alterLanguageCode()  : mixed
Renames a language code in the whole LimeSurvey database
fixLanguageConsistencyAllSurveys()  : mixed
fixPostgresSequence()  : void
This function fixes Postgres sequences for one/all tables in a database This is necessary if a table is renamed. If tablename is given then only that table is fixed
runAddPrimaryKeyonAnswersTable400()  : mixed
regenerateLabelCodes400()  : void
Regenerate codes for problematic label sets Helper function (TODO: Put in separate class) Fails silently
removeMysqlZeroDate()  : void
Remove all zero-dates in $tableName by checking datetime columns from $tableSchema Zero-dates are replaced with null where possible; otherwise 1970-01-01
getRelevantUpdates()  : array<string|int, DatabaseUpdateBase>
Returns a sorted array of update objects with version higher than $iOldDBVersion

Functions

db_upgrade_all()

db_upgrade_all(int $iOldDBVersion[, bool $bSilent = false ]) : mixed
Parameters
$iOldDBVersion : int

The previous database version

$bSilent : bool = false

Run update silently with no output - this checks if the update can be run silently at all. If not it will not run any updates at all.

updateEncryptedValues450()

Update previous encrpted values to new encryption

updateEncryptedValues450(CDbConnection $oDB) : mixed
Parameters
$oDB : CDbConnection
Tags
throws
CException

decryptCPDBTable450()

Update encryption for CPDB participants

decryptCPDBTable450(CDbConnection $oDB) : void
Parameters
$oDB : CDbConnection
Tags
throws
CException

decryptParticipantTables450()

Update encryption for survey participants

decryptParticipantTables450(CDbConnection $oDB) : void
Parameters
$oDB : CDbConnection

decryptResponseTables450()

Update encryption for survey responses

decryptResponseTables450(CDbConnection $oDB) : void
Parameters
$oDB : CDbConnection
Tags
throws
CException

decryptArchivedTables450()

Update Encryption for archived tables

decryptArchivedTables450(CDbConnection $oDB) : void
Parameters
$oDB : CDbConnection
Tags
throws
CDbException
throws
CException

createFieldMap450()

Returns the fieldmap for responses

createFieldMap450( $survey) : array<string|int, mixed>
Parameters
$survey :
Tags
throws
CException
psalm-suppress

RedundantCondition

Return values
array<string|int, mixed>

upgradeArchivedTableSettings446()

Import previously archived tables to ArchivedTableSettings

upgradeArchivedTableSettings446() : void
Tags
throws
CException

extendDatafields429()

extendDatafields429(mixed $oDB) : mixed
Parameters
$oDB : mixed

upgradeSurveyTables402()

upgradeSurveyTables402(string $sMySQLCollation) : mixed
Parameters
$sMySQLCollation : string

upgradeTokenTables402()

upgradeTokenTables402(string $sMySQLCollation) : mixed
Parameters
$sMySQLCollation : string

extendDatafields364()

extendDatafields364(mixed $oDB) : mixed
Parameters
$oDB : mixed

resetTutorials337()

resetTutorials337(CDbConnection $oDB) : void
Parameters
$oDB : CDbConnection

upgrade333()

upgrade333(CDbConnection $oDB) : void
Parameters
$oDB : CDbConnection

upgrade331()

upgrade331(CDbConnection $oDB) : void
Parameters
$oDB : CDbConnection

upgrade330()

upgrade330(CDbConnection $oDB) : void
Parameters
$oDB : CDbConnection

upgrade328()

upgrade328(CDbConnection $oDB) : void
Parameters
$oDB : CDbConnection

upgrade327()

upgrade327(CDbConnection $oDB) : void
Parameters
$oDB : CDbConnection

transferPasswordFieldToText()

transferPasswordFieldToText(CDbConnection $oDB) : mixed
Parameters
$oDB : CDbConnection

createSurveyMenuTable()

createSurveyMenuTable(CDbConnection $oDB) : void
Parameters
$oDB : CDbConnection

createSurveysGroupSettingsTable()

createSurveysGroupSettingsTable(CDbConnection $oDB) : void
Parameters
$oDB : CDbConnection

createSurveyGroupTables306()

createSurveyGroupTables306(CDbConnection $oDB) : void
Parameters
$oDB : CDbConnection

upgradeTemplateTables304()

upgradeTemplateTables304(CDbConnection $oDB) : void
Parameters
$oDB : CDbConnection

upgradeTemplateTables298()

upgradeTemplateTables298(CDbConnection $oDB) : void
Parameters
$oDB : CDbConnection

upgradeSurveyTables181()

upgradeSurveyTables181(string $sMySQLCollation) : mixed
Parameters
$sMySQLCollation : string

upgradeTokenTables181()

upgradeTokenTables181(string $sMySQLCollation) : mixed
Parameters
$sMySQLCollation : string

upgradeTokens176()

This function removes the old CPDB fields in token tables replaces them with standard attribute fields and records the mapping information in the attributedescription field in the survey table instead

upgradeTokens176() : mixed

upgradeCPDBAttributeDefaultNames173()

upgradeCPDBAttributeDefaultNames173() : mixed

upgradePermissions166()

Converts global permissions from users table to the new permission system, and converts template permissions from template_rights to new permission table

upgradePermissions166() : mixed

upgradeSurveyTables164()

Make sure all active tables have the right sized token field

upgradeSurveyTables164() : string|null

During a small period in the 2.0 cycle some survey tables got no token field or a token field that was too small. This patch makes sure all surveys that are not anonymous have a token field with the right size

Return values
string|null

upgradeQuestionAttributes148()

upgradeQuestionAttributes148() : mixed

upgradeSurveyPermissions145()

upgradeSurveyPermissions145() : mixed

upgradeQuestionAttributes142()

upgradeQuestionAttributes142() : mixed

alterColumn()

alterColumn(mixed $sTable, string $sColumn, string $sFieldType[, mixed $bAllowNull = true ][, mixed $sDefault = 'NULL' ]) : mixed
Parameters
$sTable : mixed
$sColumn : string
$sFieldType : string
$bAllowNull : mixed = true
$sDefault : mixed = 'NULL'

addColumn()

addColumn(mixed $sTableName, mixed $sColumn, string $sType) : mixed
Parameters
$sTableName : mixed
$sColumn : mixed
$sType : string

setTransactionBookmark()

Set a transaction bookmark - this is critical for Postgres because a transaction in Postgres cannot be continued unless you roll back to the transaction bookmark first

setTransactionBookmark([mixed $sBookmark = 'limesurvey' ]) : mixed
Parameters
$sBookmark : mixed = 'limesurvey'

Name of the bookmark

rollBackToTransactionBookmark()

Roll back to a transaction bookmark

rollBackToTransactionBookmark([mixed $sBookmark = 'limesurvey' ]) : mixed
Parameters
$sBookmark : mixed = 'limesurvey'

Name of the bookmark

dropDefaultValueMSSQL()

Drop a default value in MSSQL

dropDefaultValueMSSQL(string $fieldname, mixed $tablename) : mixed
Parameters
$fieldname : string
$tablename : mixed

dropUniqueKeyMSSQL()

This function drops a unique Key of an MSSQL database field by using the field name and the table name

dropUniqueKeyMSSQL(string $sFieldName, string $sTableName) : mixed
Parameters
$sFieldName : string
$sTableName : string

dropSecondaryKeyMSSQL()

This function drops a secondary key of an MSSQL database field by using the field name and the table name

dropSecondaryKeyMSSQL(string $sFieldName, mixed $sTableName) : mixed
Parameters
$sFieldName : string
$sTableName : mixed

dropPrimaryKey()

Drops the primary key of a table

dropPrimaryKey(string $sTablename[, string $oldPrimaryKeyColumn = null ]) : mixed
Parameters
$sTablename : string
$oldPrimaryKeyColumn : string = null

addPrimaryKey()

addPrimaryKey(string $sTablename, mixed $aColumns) : mixed
Parameters
$sTablename : string
$aColumns : mixed

modifyPrimaryKey()

Modifies a primary key in one command - this is only tested on MySQL

modifyPrimaryKey(string $sTablename, array<string|int, string> $aColumns) : mixed
Parameters
$sTablename : string

The table name

$aColumns : array<string|int, string>

Column names to be in the new key

fixMySQLCollations()

fixMySQLCollations(string $sEncoding, string $sCollation) : mixed
Parameters
$sEncoding : string
$sCollation : string

dropColumn()

Drops a column, automatically removes blocking default value on MSSQL

dropColumn(string $sTableName, string $sColumnName) : mixed
Parameters
$sTableName : string
$sColumnName : string

alterLanguageCode()

Renames a language code in the whole LimeSurvey database

alterLanguageCode(string $sOldLanguageCode, string $sNewLanguageCode) : mixed
Parameters
$sOldLanguageCode : string
$sNewLanguageCode : string

fixLanguageConsistencyAllSurveys()

fixLanguageConsistencyAllSurveys() : mixed

fixPostgresSequence()

This function fixes Postgres sequences for one/all tables in a database This is necessary if a table is renamed. If tablename is given then only that table is fixed

fixPostgresSequence([string $tableName = null ]) : void
Parameters
$tableName : string = null

Table name without prefix

runAddPrimaryKeyonAnswersTable400()

runAddPrimaryKeyonAnswersTable400(mixed &$oDB) : mixed
Parameters
$oDB : mixed

regenerateLabelCodes400()

Regenerate codes for problematic label sets Helper function (TODO: Put in separate class) Fails silently

regenerateLabelCodes400(int $lid[, bool $hasLanguageColumn = true ]) : void
Parameters
$lid : int

Label set id

$hasLanguageColumn : bool = true

Should be true before dbversion 400 is finished, false after

removeMysqlZeroDate()

Remove all zero-dates in $tableName by checking datetime columns from $tableSchema Zero-dates are replaced with null where possible; otherwise 1970-01-01

removeMysqlZeroDate(string $tableName, CDbTableSchema $tableSchema, CDbConnection $oDB) : void
Parameters
$tableName : string
$tableSchema : CDbTableSchema
$oDB : CDbConnection

getRelevantUpdates()

Returns a sorted array of update objects with version higher than $iOldDBVersion

getRelevantUpdates(int $iOldDBVersion, CDbConnection $db, string $options) : array<string|int, DatabaseUpdateBase>
Parameters
$iOldDBVersion : int
$db : CDbConnection
$options : string
Tags
todo

Move to class?

Return values
array<string|int, DatabaseUpdateBase>

        
On this page

Search results