function _validate_synced_files_db in CDN 6
Helper function to validate a possible synced files DB value.
Parameters
$synced_files_db: A user-entered synced files DB value.
$name: The name of the form item on which to set errors, if any.
Return value
FALSE if there were any errors, TRUE if there weren't any.
2 calls to _validate_synced_files_db()
- cdn_admin_advanced_settings_form_validate in ./
cdn.admin.inc - Default validate callback for the advancedsettings form.
- cdn_admin_settings_form_validate in ./
cdn.admin.inc - Default validate callback for the settings form.
File
- ./
cdn.admin.inc, line 192 - Settings administration UI.
Code
function _validate_synced_files_db($synced_files_db, $name) {
// Validate the file name.
if (strpos($synced_files_db, CDN_DAEMON_SYNCED_FILES_DB) === FALSE) {
form_set_error($name, t('The synced files database should have the file name %name.', array(
'%name' => CDN_DAEMON_SYNCED_FILES_DB,
)));
return FALSE;
}
// Validate the entered synced files database.
if (!file_exists($synced_files_db)) {
form_set_error($name, t('The synced files database does not exist.'));
return FALSE;
}
else {
if (!@fopen($synced_files_db, 'r')) {
form_set_error($name, t('The synced files database could not be opened for reading.'));
return FALSE;
}
}
return TRUE;
}