Skip to content
Snippets Groups Projects
Commit e5e5724c authored by Daniel Kudwien's avatar Daniel Kudwien
Browse files

by sun: Fixed coding-style.

parent bcc6c92a
Branches
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ Demo x.x-x.x, xxxx-xx-xx
Demo 5.x-1.x, xxxx-xx-xx
------------------------
by sun: Fixed coding-style.
#424524 by John Money, sun: Fixed site not reset on all cron runs.
#393186 by sun: Fixed fatal error: Only variables can be passed by reference.
#372113 by sun: Fixed not all cache tables are skipped.
......
......@@ -122,7 +122,8 @@ function _demo_dump_table_data($table) {
// Empty blobs need to be different, but '0' is also empty :-(
if (empty($value) && $value != '0') {
$values[] = "''";
} else {
}
else {
$values[] = '0x' . bin2hex($value);
}
}
......
......@@ -17,7 +17,7 @@ function _demo_admin_settings() {
$form['status'] = array(
'#type' => 'fieldset',
'#title' => t('Status'),
'#collapsible' => false,
'#collapsible' => FALSE,
);
if (variable_get('demo_reset_last', 0)) {
$reset_date = format_date(variable_get('demo_reset_last', 0));
......@@ -37,8 +37,8 @@ function _demo_admin_settings() {
$form['dump'] = array(
'#type' => 'fieldset',
'#title' => t('Dump settings'),
'#collapsible' => true,
'#collapsed' => (variable_get('demo_reset_interval', 0) ? false : true),
'#collapsible' => TRUE,
'#collapsed' => (variable_get('demo_reset_interval', 0) ? FALSE : TRUE),
);
$period = drupal_map_assoc(array(0, 1800, 3600, 7200, 10800, 14400, 18000, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
$period[0] = t('disabled');
......@@ -132,7 +132,7 @@ function _demo_dump() {
'#title' => t('File name'),
'#type' => 'textfield',
'#autocomplete_path' => 'demo/autocomplete',
'#required' => true,
'#required' => TRUE,
'#maxlength' => 128,
'#description' => t('Enter the snapshot file name without file extension. Allowed characters are a-z, 0-9, dashes ("-"), underscores ("_") and dots.'),
);
......@@ -155,7 +155,7 @@ function demo_dump_submit($form_id, $values) {
// Generate info file.
$info = demo_set_info($values);
if (!$info) {
return false;
return FALSE;
}
// Include database specific functions.
......@@ -306,7 +306,7 @@ function demo_get_fileconfig($filename = 'demo_site') {
// Check if directory exists.
file_check_directory($fileconfig['path'], FILE_CREATE_DIRECTORY, 'path');
if (!file_check_directory($fileconfig['dumppath'], FILE_CREATE_DIRECTORY, 'path')) {
return false;
return FALSE;
}
// Protect dump files.
......@@ -349,7 +349,7 @@ function demo_get_dumps() {
// so we manually insert an internal form value here.
$options['dump']['filename'] = array(
'#type' => 'value',
'#required' => true,
'#required' => TRUE,
'#title' => t('Snapshot'),
);
foreach ($files as $filename => $file) {
......@@ -398,7 +398,7 @@ function demo_get_info($filename, $field = NULL) {
$info['modules'] = explode(" ", $info['modules']);
}
else {
$info['modules'] = null;
$info['modules'] = NULL;
}
if (!isset($info['version'])) {
......@@ -414,12 +414,12 @@ function demo_get_info($filename, $field = NULL) {
}
}
function demo_set_info($values = null) {
function demo_set_info($values = NULL) {
if (isset($values['filename']) && is_array($values)) {
// Check for valid filename
if (!preg_match('/^[-_\.a-zA-Z0-9]+$/', $values['filename'])) {
drupal_set_message(t('Dump filename %title must contain alphanumeric characters, dots, dashes and underscores only. Other characters, including blanks (spaces), are not allowed.', array('%title' => $values['filename'])), 'error');
return false;
return FALSE;
}
if (!empty($values['description'])) {
......@@ -480,6 +480,7 @@ function demo_enum_tables() {
case 'mysqli':
$result = db_query("SHOW TABLES");
break;
case 'pgsql':
$result = db_query("SELECT table_name FROM information_schema.tables WHERE table_schema = '%s'", 'public');
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment