UpdateForm

Extends\CFormModel

Update Form Model

This model retrieves all the data Comfort Updates needs. Most of them come from request to the Update Server.

package

LimeSurvey

subpackage

Backend

inheritdoc

Methods

Create a backup of the DataBase

backupDb(string $destinationBuild): \stdClass

Arguments

$destinationBuild

string

Response

\stdClass

error/success and text message

Create a backup of the files that will be updated

backupFiles(array<mixed,array> $updateinfos): \stdClass

Arguments

$updateinfos

array<mixed,array>

array of files to updated (needs file field)

Response

\stdClass

error/success and text message

Check if assets needs to be updated

checkAssets(): boolean

Response

boolean

check if a submitted update key exist on the update server and if it's valid

checkUpdateKeyonServer(string $submittedUpdateKey): boolean

Arguments

$submittedUpdateKey

string

the submitted update key

Response

boolean

true if it exists, false if it doesn't

Create a backup of the DataBase

createDbBackup(): \stdClass

Response

\stdClass

result of backup

This function requests a download to the server

downloadUpdateFile(integer $downloadid,string $tobuild): object

Arguments

$downloadid

integer

the id of the download on the server

$tobuild

string

Response

object

//TODO $downloadid not used locally

This function download the file to update the updater to the last version

downloadUpdateUpdaterFile(string $tobuild): object

Arguments

$tobuild

string

Response

object

Check if a file / dir is writable AND/OR if it has enough freespace

fileSystemCheck(object $obj): \stdClass

Arguments

$obj

object

an object containing the name of the file/directory to check, and what must be checked

Response

\stdClass

the result of the test

build the file / Directory path using APPATH, and then call the check method NB: This method is called by building the method name string in getFileSystemCheckList.

fileSystemCheckAppath(object $obj): \stdClass
SuppressWarnings

(PHPMD.UnusedPrivateMethod)

Arguments

$obj

object

an object containing the name of the file/directory to check, and what must be checked

Response

\stdClass

the result of the test

build the file / Directory path using getConfig(), and then call the check method NB: This method is called by building the method name string in getFileSystemCheckList.

fileSystemCheckConfig(object $obj): \stdClass
SuppressWarnings

(PHPMD.UnusedPrivateMethod)

Arguments

$obj

object

an object containing the name of the file/directory to check, and what must be checked

Response

\stdClass

the result of the test

This function requests the list of changed file between two build

getChangedFiles(integer $destinationBuild): mixed|\stdClass

Arguments

$destinationBuild

integer

Response

mixed|\stdClass

This function requests the change log between the curent build and the destination build

getChangeLog(integer $destinationBuild): mixed|\stdClass

Arguments

$destinationBuild

integer

Response

mixed|\stdClass

Check if a file (added/deleted/) on the update yet exists on the server, or has been modified

getCheckedFile(array $file): \stdClass

Arguments

$file

array

array of files to update (must contain file, type and chekcsum indexes)

Response

\stdClass

containing a list of read only files

Call the server to get the necessary datas to check the database

getDbChecks(string $destinationBuild): mixed|\stdClass

Arguments

$destinationBuild

string

Response

mixed|\stdClass

Return the total size of the current database in MB

getDbTotalSize(): string

Response

string

This function provide status information about files presents on the system that will be afected by the update : do they exist ? are they writable ? modified ?

getFileStatus(array $updateinfo): array

Arguments

$updateinfo

array

Array of updated files

Response

array

Call the server to get the list of files and directory to check (and check type : writable / free space)

getFileSystemCheckList(): array

Response

array

containing the list

This function check for local errors such as readonly files, available space, php ini config etc.

getLocalChecks(integer $destinationBuild): \stdClass

It calls the server to get the list of files/directories to check

Arguments

$destinationBuild

integer

: the id of the destination build

Response

\stdClass

$checks ; an object indexing local checks

This function check for local arrors such as readonly files/directory to update the updater itself

getLocalChecksForUpdater(): object

