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

Methods

init

init() 

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

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

If any error occured (server not answering, no curl, servor 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

array

Contains update information or error object

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

getWelcomeMessage(string $updateKey = NULL, string $destinationBuild) 

Arguments

$updateKey

string

the update key

$destinationBuild

string

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 or update the updatekey to the submited value

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

Arguments

$submittedUpdateKey

string

the new key id

Response

\array

the new update key if success, CActiveRecord result if error TODO : should return same status than server to use the same view render

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

getLocalChecks(int $destinationBuild) : \stdClass

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

Arguments

$destinationBuild

int

: 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

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

getChangelog(int $destinationBuild) : \TODO

Arguments

$destinationBuild

int

Response

\TODO

: check return

This function requests the list of changed file between two build

getChangedFiles(int $destinationBuild) : \TODO

Arguments

$destinationBuild

int

Response

\TODO

: check return

This function requests a download to the server

downloadUpdateFile(int $downloadid, $tobuild) : object

Arguments

$downloadid

int

the id of the download on the server

$tobuild

Response

object

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

downloadUpdateUpdaterFile($tobuild) : object

Arguments

$tobuild

Response

object

Unzip the update file.

unzipUpdateFile($file_to_unzip = 'update.zip') : NULL

Arguments

$file_to_unzip

Response

NULL

if sucess or message error void (TODO : return status)

Unzip the update file.

unzipUpdateUpdaterFile() : NULL

Response

NULL

if sucess or message error void (TODO : return status)

Delete the files tagged as deleted in the update

removeDeletedFiles($updateinfos) : object

Arguments

$updateinfos

Response

object

Delete a tmp file

removeTmpFile($sTmpFile = 'update.zip') : \obj

Arguments

$sTmpFile

Response

\obj

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

republishAssets() 

Update the version file to the destination build version

updateVersion(INT $destinationBuild) : NULL

Arguments

$destinationBuild

INT

the id of the new version

Response

NULL

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

Destroy the global settings stored in the settings (they sould not be used anymore.

destroyGlobalSettings() : NULL

..)

Response

NULL

(TODO : return status)

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(int $updateinfo) : array

Arguments

$updateinfo

int

array of updated files

Response

array

Create a backup of the files that will be updated

backupFiles(mixed $updateinfos) : \stdClass

Arguments

$updateinfos

mixed

array of files to updated (needs file field)

Response

\stdClass

error/success and text message

Create a backup of the DataBase

backupDb($destionationBuild) : \stdClass

Arguments

$destionationBuild

Response

\stdClass

error/success and text message

Checl if assets needs to be updated

checkAssets() 

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

getUpdateNotification() : mixed
access

protected

Response

mixed

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

_getDbChecks($destinationBuild) 

Arguments

$destinationBuild

Return the total size of the current database in MB

_getDbTotalSize() : string

Response

string

Create a backup of the DataBase

_createDbBackup() : \stdClass

Response

\stdClass

result of backup

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

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 list of files and directory to check (and check type : writable / free space)

_getFileSystemCheckList() : object

Response

object

containing the list

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

_fileSystemCheckAppath(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 getConfig(), and then call the check method

_fileSystemCheckConfig(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

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

_phpVerCheck(int $build) : \stdClass

Arguments

$build

int

the buildid to test

Response

\stdClass

the success/error result

Get the list of required PHP modules for this update

_getModuleChecks(int $build) : \stdClass

Arguments

$build

int

the buildid to tes

Response

\stdClass

the success/error message

_getMysqlChecks

_getMysqlChecks(integer $build) 

Arguments

$build

integer

Returns the supported protocol extension (https/http)

_getProtocol() : string

Response

string

This function download a file from the ComfortUpdate and accept redirection

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

Arguments

$getters

string

request parameters

$fileName

Response

object

containing success = TRUE or error message

This function perform the request

_performRequest(string $getters, $CREATE_NEW_COOKIE_FILE = FALSE) : \html

Arguments

$getters

string

request parameters

$CREATE_NEW_COOKIE_FILE

Response

\html

the server page answer (json most of the time)

Properties

build

build : 

view

view : 

proxy_host_name

proxy_host_name : 

proxy_host_port

proxy_host_port : 

tempdir

tempdir : 

rootdir

rootdir : 

publicdir

publicdir :