Commit e5e5724c authored by sun's avatar sun

by sun: Fixed coding-style.

parent bcc6c92a
......@@ -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.
......
......@@ -17,11 +17,11 @@ function demo_dump_db($filename, $exclude = array()) {
}
if ($fp = fopen($filename, 'wb')) {
$header = "-- Demo.module database dump (version ". DEMO_DUMP_VERSION .")\n";
$header = "-- Demo.module database dump (version " . DEMO_DUMP_VERSION . ")\n";
$header .= "-- http://drupal.org/project/demo\n";
$header .= "--\n";
$header .= "-- Database: ". _demo_get_database() ."\n";
$header .= "-- Date: ". format_date(time(), 'large') ."\n";
$header .= "-- Database: " . _demo_get_database() . "\n";
$header .= "-- Date: " . format_date(time(), 'large') . "\n";
// Temporarily disable foreign key checks for the time of import.
$header .= "SET FOREIGN_KEY_CHECKS = 0;\n";
fwrite($fp, $header);
......@@ -59,13 +59,13 @@ function _demo_get_database() {
* Dump table structure.
*/
function _demo_dump_table_structure($table) {
$output = "\n";
$output = "\n";
$output .= "--\n";
$output .= "-- Table structure for table '$table'\n";
$output .= "--\n\n";
$data = db_fetch_array(db_query("SHOW CREATE TABLE %s", $table));
$output .= preg_replace('/^CREATE TABLE/', 'CREATE TABLE IF NOT EXISTS', $data['Create Table']) .";\n";
$output .= preg_replace('/^CREATE TABLE/', 'CREATE TABLE IF NOT EXISTS', $data['Create Table']) . ";\n";
return $output;
}
......@@ -76,11 +76,11 @@ function _demo_dump_table_structure($table) {
* This code has largely been stolen from the phpMyAdmin project.
*/
function _demo_dump_table_data($table) {
$output = "\n";
$output = "\n";
$output .= "--\n";
$output .= "-- Dumping data for table '$table'\n";
$output .= "--\n\n";
// Dump table data
$result = db_query("SELECT * FROM %s", $table);
......@@ -121,23 +121,24 @@ function _demo_dump_table_data($table) {
else if ($fields[$field]->binary && $fields[$field]->blob) {
// Empty blobs need to be different, but '0' is also empty :-(
if (empty($value) && $value != '0') {
$values[] = "''";
} else {
$values[] = '0x' . bin2hex($value);
$values[] = "''";
}
else {
$values[] = '0x' . bin2hex($value);
}
}
// Something else -> treat as a string
else {
$values[] = "'". str_replace($search, $replace, $value) ."'";
$values[] = "'" . str_replace($search, $replace, $value) . "'";
}
$field++;
}
if ($current_row == 1) {
$insert_buffer = $insert_cmd . '('. implode(', ', $values) . ')';
$insert_buffer = $insert_cmd . '(' . implode(', ', $values) . ')';
}
else {
$insert_buffer = '('. implode(', ', $values) . ')';
$insert_buffer = '(' . implode(', ', $values) . ')';
if ($query_size + strlen($insert_buffer) > 50000) {
$output .= ";\n";
$current_row = 1;
......
This diff is collapsed.
......@@ -88,7 +88,7 @@ function demo_block($op = 'list', $delta = 0, $edit = array()) {
case 'list':
$blocks[0] = array('info' => t('Demo site reset'), 'enabled' => 1, 'region' => 'right');
return $blocks;
case 'view':
$block = array(
'subject' => t('Reset demo'),
......@@ -118,7 +118,7 @@ function demo_reset_now() {
}
function demo_reset_now_submit($form_id, $values) {
require_once drupal_get_path('module', 'demo') .'/demo.admin.inc';
require_once drupal_get_path('module', 'demo') . '/demo.admin.inc';
return demo_reset_confirm_submit($form_id, $values);
}
......@@ -130,7 +130,7 @@ function demo_cron() {
// See if it's time for a reset.
$time = $_SERVER['REQUEST_TIME'];
if (($time - $interval) >= variable_get('demo_reset_last', 0)) {
require_once drupal_get_path('module', 'demo') .'/demo.admin.inc';
require_once drupal_get_path('module', 'demo') . '/demo.admin.inc';
demo_reset(variable_get('demo_dump_cron', 'demo_site'), FALSE);
variable_set('demo_reset_last', $time);
}
......@@ -138,32 +138,32 @@ function demo_cron() {
}
function demo_admin_settings() {
require_once drupal_get_path('module', 'demo') .'/demo.admin.inc';
require_once drupal_get_path('module', 'demo') . '/demo.admin.inc';
return _demo_admin_settings();
}
function demo_manage() {
require_once drupal_get_path('module', 'demo') .'/demo.admin.inc';
require_once drupal_get_path('module', 'demo') . '/demo.admin.inc';
return _demo_manage();
}
function demo_dump() {
require_once drupal_get_path('module', 'demo') .'/demo.admin.inc';
require_once drupal_get_path('module', 'demo') . '/demo.admin.inc';
return _demo_dump();
}
function demo_reset_confirm() {
require_once drupal_get_path('module', 'demo') .'/demo.admin.inc';
require_once drupal_get_path('module', 'demo') . '/demo.admin.inc';
return _demo_reset_confirm();
}
function demo_delete_confirm($filename) {
require_once drupal_get_path('module', 'demo') .'/demo.admin.inc';
require_once drupal_get_path('module', 'demo') . '/demo.admin.inc';
return _demo_delete_confirm($filename);
}
function demo_autocomplete($string = '') {
require_once drupal_get_path('module', 'demo') .'/demo.admin.inc';
require_once drupal_get_path('module', 'demo') . '/demo.admin.inc';
return _demo_autocomplete($string);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment