FUEL CMS User Guide : Version 1.5.2


Fuel Sync Class

This class extends the Fuel_advanced_module class.

Properties Reference

Property Default Value Description
public
remote none The name of the remote server
include
array('assets', 'data')
What to include in sync. Options are "assets", "data", "both"
change_threshold 50 The number of detected changes that are allowed before an error is thrown saying "This Don't Look Right!"
asset_folders
array('images', 'pdf')
The asset folders to be included in the sync
db_tables AUTO The database tables to include in the sync. AUTO will automatically sync the basic FUEL tables as well as all custom module tables
asset_compare_methods
array('date', 'size')
Methods to use to determine if the assets are different
exclude_assets #\.html$|\.htaccess$|\.git|\.php|\.js#
allow_deletes 1 Determines whether to delete local assets during sync process if they are not included in the remote list
create_backup 1 Determines whether to create a backup of the assets and data before running the sync
test_mode none Determines whether to run the syncing process in test mode which will not alter any assets or data and just provide you a log of what will happen
new_folder_permissions 511 The folder permissions assigned to newly created folders during the sync
db_sync_prefs
array('tables' => array
(
)
, 'ignore' => array
(
)
, 'add_drop' => 1, 'add_insert' => 1, )
protected
_logs N/A Log of items indexed
_local_assets N/A Cache of local assets
_remote_assets N/A Cache of remote assets

Function Reference [+]

$this->fuel->sync->initialize([$params=array()])

Initialize the backup object. Accepts an associative array as input, containing backup preferences. Also will set the values in the config as properties of this object.

Returns

void

Parameters

(array) $params config preferences

$this->fuel->sync->set_remote('$remote')

Sets the remote server to sync with.

Returns

void

Parameters

(string) $remote The path to the remote server including the 'http://'

$this->fuel->sync->pull(['$remote'=''], [$params=array()])

Sets the remote server to sync with.

Returns

void

Parameters

(string) $remote The path to the remote server including the 'http://'
(array) $params Initializaiton parameters

$this->fuel->sync->pull_assets(['$delete'=NULL], ['$test_mode'=NULL])

Pulls the assets from the remote server.

Returns

void

Parameters

(boolean) $delete Determines whether to delete local assets
(boolean) $test_mode Determines whether to run the syncing without actually changing any images or data

$this->fuel->sync->local_assets(['$folders'=NULL], ['$exclude'=NULL])

Returns a list of local assets.

Returns

void

Parameters

(array) $folders An array of asset folders to include in the list
(mixed) $exclude An array or a regular expression string of files to exclude from the list

$this->fuel->sync->remote_assets()

Returns an array of remote assets to be synced.

Returns

array

$this->fuel->sync->local_diff_to_delete()

Returns an array of assets that don't appear on the remote site and should be deleted locally.

Returns

array

$this->fuel->sync->local_diff_to_sync()

Returns an array of assets that have different file sizes, timestamps or both, that should be synced locally.

Returns

array

$this->fuel->sync->local_data([$db_sync_prefs=array()])

Returns the SQL data. This is used in the controller that the local machine calls when syncing.

Returns

string

Parameters

(array) $db_sync_prefs An array of DB backup preferences (http://ellislab.com/codeigniter/user-guide/database/utilities.html#backup)

$this->fuel->sync->pull_data(['$test_mode'=FALSE])

Pulls the data from the remote site and replaces the local data.

Returns

void

Parameters

(boolean) $test_mode Whether to use test mode or not

$this->fuel->sync->remote_data()

Retuns the data from the remote site.

Returns

string

$this->fuel->sync->asset_compare_methods()

Returns an array of the different asset compare methods (date, size) to use when comparing local and remote files for syncing.

Returns

array

$this->fuel->sync->remote_asset_path(['$asset'=''])

Returns the remote asset path URL.

Returns

string

Parameters

(string) $asset The asset file path (e.g. images/my_pig.jpg)

$this->fuel->sync->remote_asset_url()

Returns the remote URL path of where to retrieve a list of remote assets.

Returns

string

$this->fuel->sync->remote_data_url()

Returns the remote URL path of where to retrieve the remote data dump.

Returns

string

$this->fuel->sync->remote_options()

Returns a key/value array used for the remote servers list.

Returns

array

$this->fuel->sync->is_enabled()

Returns a boolean value as to whether this module is enabled and thus remotely accessible. This value must be set on the remote servers version.

Returns

boolean

$this->fuel->sync->set_test_mode('$mode')

Sets whether the syncing process should be in "test" mode or not which means no assets or data will actually be pulled and synced.

Returns

void

$this->fuel->sync->is_test_mode()

Returns boolean value as to whether the module is in test mode or not.

Returns

boolean

$this->fuel->sync->get_token()

Returns the security token used for authenticating with the remote server.

Returns

string

$this->fuel->sync->validate()

Validates whether the syncing process can from the remote server's perspective based on matching security tokens and whether the module is enabled.

Returns

boolean

$this->fuel->sync->log_message('$msg', ['$type'='error'])

Adds an item to the index log. Used when printing out the index log informaiton.

Returns

void

Parameters

(string) $msg Log message
(string) $type Type of log message

$this->fuel->sync->logs()

Returns an array of log messages. Used when printing out the index log informaiton.

Returns

array

$this->fuel->sync->display_log(['$type'='all'], ['$tag'='span'], ['$return'=FALSE])

Adds an item to the index log. Used when printing out the index log informaiton.

Returns

string

Parameters

(string) $type 
(string) $tag 
(boolean) $return