Response

object

$checks

Get the list of required PHP modules for this update

getModuleChecks(integer $build): \stdClass

Arguments

$build

integer

the buildId to test

Response

\stdClass

the success/error message

getMysqlChecks

getMysqlChecks(integer $build): \stdClass

Arguments

$build

integer

Response

\stdClass

Returns the supported protocol extension (https/http)

getProtocol(): string

Response

string

Check if a file (added/deleted/modified) from the update exists yet on the server and if it is readonly

getReadOnlyCheckedFile(array $file): \stdClass

Arguments

$file

array

a file to update (must contain file and type indexes)

Response

\stdClass

containing a list of read only files

First call to the server : This function requests the latest update information from the update server necessary to build the update buttons.

getUpdateInfo(string|boolean $crosscheck = "1"): \stdClass

If any error occurred (server not answering, no curl, server returns error, etc.), the view check_updates/update_buttons/_updatesavailable_error will be rendered by the controller.

Arguments

$crosscheck

string|boolean

if it checks for info for both stable and unstable branches

Response

\stdClass

Contains update information or error object

Check if an update is available, and prints the update notification It also check if the assets need to be republished

getUpdateNotification(): object

Response

object

The server will do some checks and will ask for the correct view to be diplayed.

getWelcomeMessage(string $updateKey,string $destinationBuild): string

Arguments

$updateKey

string

the update key -

$destinationBuild

string

Response

string

html

init

init()
inheritdoc

This function download a file from the ComfortUpdate and accept redirection

performDownload(string $getters,string $fileName = 'update'): object

Arguments

$getters

string

request parameters

$fileName

string

Response

object

containing success = TRUE or error message

This function perform the request

performRequest(string $getters,boolean $create_new_cookie_file = false): mixed|\stdClass

Arguments

$getters

string

request parameters

$create_new_cookie_file

boolean

Response

mixed|\stdClass

the server page answer (json most of the time)

Get the required minimal php version for destination build from server, and compare it to local php version.

phpVerCheck(integer $build): \stdClass

Arguments

$build

integer

the buildId to test

Response

\stdClass

the success/error result

Delete the files tagged as deleted in the update

removeDeletedFiles(array $updateinfos): object

Arguments

$updateinfos

array

Response

object

Delete a tmp file

removeTmpFile(string $sTmpFile = 'update.zip'): object

Arguments

$sTmpFile

string

The name of the file to delete in tmp/ directory

Response

object

Republish all the assets For now, only for frontEnd templates (backend theme are still based on file assets, not directory assets )

republishAssets()

create or update the updateKey to the submitted value

setUpdateKey(string $submittedUpdateKey): \SettingGlobal|\array<string,false|\string>

Arguments

$submittedUpdateKey

string

the new key id

Response

\SettingGlobal|\array

the new update key if success, CActiveRecord result if error

TODO : should return same status than server to use the same view render

Unzip the update file.

unzipUpdateFile(string $file_to_unzip = 'update.zip'): object

Arguments

$file_to_unzip

string

Response

object

NULL if success or message error void (TODO : return status)

Unzip the update file.

unzipUpdateUpdaterFile(): object

Response

object

NULL if success or message error void (TODO : return status)

Update the version file to the destination build version

updateVersion(string $destinationBuild): null

Arguments

$destinationBuild

string

the id of the new version

Response

null

: will never fail (file access tested before), or only if user changed it manually

Properties

The build id

build :string
var

The build id

Type(s)

string

The view to display : used only for welcome type views to let the server choose which view will be displayed

view :string
var

The view to display : used only for welcome type views to let the server choose which view will be displayed

Type(s)

string

proxy_host_name

proxy_host_name :string
var

Type(s)

string

proxy_host_port

proxy_host_port :integer
var

Type(s)

integer

tempdir

tempdir :string
var

Type(s)

string

rootdir

rootdir :string
var

Type(s)

string

publicdir

publicdir :string
var

Type(s)

string