Add condition if value is empty

1.10.x
jmontoya 10 years ago
parent cd5a4a4420
commit e7fa1a208a
  1. 10
      main/coursecopy/classes/CourseRestorer.class.php

@ -334,8 +334,10 @@ class CourseRestorer
continue; continue;
} }
//$title = basename($sysFolderPath);
$title = $document->title; $title = $document->title;
if (empty($title)) {
$title = basename($sysFolderPath);
}
// File doesn't exist in file system. // File doesn't exist in file system.
if (!is_dir($sysFolderPath)) { if (!is_dir($sysFolderPath)) {
@ -392,8 +394,10 @@ class CourseRestorer
//continue; //continue;
$visibility = $document->item_properties[0]['visibility']; $visibility = $document->item_properties[0]['visibility'];
$new = '/'.substr(dirname($document->path), 9); $new = '/'.substr(dirname($document->path), 9);
//$title = str_replace('/', '', $new);
$title = $document->title; $title = $document->title;
if (empty($title)) {
$title = str_replace('/', '', $new);
}
// This code fixes the possibility for a file without a directory entry to be // This code fixes the possibility for a file without a directory entry to be
$document_id = add_document( $document_id = add_document(
@ -425,7 +429,7 @@ class CourseRestorer
if (file_exists($path.$document->path)) { if (file_exists($path.$document->path)) {
switch ($this->file_option) { switch ($this->file_option) {
case FILE_OVERWRITE : case FILE_OVERWRITE:
$origin_path = $this->course->backup_path.'/'.$document->path; $origin_path = $this->course->backup_path.'/'.$document->path;
if (file_exists($origin_path)) { if (file_exists($origin_path)) {

Loading…
Cancel
Save