PHP Class Habari\Update

Checks for updates to Habari and its libraries
Inheritance: extends Singleton
Show file Open project: habari/system

Public Methods

Method Description
add ( string $name, string $beaconid, string $current_version ) : boolean Add a beaconid to the list of beaconids to version-check.
check ( ) : array Perform a check of all beaconids.
check_plugins ( ) Compare the current set of plugins with those we last checked for updates.
cron ( null $cronjob = null ) : boolean Endpoint for the update-check cronjob.
filter_unchanged ( array $beacon ) : boolean Return true if the beacon data contains updates from the server
updates_available ( string $guid = null ) : boolean Return all available updates, or the updates available for a single GUID.

Protected Methods

Method Description
instance ( ) Enables singleton working properly

Private Methods

Method Description
add_plugins ( ) Loop through all the active plugins and add their information to the list of plugins to check for updates.
add_theme ( ) Add the currently active theme's information to the list of beacons to check for updates.
register_beacons ( ) Register beacons to check for updates.

Method Details

add() public static method

Add a beaconid to the list of beaconids to version-check.
public static add ( string $name, string $beaconid, string $current_version ) : boolean
$name string the name of the component that will be checked
$beaconid string the id of the beacon to check
$current_version string the current version of the resource represented by this beaconid
return boolean

check() public static method

Notifies update_check plugin hooks when checking so that they can add their beaconids to the list.
public static check ( ) : array
return array An array of update beacon information for components that have updates

check_plugins() public static method

This is run by AdminHandler on every page load to make sure we always have fresh data on the dashboard.
public static check_plugins ( )

cron() public static method

Loads beacons, checks for updates from hp.o, and saves any updates to the DB.
public static cron ( null $cronjob = null ) : boolean
$cronjob null Unused. The CronJob object being executed when being run as cron.
return boolean True on successful check, false on any failure (so cron runs again).

filter_unchanged() public static method

Return true if the beacon data contains updates from the server
public static filter_unchanged ( array $beacon ) : boolean
$beacon array the beacon data from the $beacons array
return boolean true if there are updates available for this beacon

instance() protected static method

Enables singleton working properly
protected static instance ( )

updates_available() public static method

Return all available updates, or the updates available for a single GUID.
public static updates_available ( string $guid = null ) : boolean
$guid string A GUID to return available updates for.
return boolean Array of all available updates if no GUID is specified.