LimeSurvey API - Master branch

UpdateForm extends CFormModel
in package

Update Form Model

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

Tags
subpackage

Backend

inheritdoc

Table of Contents

Properties

$build  : string
$view  : string
$path_cookie  : string
$proxy_host_name  : string
$proxy_host_port  : int
$publicdir  : string
$rootdir  : string
$tempdir  : string

Methods

backupDb()  : stdClass
Create a backup of the DataBase
backupFiles()  : stdClass
Create a backup of the files that will be updated
checkUpdateKeyonServer()  : bool
check if a submitted update key exist on the update server and if it's valid
downloadUpdateFile()  : object
This function requests a download to the server
downloadUpdateUpdaterFile()  : object
This function download the file to update the updater to the last version
getChangedFiles()  : mixed|stdClass
This function requests the list of changed file between two build
getChangeLog()  : mixed|stdClass
This function requests the change log between the curent build and the destination build
getFileStatus()  : array<string|int, mixed>
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 ?
getLocalChecks()  : stdClass
This function check for local errors such as readonly files, available space, php ini config etc.
getLocalChecksForUpdater()  : object
This function check for local arrors such as readonly files/directory to update the updater itself
getUpdateInfo()  : stdClass
First call to the server : This function requests the latest update information from the update server necessary to build the update buttons.
getUpdateNotification()  : object
Check if an update is available, and prints the update notification It also check if the assets need to be republished
getWelcomeMessage()  : string
The server will do some checks and will ask for the correct view to be diplayed.
init()  : mixed
removeDeletedFiles()  : object
Delete the files tagged as deleted in the update
removeTmpFile()  : object
Delete a tmp file
republishAssets()  : mixed
Republish all the assets For now, only for frontEnd templates (backend theme are still based on file assets, not directory assets )
setUpdateKey()  : SettingGlobal|array<string, false|string>
create or update the updateKey to the submitted value
unzipUpdateFile()  : object
Unzip the update file.
unzipUpdateUpdaterFile()  : object
Unzip the update file.
updateVersion()  : null
Update the version file to the destination build version
checkAssets()  : bool
Check if assets needs to be updated
createDbBackup()  : stdClass
Create a backup of the DataBase
fileSystemCheck()  : stdClass
Check if a file / dir is writable AND/OR if it has enough freespace
fileSystemCheckAppath()  : stdClass
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.
fileSystemCheckConfig()  : stdClass
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.
getCheckedFile()  : stdClass
Check if a file (added/deleted/) on the update yet exists on the server, or has been modified
getDbChecks()  : mixed|stdClass
Call the server to get the necessary datas to check the database
getDbTotalSize()  : string
Return the total size of the current database in MB
getFileSystemCheckList()  : array<string|int, mixed>
Call the server to get the list of files and directory to check (and check type : writable / free space)
getModuleChecks()  : stdClass
Get the list of required PHP modules for this update
getMysqlChecks()  : stdClass
getProtocol()  : string
Returns the supported protocol extension (https/http)
getReadOnlyCheckedFile()  : stdClass
Check if a file (added/deleted/modified) from the update exists yet on the server and if it is readonly
performDownload()  : object
This function download a file from the ComfortUpdate and accept redirection
performRequest()  : mixed|stdClass
This function perform the request
phpVerCheck()  : stdClass
Get the required minimal php version for destination build from server, and compare it to local php version.

Properties

$view

public string $view

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

$proxy_host_name

private string $proxy_host_name

Methods

backupDb()

Create a backup of the DataBase

public backupDb(string $destinationBuild) : stdClass
Parameters
$destinationBuild : string
Return values
stdClass

error/success and text message

backupFiles()

Create a backup of the files that will be updated

public backupFiles(array<string|int, array<string|int, mixed>> $updateinfos) : stdClass
Parameters
$updateinfos : array<string|int, array<string|int, mixed>>

array of files to updated (needs file field)

Return values
stdClass

error/success and text message

checkUpdateKeyonServer()

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

public checkUpdateKeyonServer(string $submittedUpdateKey) : bool
Parameters
$submittedUpdateKey : string

the submitted update key

Return values
bool

true if it exists, false if it doesn't

downloadUpdateFile()

This function requests a download to the server

public downloadUpdateFile(int $downloadid, string $tobuild) : object
Parameters
$downloadid : int

the id of the download on the server

$tobuild : string
Return values
object

//TODO $downloadid not used locally

downloadUpdateUpdaterFile()

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

public downloadUpdateUpdaterFile(string $tobuild) : object
Parameters
$tobuild : string
Return values
object

getChangedFiles()

This function requests the list of changed file between two build

public getChangedFiles(int $destinationBuild) : mixed|stdClass
Parameters
$destinationBuild : int
Return values
mixed|stdClass

getChangeLog()

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

public getChangeLog(int $destinationBuild) : mixed|stdClass
Parameters
$destinationBuild : int
Return values
mixed|stdClass

getFileStatus()

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 ?

