/**
  * Create directory
  *
  * @access public
  * @param
  * 
  */
 public function createDirectory()
 {
     return ilUtil::makeDirParents(ilUpdateUtils::removeTrailingPathSeparators($this->getAbsolutePath()));
 }
Esempio n. 2
0
     }
     if (in_array($copy_id, $operations)) {
         $new_ops[] = $copy_id;
     }
     if (in_array(6, $operations)) {
         $new_ops[] = 6;
     }
     $query = "INSERT INTO rbac_pa SET " . "rol_id = " . $ilDB->quote($pa_row->rol_id) . ", " . "ops_id = " . $ilDB->quote(serialize($new_ops)) . ", " . "ref_id = " . $ilDB->quote($file_ref_id) . " ";
     $ilDB->query($query);
 }
 // INSERT file_data
 $query = "INSERT INTO file_data (file_id,file_name,file_type,file_size,version,f_mode) " . "VALUES (" . $ilDB->quote($file_obj_id) . ", " . $ilDB->quote($row->file_name) . ", " . $ilDB->quote($row->file_type) . ", " . $ilDB->quote($row->file_size) . ", " . $ilDB->quote(1) . ", " . $ilDB->quote('object') . ")";
 $ilDB->query($query);
 // Move File
 $fss = new ilFSStorageFile($file_obj_id);
 ilUpdateUtils::makeDirParents($fss->getAbsolutePath() . '/001');
 $ess = new ilFSStorageEvent($row->event_id);
 if ($fss->rename($ess->getAbsolutePath() . '/' . $row->file_id, $fss->getAbsolutePath() . '/001/' . $row->file_name)) {
     $ilLog->write('Success renaming file: ' . $ess->getAbsolutePath() . '/' . $row->file_id . " to " . $fss->getAbsolutePath() . '/001/' . $row->file_name);
 } else {
     $ilLog->write('Error renaming file: ' . $ess->getAbsolutePath() . '/' . $row->file_id . " to " . $fss->getAbsolutePath() . '/001/' . $row->file_name);
 }
 // Meta data
 $next_id = $ilDB->nextId("il_meta_general");
 $query = "INSERT INTO il_meta_general (meta_general_id,rbac_id,obj_id,obj_type, " . "general_structure,title,title_language,coverage,coverage_language) " . "VALUES( " . $ilDB->quote($next_id, 'integer') . ", " . $ilDB->quote($file_obj_id, 'integer') . ", " . $ilDB->quote($file_obj_id, 'integer') . ", " . $ilDB->quote('file', 'text') . ", " . $ilDB->quote('Hierarchical', 'text') . ", " . $ilDB->quote($row->file_name, 'text') . ", " . $ilDB->quote('en', 'text') . ", " . $ilDB->quote('', 'text') . ", " . $ilDB->quote('en', 'text') . " " . ")";
 $ilDB->query($query);
 // MD technical
 $next_id = $ilDB->nextId('il_meta_technical');
 $query = "INSERT INTO il_meta_technical (meta_technical_id,rbac_id,obj_id,obj_type, " . "t_size,ir,ir_language,opr,opr_language,duration) " . "VALUES( " . $ilDB->quote($next_id, 'integer') . ", " . $ilDB->quote($file_obj_id, 'integer') . ", " . $ilDB->quote($file_obj_id, 'integer') . ", " . $ilDB->quote('file', 'text') . ", " . $ilDB->quote($row->file_size, 'text') . ", " . $ilDB->quote('', 'text') . ", " . $ilDB->quote('en', 'text') . ", " . $ilDB->quote('', 'text') . ", " . $ilDB->quote('en', 'text') . ", " . $ilDB->quote('', 'text') . " " . ")";
 $ilDB->query($query);
 // MD Format
 /**
  * Read path info
  *
  * @access private
  */
 private function init()
 {
     switch ($this->storage_type) {
         case self::STORAGE_DATA:
             $this->path = ilUpdateUtils::getDataDir();
             break;
         case self::STORAGE_WEB:
             $this->path = ilUpdateUtils::getWebspaceDir();
             break;
     }
     $this->path = ilUpdateUtils::removeTrailingPathSeparators($this->path);
     $this->path .= '/';
     // Append path prefix
     $this->path .= $this->getPathPrefix() . '/';
     if ($this->path_conversion) {
         if ($path_id = self::_createPathFromId($this->container_id, $this->getPathPostfix())) {
             $this->path = $this->path . '/' . $path_id;
             $this->path .= '/';
             $this->short_path = $this->path;
         } else {
             $this->short_path = $this->path;
         }
         $this->path .= $this->getPathPostfix() . '_' . $this->container_id;
     } else {
         $this->short_path = $this->path;
         $this->path .= $this->getPathPostfix() . '_' . $this->container_id;
     }
     return true;
 }