Contentserv PHP API

InstallTool
in package

Collection of various methods for the CONTENTSERV installation and backup process

Tags
access

public

since

CS4.0.0

Table of Contents

DELETE_INTERNAL_CACHE_HEADER  = '%c---- Execute Delete Internal Cache Files ----'
DELETE_PROJECT_CACHE_HEADER  = '%c---- Execute Delete Old Cache Files ----'
DELETE_PROJECT_CACHE_INFO  = '%cDeleting old cache files (>%d days) from folder "%s"'
DELETE_PROJECT_THUMBS_CACHE_HEADER  = '%c---- Execute Delete "%s" Side Internal Files ----'
MAX_TIME_LIMIT  = 0
MEMORY_LIMIT  = '2000M'
$BACKUP_WITHOUT_LICENSE  : mixed
__construct()  : mixed
Initialize install tool
backup()  : string
Creates a CONTENTSERV Backup
copyProjectFiles()  : void
Copy the portal.php file from the admin directory to the project
createFolderTree()  : array<string|int, mixed>
Returns an array of suite and module names
deleteInternalCacheFiles()  : void
Deletes the defined internal cache files and folders.
deleteOldBackupFiles()  : void
Deletes old Backup Files and outputs the result directly
deleteOldCacheFiles()  : void
Deletes old cache files
deleteOldLogEntries()  : void
Deletes old Log Entries and outputs the result directly
deleteOldThumbCacheFiles()  : void
This method deletes all project side cache files inside thumbs directory which is present in data/.cs directory
finalizeInstallation()  : void
Starts a database maintenance after an installation
getCacheFolders()  : array<string|int, mixed>
Returns the children folder paths of the main cache folders.
getEnvironmentCheck()  : void
Get the Enviroment Check by level
getFolderFromZip()  : string
unpacks a backup archive and returns the path
getFromZip()  : string
unpacks a backup file and returns the path
getServerStatus()  : void
Get the Server Status from the apache module "mod_status".
install()  : array<string|int, mixed>
Install a single Backup File
installFolder()  : void
Install a Backup Folder
storeAsZip()  : string
Pack a file and delete the original
storeFolderAsZip()  : string
Pack a folder and delete the original folder
uninstall()  : void
Creates a Backup and uninstalls the current project and outputs the result directly
updateDataModel()  : void
Updates the data model by creating and installing a backup
writeBackupFile()  : void
Writes a backupfile for a certain record.
writeToFile()  : void
Writes a file's content. If the file exists it will be overwritten, otherwise created.
zipBackupFolder()  : string
Pack a new created backup and create the default backup file "data.install.zip" if $both is true

Constants

DELETE_INTERNAL_CACHE_HEADER

public mixed DELETE_INTERNAL_CACHE_HEADER = '%c---- Execute Delete Internal Cache Files ----'
Tags

DELETE_PROJECT_CACHE_HEADER

public mixed DELETE_PROJECT_CACHE_HEADER = '%c---- Execute Delete Old Cache Files ----'
Tags

DELETE_PROJECT_CACHE_INFO

public mixed DELETE_PROJECT_CACHE_INFO = '%cDeleting old cache files (>%d days) from folder "%s"'
Tags

DELETE_PROJECT_THUMBS_CACHE_HEADER

public mixed DELETE_PROJECT_THUMBS_CACHE_HEADER = '%c---- Execute Delete "%s" Side Internal Files ----'
Tags

MEMORY_LIMIT

public mixed MEMORY_LIMIT = '2000M'
Tags

Properties

$BACKUP_WITHOUT_LICENSE

public static mixed $BACKUP_WITHOUT_LICENSE = array('mam', 'mail', 'rest', 'smart')
Tags

Methods

__construct()

Initialize install tool

public __construct() : mixed
Tags
Return values
mixed

backup()

Creates a CONTENTSERV Backup

public static backup(string $table, bool $both[, string $backupModule = '' ][, array<string|int, mixed> $records = NULL ][, bool $isUpdateDataModel = FALSE ][, bool $isSelection = FALSE ][, string $sSubFolder = '' ][, mixed $sFileName = '' ]) : string
Parameters
$table : string
$both : bool

If the default backup file should be created too

$backupModule : string = ''

The module name if the backup should only contain one module

$records : array<string|int, mixed> = NULL

The record names as array if the backup should only contain certain records

$isUpdateDataModel : bool = FALSE

If the function call comes from an update data model

$isSelection : bool = FALSE

TRUE if only a partial backup is created

$sSubFolder : string = ''

The path to an special folder seen from projects backup folder

$sFileName : mixed = ''
Tags
access

public

Return values
string

the path to the backup

copyProjectFiles()

Copy the portal.php file from the admin directory to the project

public static copyProjectFiles() : void
Tags
access

public

Return values
void

createFolderTree()

Returns an array of suite and module names

public static createFolderTree([string $backupModule = '' ]) : array<string|int, mixed>
Parameters
$backupModule : string = ''

The module name if the backup contains only one module

Tags
access

public

Return values
array<string|int, mixed>

An array of suite and module names

deleteInternalCacheFiles()

Deletes the defined internal cache files and folders.

public static deleteInternalCacheFiles([mixed $iDays = '' ]) : void
Parameters
$iDays : mixed = ''
Tags
access

public

Return values
void

deleteOldBackupFiles()

Deletes old Backup Files and outputs the result directly

