[svn r15578] Fix problem with insertion of new documents using a function of 1.8.5 while migrating from 1.6.x to 1.8.0

skala
Yannick Warnier 17 years ago
parent d15c9d9592
commit f7f4f4dabb
  1. 29
      main/install/install_upgrade.lib.php
  2. 5
      main/install/update-files-1.6.x-1.8.0.inc.php

@ -514,6 +514,33 @@ function directory_to_array($directory)
}
return $array_items;
}
/**
* Adds a new document to the database - specific to version 1.8.0
*
* @param array $_course
* @param string $path
* @param string $filetype
* @param int $filesize
* @param string $title
* @return id if inserted document
*/
function add_document_180($_course,$path,$filetype,$filesize,$title,$comment=NULL)
{
$table_document = Database::get_course_table(TABLE_DOCUMENT,$_course['dbName']);
$sql="INSERT INTO $table_document
(`path`,`filetype`,`size`,`title`, `comment`)
VALUES ('$path','$filetype','$filesize','".
Database::escape_string($title)."', '$comment')";
if(api_sql_query($sql,__FILE__,__LINE__))
{
//display_message("Added to database (id ".mysql_insert_id().")!");
return mysql_insert_id();
}
else
{
//display_error("The uploaded file could not be added to the database (".mysql_error().")!");
return false;
}
}
?>

@ -1,4 +1,4 @@
<?php //$Id: update-files-1.6.x-1.8.0.inc.php 13195 2007-09-23 20:29:09Z yannoo $
<?php //$Id: update-files-1.6.x-1.8.0.inc.php 15578 2008-06-12 22:30:58Z yannoo $
/*
==============================================================================
Dokeos - elearning and course management software
@ -44,6 +44,7 @@
require_once("../inc/lib/main_api.lib.php");
require_once("../inc/lib/fileUpload.lib.php");
require_once('../inc/lib/database.lib.php');
require_once('install_upgrade.lib.php');
/*
==============================================================================
@ -54,7 +55,7 @@ function insert_db($db_name, $folder_name, $text){
$_course['dbName'] = $db_name;
$doc_id = add_document($_course, '/'.$folder_name, 'folder', 0, ucfirst($text));
$doc_id = add_document_180($_course, '/'.$folder_name, 'folder', 0, ucfirst($text));
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', 1);
}

Loading…
Cancel
Save