class Update (View source)

The Update class handles the process of updating Automad using the dashboard.

Properties

static private $timestamp The update timestamp.

Methods

static string
getVersion()

Download version file and extract version number.

static Response
run()

Run the actual update.

static bool
supported()

Test if the server supports all required functions.

static bool
backupCurrent(array $items)

Move currently installed items to /cache/update/backup.

static string
extractVersion(string $str)

Extract version number form content of version.php.

static string
getArchive()

Download zip-archive to be installed.

static string
higherPHPVersionRequired()

Check if the server's PHP version matches the minimum requirements in the remote composer.json file.

static array
items()

Get items to be updated from config.

static string
log(string $data)

Log events to the update log file.

static bool
permissionsGranted(array $items)

Test if permissions for all items to be updated are granted.

static 
preloadClasses()

Preload required classes before removing old installation.

static bool
unpack(string $archive, array $items)

Unpack all item matching AM_UPDATE_ITEM.

Details

static string getVersion()

Download version file and extract version number.

Return Value

string Version number or false on error.

static Response run()

Run the actual update.

Return Value

Response the response object

static bool supported()

Test if the server supports all required functions.

Return Value

bool True on success, false on error

static private bool backupCurrent(array $items)

Move currently installed items to /cache/update/backup.

Parameters

array $items

Return Value

bool True on success, false on error

static private string extractVersion(string $str)

Extract version number form content of version.php.

Parameters

string $str

Return Value

string The version number

static private string getArchive()

Download zip-archive to be installed.

Return Value

string Path to the downloaded archive or false on error

static private string higherPHPVersionRequired()

Check if the server's PHP version matches the minimum requirements in the remote composer.json file.

Return Value

string a version number in case PHP is outdated or an empty string

static private array items()

Get items to be updated from config.

Return Value

array The array of items to be updated or false on error

static private string log(string $data)

Log events to the update log file.

Parameters

string $data

Return Value

string The path to the log file

static private bool permissionsGranted(array $items)

Test if permissions for all items to be updated are granted.

Parameters

array $items

Return Value

bool True on success, false on error

static private preloadClasses()

Preload required classes before removing old installation.

static private bool unpack(string $archive, array $items)

Unpack all item matching AM_UPDATE_ITEM.

Parameters

string $archive
array $items

Return Value

bool True on success, false on error