public static deleteOldBackupFiles([int $days = 30 ]) : void
Parameters
$days : int = 30

delete backups older than $days. Default are 30 days

Tags
access

public

Return values
void

deleteOldCacheFiles()

Deletes old cache files

public static deleteOldCacheFiles([int $iDays = 7 ][, string $sCacheFolder = NULL ]) : void
Parameters
$iDays : int = 7

Deletes files older than $iDays. Default are 7 days.

$sCacheFolder : string = NULL

If you want to delete old cache files in a certain directory

Tags
access

public

Return values
void

deleteOldLogEntries()

Deletes old Log Entries and outputs the result directly

public static deleteOldLogEntries([int $days = 60 ]) : void
Parameters
$days : int = 60

delete entries older than $days. Default are 60 days

Tags
access

public

Return values
void

deleteOldThumbCacheFiles()

This method deletes all project side cache files inside thumbs directory which is present in data/.cs directory

public static deleteOldThumbCacheFiles([int $iDays = 30 ]) : void
Parameters
$iDays : int = 30

number above which files to be deleted

Tags
deprecated

since CS24.0: This method is no longer supported, please use "CSMamVolumeCache::deleteCache()"

Return values
void

finalizeInstallation()

Starts a database maintenance after an installation

public static finalizeInstallation() : void
Tags
access

public

Return values
void

getCacheFolders()

Returns the children folder paths of the main cache folders.

public static getCacheFolders([bool $bInternalCacheFolders = FALSE ]) : array<string|int, mixed>
Parameters
$bInternalCacheFolders : bool = FALSE

If only internal cache folders should be returned or project cache folders.

Tags
Return values
array<string|int, mixed>

with the folder names and the absolute path as key.

getEnvironmentCheck()

Get the Enviroment Check by level

public static getEnvironmentCheck(string $level) : void
Parameters
$level : string
Tags
access

public

Return values
void

getFolderFromZip()

unpacks a backup archive and returns the path

public static getFolderFromZip(string $sZipFilePath) : string
Parameters
$sZipFilePath : string

The archive path

Tags
access

public

Return values
string

The path to the new unpacked folder

getFromZip()

unpacks a backup file and returns the path

public static getFromZip(string $sTargetZipFilePath) : string
Parameters
$sTargetZipFilePath : string

the file path

Tags
access

public

Return values
string

the path of the new unpacked file

getServerStatus()

Get the Server Status from the apache module "mod_status".

public static getServerStatus() : void

This feature is only available for Linux/Unix systems

Tags
access

public

Return values
void

install()

Install a single Backup File

public static install(string $file[, bool $echo = TRUE ][, bool $folder = FALSE ]) : array<string|int, mixed>
Parameters
$file : string

The path to the backup file

$echo : bool = TRUE

If the output is displayed directly or after the backup is installed.

$folder : bool = FALSE

TRUE if $file is a folder

Tags
access

public

Return values
array<string|int, mixed>

Returns an array with strings in order to display results

installFolder()

Install a Backup Folder

public static installFolder(string $folder[, bool $bIsUpdateDataModel = false ]) : void
Parameters
$folder : string

The name of the backup folder

$bIsUpdateDataModel : bool = false

If the function call comes from an update data model

Tags
access

public

Return values
void

storeAsZip()

Pack a file and delete the original

public static storeAsZip(string $file) : string
Parameters
$file : string

the file path

Tags
access

public

Return values
string

the path of the packed file

storeFolderAsZip()

Pack a folder and delete the original folder

public static storeFolderAsZip(string $folder) : string
Parameters
$folder : string

The folder path

Tags
access

public

Return values
string

The path of the backup

uninstall()

Creates a Backup and uninstalls the current project and outputs the result directly

public static uninstall(string $table) : void
Parameters
$table : string
Tags
access

public

Return values
void

updateDataModel()

Updates the data model by creating and installing a backup

public static updateDataModel([string $sBackupModuleName = '' ][, array<string|int, mixed> $aRecords = NULL ]) : void
Parameters
$sBackupModuleName : string = ''

The module name if the update data model should only contain one module

$aRecords : array<string|int, mixed> = NULL

The record names as array if the update data model should only contain certain records

Tags
access

public

Return values
void

writeBackupFile()

Writes a backupfile for a certain record.

public static writeBackupFile(string $sFilePath, Record $oRecord, bool $bIsCompleteBackup, bool $bIsUpdateDataModel) : void

Dies on missing writing permissions.

Parameters
$sFilePath : string

The path to the backup file

$oRecord : Record

The record the backup file is written for

$bIsCompleteBackup : bool

TRUE if backup file is part of a complete backup

$bIsUpdateDataModel : bool

TRUE if backup file is written for update data model

Tags
access

public

Return values
void

writeToFile()

Writes a file's content. If the file exists it will be overwritten, otherwise created.

public static writeToFile(string $file, string $content) : void
Parameters
$file : string

The path to the file

$content : string

The content of the file

Tags
access

public

Return values
void

zipBackupFolder()

Pack a new created backup and create the default backup file "data.install.zip" if $both is true

public static zipBackupFolder(string $sFolderPath, bool $both[, string $backupModule = '' ]) : string
Parameters
$sFolderPath : string

The path of the backup folder

$both : bool

If the default backup file should be created too

$backupModule : string = ''

The module name if the backup contains only one module

Tags
access

public

Return values
string

If $both is true it returns the path to the default backup file otherwise the function returns the path of the original backup


        

Search results