[svn r16083] Adding the upload/forum/images and upload/learning_path/images path see FS#2841

skala
Julio Montoya 18 years ago
parent a5840e07a6
commit be6032176a
  1. 2
      main/inc/lib/add_course.lib.inc.php
  2. 10
      main/install/index.php
  3. 6
      main/install/update-files-1.8.4-1.8.5.inc.php
  4. 116
      main/install/update-files-1.8.5-1.8.6.inc.php

@ -232,8 +232,10 @@ function prepare_course_repository($courseRepository, $courseId)
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/temp", $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/upload", $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/upload/forum", $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/upload/forum/images", $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/upload/test", $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/upload/blog", $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/upload/learning_path/images", $perm);
mkdir(api_get_path(SYS_COURSE_PATH).$courseRepository . "/work", $perm);
//create .htaccess in dropbox

@ -100,7 +100,7 @@ error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR);
//upgrading from any subversion of 1.6 is just like upgrading from 1.6.5
$update_from_version_6=array('1.6','1.6.1','1.6.2','1.6.3','1.6.4','1.6.5');
//upgrading from any subversion of 1.8 avoids the additional step of upgrading from 1.6
$update_from_version_8=array('1.8','1.8.2','1.8.3','1.8.4');
$update_from_version_8=array('1.8','1.8.2','1.8.3','1.8.4','1.8.5');
$my_old_version = '';
$tmp_version = get_config_param('dokeos_version');
if(!empty($_POST['old_version']))
@ -641,9 +641,13 @@ elseif($_POST['step6'])
include('update-db-1.8.3-1.8.4.inc.php');
include('update-files-1.8.3-1.8.4.inc.php');
case '1.8.4':
default:
include('update-db-1.8.4-1.8.5.inc.php');
include('update-db-1.8.4-1.8.5.inc.php');
include('update-files-1.8.4-1.8.5.inc.php');
case '1.8.5':
//include('update-db-1.8.5-1.8.6.inc.php');
include('update-files-1.8.5-1.8.6.inc.php');
default:
break;
}
}

@ -1,12 +1,12 @@
<?php //$Id: update-files-1.8.4-1.8.5.inc.php 14543 2008-03-09 17:32:54Z yannoo $
<?php //$Id: update-files-1.8.4-1.8.5.inc.php 16083 2008-08-27 20:33:01Z juliomontoya $
/* See license terms in /dokeos_license.txt */
/**
==============================================================================
* Updates the Dokeos files from version 1.8.3 to version 1.8.4
* Updates the Dokeos files from version 1.8.4 to version 1.8.5
* This script operates only in the case of an update, and only to change the
* active version number (and other things that might need a change) in the
* current configuration file.
* As of 1.8.4, the Dokeos version has been added to configuration.php to
* As of 1.8.5, the Dokeos version has been added to configuration.php to
* allow for edition (inc/conf is one of the directories that needs write
* permissions on upgrade).
* Being in configuration.php, it benefits from the configuration.dist.php

@ -0,0 +1,116 @@
<?php
/* See license terms in /dokeos_license.txt */
/**
==============================================================================
* Updates the Dokeos files from version 1.8.5 to version 1.8.6
* This script operates only in the case of an update, and only to change the
* active version number (and other things that might need a change) in the
* current configuration file.
* As of 1.8.6, the Dokeos version has been added to configuration.php to
* allow for edition (inc/conf is one of the directories that needs write
* permissions on upgrade).
* Being in configuration.php, it benefits from the configuration.dist.php
* advantages that a new version doesn't overwrite it, thus letting the old
* version be available until the end of the installation.
* @package dokeos.install
==============================================================================
*/
require_once("../inc/lib/main_api.lib.php");
require_once("../inc/lib/fileUpload.lib.php");
require_once('../inc/lib/database.lib.php');
if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE'))
{
// Edit the Dokeos config file
$file = file('../inc/conf/configuration.php');
$fh = fopen('../inc/conf/configuration.php','w');
$found_version = false;
$found_stable = false;
foreach($file as $line)
{
$ignore = false;
if(stristr($line,'$_configuration[\'dokeos_version\']'))
{
$found_version = true;
$line = '$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n";
}
elseif(stristr($line,'$_configuration[\'dokeos_stable\']'))
{
$found_stable = true;
$line = '$_configuration[\'dokeos_stable\'] = '.($new_version_stable?'true':'false').';'."\r\n";
}
elseif(stristr($line,'?>'))
{
//ignore the line
$ignore = true;
}
if(!$ignore)
{
fwrite($fh,$line);
}
}
if(!$found_version)
{
fwrite($fh,'$_configuration[\'dokeos_version\'] = \''.$new_version.'\';'."\r\n");
}
if(!$found_stable)
{
fwrite($fh,'$_configuration[\'dokeos_stable\'] = '.($new_version_stable?'true':'false').';'."\r\n");
}
fwrite($fh,'?>');
fclose($fh);
$sys_course_path = $pathForm.'courses/';
//$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
//linking
$link = mysql_connect($dbHostForm, $dbUsernameForm, $dbPassForm);
mysql_select_db($dbNameForm,$link);
$db_name = $dbNameForm;
$sql = "SELECT * FROM $db_name.course";
error_log('Getting courses for files updates: '.$sql,0);
$result=mysql_query($sql);
$perm = api_get_setting('permissions_for_new_directories');
$perm = octdec(!empty($perm)?$perm:'0770');
$old_umask = umask(0);
while($courses_directories=mysql_fetch_array($result))
{
$currentCourseRepositorySys = $sys_course_path.$courses_directories['directory'].'/';
$db_name = $courses_directories['db_name'];
$origCRS = $updatePath.'courses/'.$courses_directories['directory'];
if(!is_dir($origCRS)){
error_log('Directory '.$origCRS.' does not exist. Skipping.',0);
continue;
}
//move everything to the new hierarchy (from old path to new path)
error_log('Renaming '.$origCRS.' to '.$sys_course_path.$courses_directories['directory'],0);
rename($origCRS,$sys_course_path.$courses_directories['directory']);
error_log('Creating dirs in '.$currentCourseRepositorySys,0);
//FOLDER UPLOAD
//upload > forum > images
if(!is_dir($currentCourseRepositorySys."upload/forum/images")){
mkdir($currentCourseRepositorySys."upload/forum/images",$perm);
}
//upload > learning_path
if(!is_dir($currentCourseRepositorySys."upload/learning_path")){
mkdir($currentCourseRepositorySys."upload/learning_path",$perm);
}
//upload > learning_path > images
if(!is_dir($currentCourseRepositorySys."upload/learning_path/images")){
mkdir($currentCourseRepositorySys."upload/learning_path/images",$perm);
}
}
}
else
{
echo 'You are not allowed here !';
}
?>
Loading…
Cancel
Save