LimeSurvey API - Master branch

CopySurveyResources

This class is responsible for copying a survey's resources.

Class CopySurveyResources

Table of Contents

Properties

$copiedFilesInfo  : array<string|int, array<string, string>>
$errorFilesInfo  : array<string|int, array<string, string>>

Methods

copyResources()  : array<string|int, mixed>
Copy resources from the source survey ($sourceSurveyId) to the target survey ($targetSurveyId)
addError()  : mixed
Adds the file to the failed files array
addSuccess()  : mixed
Adds the file to the copied files array
checkTargetDir()  : bool
Creates the target directory if it doesn't exists
copyDirectory()  : mixed
Copy $sourceDir to $targetDir.
getResult()  : array<string|int, array<string|int, array<string, string>>>
Returns the array of failed and copied files/directories

Properties

$copiedFilesInfo

private array<string|int, array<string, string>> $copiedFilesInfo = []

array of successfully copied files/dirs in the form ['filename' => ..., 'status' => ...]

$errorFilesInfo

private array<string|int, array<string, string>> $errorFilesInfo = []

array of failed files/dirs in the form ['filename' => ..., 'status' => ...]

Methods

copyResources()

Copy resources from the source survey ($sourceSurveyId) to the target survey ($targetSurveyId)

public copyResources(int $sourceSurveyId, int $targetSurveyId) : array<string|int, mixed>
Parameters
$sourceSurveyId : int
$targetSurveyId : int
Return values
array<string|int, mixed>

An array of failed and copied files/directories

addError()

Adds the file to the failed files array

private addError(string $filename, string $status) : mixed
Parameters
$filename : string
$status : string

addSuccess()

Adds the file to the copied files array

private addSuccess(string $filename, string $status) : mixed
Parameters
$filename : string
$status : string

checkTargetDir()

Creates the target directory if it doesn't exists

private checkTargetDir(mixed $targetDir) : bool
Parameters
$targetDir : mixed
Return values
bool

Returns true if the directory exists or was created.

copyDirectory()

Copy $sourceDir to $targetDir.

private copyDirectory(string $sourceDir, string $targetDir) : mixed
Parameters
$sourceDir : string
$targetDir : string

getResult()

Returns the array of failed and copied files/directories

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

        
On this page

Search results