public getFileStatus(array<string|int, mixed> $updateinfo) : array<string|int, mixed>
Parameters
$updateinfo : array<string|int, mixed>

Array of updated files

Return values
array<string|int, mixed>

getLocalChecks()

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

public getLocalChecks(int $destinationBuild) : stdClass

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

Parameters
$destinationBuild : int

: the id of the destination build

Return values
stdClass

$checks ; an object indexing local checks

getLocalChecksForUpdater()

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

public getLocalChecksForUpdater() : object
Return values
object

$checks

getUpdateInfo()

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

public getUpdateInfo([string|bool $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.

Parameters
$crosscheck : string|bool = "1"

if it checks for info for both stable and unstable branches

Return values
stdClass

Contains update information or error object

getUpdateNotification()

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

public getUpdateNotification() : object
Return values
object

getWelcomeMessage()

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

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

the update key -

$destinationBuild : string
Return values
string

html

removeDeletedFiles()

Delete the files tagged as deleted in the update

public removeDeletedFiles(array<string|int, mixed> $updateinfos) : object
Parameters
$updateinfos : array<string|int, mixed>
Return values
object

removeTmpFile()

Delete a tmp file

public removeTmpFile([string $sTmpFile = 'update.zip' ]) : object
Parameters
$sTmpFile : string = 'update.zip'

The name of the file to delete in tmp/ directory

Return values
object

republishAssets()

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

public republishAssets() : mixed

setUpdateKey()

create or update the updateKey to the submitted value

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

the new key id

Return values
SettingGlobal|array<string, false|string>

the new update key if success, CActiveRecord result if error

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

unzipUpdateFile()

Unzip the update file.

public unzipUpdateFile([string $file_to_unzip = 'update.zip' ]) : object
Parameters
$file_to_unzip : string = 'update.zip'
Return values
object

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

unzipUpdateUpdaterFile()

Unzip the update file.

public unzipUpdateUpdaterFile() : object
Return values
object

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

updateVersion()

Update the version file to the destination build version

public updateVersion(string $destinationBuild) : null
Parameters
$destinationBuild : string

the id of the new version

Return values
null

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

checkAssets()

Check if assets needs to be updated

private checkAssets() : bool
Return values
bool

createDbBackup()

Create a backup of the DataBase

private createDbBackup() : stdClass
Return values
stdClass

result of backup

fileSystemCheck()

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

private fileSystemCheck(object $obj) : stdClass
Parameters
$obj : object

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

Return values
stdClass

the result of the test

fileSystemCheckAppath()

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.

private fileSystemCheckAppath(object $obj) : stdClass
Parameters
$obj : object

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

Tags
SuppressWarnings

(PHPMD.UnusedPrivateMethod)

Return values
stdClass

the result of the test

fileSystemCheckConfig()

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.

private fileSystemCheckConfig(object $obj) : stdClass
Parameters
$obj : object

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

Tags
SuppressWarnings

(PHPMD.UnusedPrivateMethod)

Return values
stdClass

the result of the test

getCheckedFile()

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

private getCheckedFile(array<string|int, mixed> $file) : stdClass
Parameters
$file : array<string|int, mixed>

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

Return values
stdClass

containing a list of read only files

getDbChecks()

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

private getDbChecks(string $destinationBuild) : mixed|stdClass
Parameters
$destinationBuild : string
Return values
mixed|stdClass

getDbTotalSize()

Return the total size of the current database in MB

private getDbTotalSize() : string
Return values
string

getFileSystemCheckList()

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

private getFileSystemCheckList() : array<string|int, mixed>
Return values
array<string|int, mixed>

containing the list

getModuleChecks()

Get the list of required PHP modules for this update

private getModuleChecks(int $build) : stdClass
Parameters
$build : int

the buildId to test

Return values
stdClass

the success/error message

getMysqlChecks()

private getMysqlChecks(int $build) : stdClass
Parameters
$build : int
Return values
stdClass

getProtocol()

Returns the supported protocol extension (https/http)

private getProtocol() : string
Return values
string

getReadOnlyCheckedFile()

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

private getReadOnlyCheckedFile(array<string|int, mixed> $file) : stdClass
Parameters
$file : array<string|int, mixed>

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

Return values
stdClass

containing a list of read only files

performDownload()

This function download a file from the ComfortUpdate and accept redirection

private performDownload(string $getters[, string $fileName = 'update' ]) : object
Parameters
$getters : string

request parameters

$fileName : string = 'update'
Return values
object

containing success = TRUE or error message

performRequest()

This function perform the request

private performRequest(string $getters[, bool $create_new_cookie_file = false ]) : mixed|stdClass
Parameters
$getters : string

request parameters

$create_new_cookie_file : bool = false
Return values
mixed|stdClass

the server page answer (json most of the time)

phpVerCheck()

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

private phpVerCheck(int $build) : stdClass
Parameters
$build : int

the buildId to test

Return values
stdClass

the success/error result


        
On this page

Search results