public function getRelativePathExMailDirectory()
 {
     switch ($this->getStorageType()) {
         case self::STORAGE_DATA:
             $path = ilUpdateUtilsMailMigration::getDataDir();
             break;
         case self::STORAGE_WEB:
             $path = ilUpdateUtilsMailMigration::getWebspaceDir();
             break;
     }
     $path = ilUpdateUtilsMailMigration::removeTrailingPathSeparators($path);
     $path .= '/';
     // Append path prefix
     $path .= $this->getPathPrefix() . '/';
     return str_replace($path, '', $this->getAbsolutePath());
 }
Example #2
0
        }
        $tmp_path = ilUpdateUtilsMailMigration::ilTempnam();
        ilUpdateUtilsMailMigration::makeDir($tmp_path);
        ilUpdateUtilsMailMigration::rename($path, $tmp_path);
        $oFSStorageMail->create();
        $new_path = $oFSStorageMail->getAbsolutePath();
        if (!@file_exists($new_path) || !@is_dir($new_path)) {
            $ilLog->write('DB Migration ' . $update_step . ': Failed: Target folder "' . $new_path . '" does not exist for mail ' . $record->mail_id);
            continue;
        } else {
            if (!@is_writeable($new_path)) {
                $ilLog->write('DB Migration ' . $update_step . ': Failed: Target folder "' . $new_path . '" is not writeable for mail ' . $record->mail_id);
                continue;
            }
        }
        ilUpdateUtilsMailMigration::rename($tmp_path, $new_path);
    }
    // Modifie existing attachment assigment
    $ilDB->manipulateF("UPDATE mail_attachment SET path = %s WHERE mail_id = %s", array('text', 'integer'), array($oFSStorageMail->getRelativePathExMailDirectory(), $record->mail_id));
    // Save success
    $ilDB->manipulateF("INSERT INTO tmp_mail_migration (mail_id, mail_passed, mail_path) VALUES (%s, %s, %s)", array('integer', 'integer', 'text'), array($record->mail_id, 1, $record->path));
}
?>
<#2500>
<?php 
if ($ilDB->tableExists('tmp_mail_migration')) {
    $ilDB->dropTable('tmp_mail_migration');
}
?>

<#2501>
 /**
  * Copy directory and all contents
  *
  * @access public
  * @static
  * @param string absolute source path
  * @param string absolute target path
  * 
  */
 public function _copyDirectory($a_source, $a_target)
 {
     return ilUpdateUtilsMailMigration::rCopy($a_source, $a_target);
 }