2011-03-10 Miguel de Dios <miguel.dedios@artica.es>

* include/db/postgresql.php, include/db/mysql.php, include/functions_db.php:
	added function "get_db_type_field_table" and subfunctions for the engines.

	* extensions/pandora_logs.php,
	extenions/update_manager/lib/libupdate_manager_utils.php: fixed source code
	style.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4083 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-03-10 12:49:55 +00:00
parent 12cc101b7a
commit 5ea5e7d489
6 changed files with 66 additions and 3 deletions

View File

@ -1,3 +1,12 @@
2011-03-10 Miguel de Dios <miguel.dedios@artica.es>
* include/db/postgresql.php, include/db/mysql.php, include/functions_db.php:
added function "get_db_type_field_table" and subfunctions for the engines.
* extensions/pandora_logs.php,
extenions/update_manager/lib/libupdate_manager_utils.php: fixed source code
style.
2011-03-10 Sergio Martin <sergio.martin@artica.es>
* extensions/update_manager/sql/update_manager.sql

View File

@ -18,11 +18,13 @@ function view_logfile ($file_name) {
if (!file_exists($file_name)){
echo "<h2 class='error'>".__("Cannot find file"). "(".$file_name;
echo ")</h2>";
} else {
}
else {
if (filesize ($file_name) > 512000) {
echo "<h2 class='error'>".__("File is too large (> 500KB)"). "(".$file_name;
echo ")</h2>";
} else {
}
else {
$data = file_get_contents ($file_name);
echo "<h2>$file_name (".format_numeric(filesize ($file_name)/1024)." KB) </h2>";
echo "<textarea style='width: 95%; height: 200px;' name='$file_name'>";

View File

@ -21,8 +21,10 @@ function add_prefix (&$string, $key, $prefix) {
function is_binary ($filepath) {
$output = array ();
exec ('file -b -i '.$filepath.' | cut -f1 -d"/"', $output);
if (isset ($output[0]))
return $output[0] != 'text';
return false;
}
@ -50,7 +52,8 @@ function directory_to_array ($directory, $ignores = NULL, $only_binary_files = f
}
if (is_dir ($filepath)) {
array_push ($dirs, $filepath);
} else {
}
else {
if ($only_binary_files && ! is_binary ($filepath)) {
$file = readdir ($handle);
continue;

View File

@ -984,4 +984,18 @@ function mysql_get_system_time() {
return time ();
}
}
/**
* Get the type of field.
*
* @param string $table The table to examine the type of field.
* @param integer $field The field order in table.
*
* @return mixed Return the type name or False in error case.
*/
function mysql_get_db_type_field_table($table, $field) {
$result = mysql_query('SELECT parameters FROM ' . $table);
return mysql_field_type($result, $field);
}
?>

View File

@ -1001,4 +1001,18 @@ function postgresql_get_system_time() {
return time ();
}
}
/**
* Get the type of field.
*
* @param string $table The table to examine the type of field.
* @param integer $field The field order in table.
*
* @return mixed Return the type name or False in error case.
*/
function postgresql_get_db_type_field_table($table, $field) {
$result = pg_query('SELECT parameters FROM ' . $table);
return pg_field_type($result, $field);
}
?>

View File

@ -3659,4 +3659,25 @@ function get_db_last_error() {
break;
}
}
/**
* Get the type of field.
*
* @param string $table The table to examine the type of field.
* @param integer $field The field order in table.
*
* @return mixed Return the type name or False in error case.
*/
function get_db_type_field_table($table, $field) {
global $config;
switch ($config["dbtype"]) {
case "mysql":
return mysql_get_db_type_field_table($table, $field);
break;
case "postgresql":
return postgresql_get_db_type_field_table($table, $field);
break;
}
}
?>