summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgkapoor12017-09-08 06:11:58 (GMT)
committergkapoor12017-09-08 06:11:58 (GMT)
commite291f16aaadaaa5a2e0cff03651549b2edf71570 (patch)
treeb2faf3c0273ea06470c67bffeaaf21ae84d1ff60
parentb974243df7deb5840ec1903c9a51973de6b5fa88 (diff)
Fixed Coding Standards
-rw-r--r--CHANGELOG.txt2
-rw-r--r--README.txt1
-rw-r--r--database_mysql_dump.inc31
-rw-r--r--demo.admin.css1
-rw-r--r--demo.admin.inc35
-rw-r--r--demo.install1
-rw-r--r--demo.module1
-rw-r--r--demo_reset.install1
-rw-r--r--demo_reset.module14
9 files changed, 47 insertions, 40 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 5975965..9adcb43 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -117,5 +117,3 @@ Fixed storage of last reset time in status of module settings.
Demo 5.x-1.0, 2007-03-28
------------------------
Initial commit of Demo module.
-
-
diff --git a/README.txt b/README.txt
index 7469ed8..1a0d621 100644
--- a/README.txt
+++ b/README.txt
@@ -56,4 +56,3 @@ This project has been sponsored by:
Specialized in consulting and planning of Drupal powered sites, UNLEASHED
MIND offers installation, development, theming, customization, and hosting
to get you started. Visit http://www.unleashedmind.com for more information.
-
diff --git a/database_mysql_dump.inc b/database_mysql_dump.inc
index fbf0b47..9a23847 100644
--- a/database_mysql_dump.inc
+++ b/database_mysql_dump.inc
@@ -1,6 +1,10 @@
<?php
-// Some older mysql client libs are missing this constant.
+/**
+ * @file
+ * Some older mysql client libs are missing this constant.
+ */
+
if (!defined('MYSQLI_BINARY_FLAG')) {
define('MYSQLI_BINARY_FLAG', 128);
}
@@ -139,7 +143,6 @@ function _demo_dump_table_schema($fp, $table) {
// table definition (after leading ")" on last line) and merge anything
// missing into it, and re-append it again. There are too many differences
// between MySQL 5.0 and 5.1+, and PHP mysql(i) and pdo_mysql extensions.
-
// PDO is missing the table engine.
if (!strpos($output, ' ENGINE=')) {
$output .= ' ENGINE=' . $status['engine'];
@@ -184,10 +187,9 @@ function _demo_dump_table_schema($fp, $table) {
}
// @todo Depends on whether we dump data and table existence on import.
-// if (!empty($status['auto_increment'])) {
-// $output .= ' AUTO_INCREMENT=' . $status['auto_increment'];
-// }
-
+ // if (!empty($status['auto_increment'])) {
+ // $output .= ' AUTO_INCREMENT=' . $status['auto_increment'];
+ // }
$output .= ";\n";
fwrite($fp, $output);
}
@@ -216,7 +218,7 @@ function _demo_dump_table_data($fp, $table) {
// Disable indices to speed up import.
$output .= "/*!40000 ALTER TABLE $table DISABLE KEYS */;\n";
- // Escape backslashes, PHP code, special chars
+ // Escape backslashes, PHP code, special chars.
$search = array('\\', "'", "\x00", "\x0a", "\x0d", "\x1a");
$replace = array('\\\\', "''", '\0', '\n', '\r', '\Z');
@@ -230,13 +232,13 @@ function _demo_dump_table_data($fp, $table) {
$values = array();
$field = 0;
foreach ($row as $value) {
- // NULL
+ // NULL.
if (!isset($value) || is_null($value)) {
$values[] = 'NULL';
}
// A number
- // timestamp is numeric on some MySQL 4.1, BLOBs are sometimes numeric
- else if ($fields[$field]->numeric && !$fields[$field]->timestamp && !$fields[$field]->blob) {
+ // timestamp is numeric on some MySQL 4.1, BLOBs are sometimes numeric.
+ elseif ($fields[$field]->numeric && !$fields[$field]->timestamp && !$fields[$field]->blob) {
$values[] = $value;
}
// A true BLOB
@@ -244,9 +246,9 @@ function _demo_dump_table_data($fp, $table) {
// option is used, for fields having the binary attribute
// no hex is generated
// - a TEXT field returns type blob but a real blob
- // returns also the 'binary' flag
- else if ($fields[$field]->binary && $fields[$field]->blob) {
- // Empty blobs need to be different, but '0' is also empty :-(
+ // returns also the 'binary' flag.
+ elseif ($fields[$field]->binary && $fields[$field]->blob) {
+ // Empty blobs need to be different, but '0' is also empty :-(.
if (empty($value) && $value != '0') {
$values[] = "''";
}
@@ -254,7 +256,7 @@ function _demo_dump_table_data($fp, $table) {
$values[] = '0x' . bin2hex($value);
}
}
- // Something else -> treat as a string
+ // Something else -> treat as a string.
else {
$values[] = "'" . str_replace($search, $replace, $value) . "'";
}
@@ -338,4 +340,3 @@ function _demo_table_is_view($table) {
}
return $tables[$table];
}
-
diff --git a/demo.admin.css b/demo.admin.css
index 357b84d..21becae 100644
--- a/demo.admin.css
+++ b/demo.admin.css
@@ -1,4 +1,3 @@
-
.demo-status label {
float: left;
width: 13em;
diff --git a/demo.admin.inc b/demo.admin.inc
index d48f7ec..14b9f86 100644
--- a/demo.admin.inc
+++ b/demo.admin.inc
@@ -2,7 +2,7 @@
/**
* @file
- * Demonstration Site administrative pages
+ * Demonstration Site administrative pages.
*/
/**
@@ -38,7 +38,7 @@ function demo_admin_settings($form, &$form_state) {
* Form validation handler for demo_admin_settings().
*/
function demo_admin_settings_validate($form, &$form_state) {
- //Passing full URI for validation.
+ // Passing full URI for validation.
$directory = 'private://' . $form_state['values']['demo_dump_path'];
if (!file_prepare_directory($directory, FILE_CREATE_DIRECTORY)) {
form_set_error('demo_dump_path', t('The snapshot directory %directory could not be created.', array('%directory' => $directory)));
@@ -324,7 +324,7 @@ function _demo_reset($filename, $verbose = TRUE) {
$is_version_1_0_dump = version_compare($info['version'], '1.1', '<');
$watchdog = Database::getConnection()->prefixTables('{watchdog}');
foreach (demo_enum_tables() as $table => $dump_options) {
- // Skip watchdog, except for legacy dumps that included the watchdog table
+ // Skip watchdog, except for legacy dumps that included the watchdog table.
if ($table != $watchdog || $is_version_1_0_dump) {
db_query("DROP TABLE $table");
}
@@ -341,7 +341,7 @@ function _demo_reset($filename, $verbose = TRUE) {
$options = array(
'target' => 'default',
'return' => Database::RETURN_NULL,
- // 'throw_exception' => FALSE,
+ // 'throw_exception' => FALSE,.
);
$stmt = Database::getConnection($options['target'])->prepare($query);
if (!$stmt->execute(array(), $options)) {
@@ -392,6 +392,9 @@ function _demo_reset($filename, $verbose = TRUE) {
return $success;
}
+/**
+ *
+ */
function demo_get_fileconfig($filename = 'demo_site') {
$fileconfig = array();
@@ -416,9 +419,9 @@ function demo_get_fileconfig($filename = 'demo_site') {
$fileconfig['site'] = str_replace('sites', '', conf_path());
/*
if (strpos($fileconfig['path'], conf_path()) === FALSE && strpos($fileconfig['path'], '/all/') === FALSE) {
- $fileconfig['dumppath'] .= $fileconfig['site'];
+ $fileconfig['dumppath'] .= $fileconfig['site'];
}
- */
+ */
// Check if directory exists.
if (!file_prepare_directory($fileconfig['dumppath'], FILE_CREATE_DIRECTORY)) {
@@ -451,10 +454,13 @@ function demo_load_include() {
return TRUE;
}
+/**
+ *
+ */
function demo_get_dumps() {
$fileconfig = demo_get_fileconfig();
- // Fetch list of available info files
+ // Fetch list of available info files.
$files = file_scan_directory($fileconfig['dumppath'], '/\.info$/');
foreach ($files as $file => $object) {
@@ -520,6 +526,9 @@ function demo_get_dumps() {
return $element;
}
+/**
+ *
+ */
function demo_get_info($filename, $field = NULL) {
$info = array();
@@ -546,16 +555,19 @@ function demo_get_info($filename, $field = NULL) {
}
}
+/**
+ *
+ */
function demo_set_info($values = NULL) {
if (isset($values['filename']) && is_array($values)) {
- // Check for valid filename
+ // Check for valid filename.
if (!preg_match('/^[-_\.a-zA-Z0-9]+$/', $values['filename'])) {
drupal_set_message(t('Invalid filename. It must only contain alphanumeric characters, dots, dashes and underscores. Other characters, including spaces, are not allowed.'), 'error');
return FALSE;
}
if (!empty($values['description'])) {
- // parse_ini_file() doesn't allow certain characters in description
+ // parse_ini_file() doesn't allow certain characters in description.
$s = array("\r\n", "\r", "\n", '"');
$r = array(' ', ' ', ' ', "'");
$values['description'] = str_replace($s, $r, $values['description']);
@@ -569,14 +581,14 @@ function demo_set_info($values = NULL) {
}
}
- // Set values
+ // Set values.
$infos = array();
$infos['filename'] = $values['filename'];
$infos['description'] = '"' . $values['description'] . '"';
$infos['modules'] = implode(' ', module_list());
$infos['version'] = DEMO_DUMP_VERSION;
- // Write information to .info file
+ // Write information to .info file.
$fileconfig = demo_get_fileconfig($values['filename']);
$infofile = fopen($fileconfig['infofile'], 'w');
foreach ($infos as $key => $info) {
@@ -710,4 +722,3 @@ function demo_download($filename, $type) {
);
file_transfer($fileconfig[$type . 'file'], $headers);
}
-
diff --git a/demo.install b/demo.install
index 80e0790..4af339e 100644
--- a/demo.install
+++ b/demo.install
@@ -38,4 +38,3 @@ function demo_update_6100() {
/**
* @todo Remove file_directory_path() from demo_dump_path variable.
*/
-
diff --git a/demo.module b/demo.module
index 79e46c6..b647612 100644
--- a/demo.module
+++ b/demo.module
@@ -118,4 +118,3 @@ function demo_reset($filename, $verbose = TRUE) {
module_load_include('inc', 'demo', 'demo.admin');
return _demo_reset($filename, $verbose);
}
-
diff --git a/demo_reset.install b/demo_reset.install
index c263e73..96ac966 100644
--- a/demo_reset.install
+++ b/demo_reset.install
@@ -11,4 +11,3 @@
function demo_reset_uninstall() {
variable_del('demo_dump_cron');
}
-
diff --git a/demo_reset.module b/demo_reset.module
index 7f67152..39fbf2a 100644
--- a/demo_reset.module
+++ b/demo_reset.module
@@ -13,15 +13,15 @@
*/
function demo_reset_form_demo_admin_settings_alter(&$form, &$form_state) {
$intervals = array(
- // 0, 5, 10, 15, 30 minutes
+ // 0, 5, 10, 15, 30 minutes.
0, 300, 600, 900, 1800,
- // 1-6, 9, 12 hours
+ // 1-6, 9, 12 hours.
3600, 3600 * 2, 3600 * 3, 3600 * 4, 3600 * 5, 3600 * 6, 3600 * 9, 3600 * 12,
- // 1-3 days
+ // 1-3 days.
86400, 86400 * 2, 86400 * 3,
- // 1, 2, 3 weeks
+ // 1, 2, 3 weeks.
604800, 604800 * 2, 604800 * 3,
- // 1, 3 months
+ // 1, 3 months.
86400 * 30, 86400 * 90,
);
$intervals = drupal_map_assoc($intervals, 'format_interval');
@@ -81,6 +81,9 @@ function demo_reset_set_default($filename) {
drupal_set_message(t('Snapshot %title will be used for cron runs.', array('%title' => $filename)));
}
+/**
+ *
+ */
function demo_reset_form_demo_dump_form_alter(&$form, &$form_state) {
$form['dump']['default'] = array(
'#title' => t('Use as default snapshot for cron runs'),
@@ -179,4 +182,3 @@ function demo_reset_cron() {
}
}
}
-