ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilFileSystemStorageMailMigration Class Reference
+ Inheritance diagram for ilFileSystemStorageMailMigration:
+ Collaboration diagram for ilFileSystemStorageMailMigration:

Public Member Functions

 __construct ($a_storage_type, $a_path_conversion, $a_container_id)
 Constructor.
 getContainerId ()
 create ()
 Create directory.
 getAbsolutePath ()
 Get absolute path of storage directory.
 writeToFile ($a_data, $a_absolute_path)
 Write data to file.
 deleteFile ($a_abs_name)
 Delete file.
 deleteDirectory ($a_abs_name)
 Delete directory.
 delete ()
 Delete complete directory.
 copyFile ($a_from, $a_to)
 Copy files.
 appendToPath ($a_appendix)
 getStorageType ()

Static Public Member Functions

static _createPathFromId ($a_container_id, $a_name)
 Create a path from an id: e.g 12345 will be converted to 12/34/<name>_5.
 _copyDirectory ($a_source, $a_target)
 Copy directory and all contents.

Data Fields

const STORAGE_WEB = 1
const STORAGE_DATA = 2
const FACTOR = 100
const MAX_EXPONENT = 3

Protected Member Functions

 getPathPrefix ()
 Get path prefix.
 getPathPostfix ()
 Get directory name.

Private Member Functions

 init ()
 Read path info.

Private Attributes

 $container_id
 $storage_type
 $path_conversion = false
 $path

Detailed Description

Definition at line 33 of file class.ilFileSystemStorageMailMigration.php.

Constructor & Destructor Documentation

ilFileSystemStorageMailMigration::__construct (   $a_storage_type,
  $a_path_conversion,
  $a_container_id 
)

Constructor.

public

Parameters
intstorage type
boolEn/Disable automatic path conversion. If enabled files with id 123 will be stored in directory files/1/file_123
intobject id of container (e.g file_id or mob_id)

Definition at line 57 of file class.ilFileSystemStorageMailMigration.php.

References init().

{
$this->storage_type = $a_storage_type;
$this->path_conversion = $a_path_conversion;
$this->container_id = $a_container_id;
// Get path info
$this->init();
}

+ Here is the call graph for this function:

Member Function Documentation

ilFileSystemStorageMailMigration::_copyDirectory (   $a_source,
  $a_target 
)
static

Copy directory and all contents.

public

Parameters
stringabsolute source path
stringabsolute target path

Definition at line 285 of file class.ilFileSystemStorageMailMigration.php.

{
return ilUpdateUtilsMailMigration::rCopy($a_source,$a_target);
}
static ilFileSystemStorageMailMigration::_createPathFromId (   $a_container_id,
  $a_name 
)
static

Create a path from an id: e.g 12345 will be converted to 12/34/<name>_5.

public

Parameters
intcontainer id
stringname

Definition at line 81 of file class.ilFileSystemStorageMailMigration.php.

References $path.

Referenced by init().

{
$path = array();
$found = false;
$num = $a_container_id;
for($i = self::MAX_EXPONENT; $i > 0;$i--)
{
$factor = pow(self::FACTOR,$i);
if(($tmp = (int) ($num / $factor)) or $found)
{
$path[] = $tmp;
$num = $num % $factor;
$found = true;
}
}
if(count($path))
{
$path_string = (implode('/',$path).'/');
}
return $path_string.$a_name.'_'.$a_container_id;
}

+ Here is the caller graph for this function:

ilFileSystemStorageMailMigration::appendToPath (   $a_appendix)

Definition at line 290 of file class.ilFileSystemStorageMailMigration.php.

Referenced by ilFSStorageMailMailMigration\__construct().

{
$this->path .= $a_appendix;
}

+ Here is the caller graph for this function:

ilFileSystemStorageMailMigration::copyFile (   $a_from,
  $a_to 
)

Copy files.

public

Parameters
stringabsolute source
stringabsolute target

Definition at line 266 of file class.ilFileSystemStorageMailMigration.php.

{
if(@file_exists($a_from))
{
@copy($a_from,$a_to);
return true;
}
return false;
}
ilFileSystemStorageMailMigration::create ( )

Create directory.

public

Definition at line 133 of file class.ilFileSystemStorageMailMigration.php.

References ilUpdateUtilsMailMigration\makeDirParents().

{
if(!file_exists($this->path))
{
}
return true;
}

+ Here is the call graph for this function:

ilFileSystemStorageMailMigration::delete ( )

Delete complete directory.

public

Parameters

Definition at line 252 of file class.ilFileSystemStorageMailMigration.php.

References ilUpdateUtilsMailMigration\delDir(), and getAbsolutePath().

+ Here is the call graph for this function:

ilFileSystemStorageMailMigration::deleteDirectory (   $a_abs_name)

Delete directory.

public

Parameters
stringabsolute name

Definition at line 234 of file class.ilFileSystemStorageMailMigration.php.

References ilUpdateUtilsMailMigration\delDir().

{
if(@file_exists($a_abs_name))
{
return true;
}
return false;
}

+ Here is the call graph for this function:

ilFileSystemStorageMailMigration::deleteFile (   $a_abs_name)

Delete file.

public

Parameters
stringabsolute name

Definition at line 217 of file class.ilFileSystemStorageMailMigration.php.

{
if(@file_exists($a_abs_name))
{
@unlink($a_abs_name);
return true;
}
return false;
}
ilFileSystemStorageMailMigration::getAbsolutePath ( )

Get absolute path of storage directory.

public

Definition at line 149 of file class.ilFileSystemStorageMailMigration.php.

References $path.

Referenced by delete(), and ilFSStorageMailMailMigration\getRelativePathExMailDirectory().

{
return $this->path;
}

+ Here is the caller graph for this function:

ilFileSystemStorageMailMigration::getContainerId ( )

Definition at line 67 of file class.ilFileSystemStorageMailMigration.php.

References $container_id.

{
}
ilFileSystemStorageMailMigration::getPathPostfix ( )
abstractprotected

Get directory name.

E.g for files => file Only relative path, no trailing slash '_<obj_id>' will be appended automatically

protected

Returns
string directory name

Reimplemented in ilFSStorageMailMailMigration.

Referenced by init().

+ Here is the caller graph for this function:

ilFileSystemStorageMailMigration::getPathPrefix ( )
abstractprotected

Get path prefix.

Prefix that will be prepended to the path No trailing slash. E.g ilFiles for files

protected

Returns
string path prefix e.g files

Reimplemented in ilFSStorageMailMailMigration.

Referenced by init().

+ Here is the caller graph for this function:

ilFileSystemStorageMailMigration::getStorageType ( )

Definition at line 295 of file class.ilFileSystemStorageMailMigration.php.

References $storage_type.

Referenced by ilFSStorageMailMailMigration\getRelativePathExMailDirectory().

{
}

+ Here is the caller graph for this function:

ilFileSystemStorageMailMigration::init ( )
private

Read path info.

private

Definition at line 159 of file class.ilFileSystemStorageMailMigration.php.

References $container_id, _createPathFromId(), ilUpdateUtilsMailMigration\getDataDir(), getPathPostfix(), getPathPrefix(), ilUpdateUtilsMailMigration\getWebspaceDir(), and ilUpdateUtilsMailMigration\removeTrailingPathSeparators().

Referenced by __construct().

{
switch($this->storage_type)
{
case self::STORAGE_DATA:
break;
case self::STORAGE_WEB:
break;
}
$this->path .= '/';
// Append path prefix
$this->path .= ($this->getPathPrefix().'/');
if($this->path_conversion)
{
$this->path .= self::_createPathFromId($this->container_id,$this->getPathPostfix());
}
else
{
$this->path .= ($this->getPathPostfix().'_'.$this->container_id);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFileSystemStorageMailMigration::writeToFile (   $a_data,
  $a_absolute_path 
)

Write data to file.

public

Parameters

Definition at line 195 of file class.ilFileSystemStorageMailMigration.php.

{
if(!$fp = @fopen($a_absolute_path,'w+'))
{
return false;
}
if(@fwrite($fp,$a_data) === false)
{
@fclose($fp);
return false;
}
@fclose($fp);
return true;
}

Field Documentation

ilFileSystemStorageMailMigration::$container_id
private

Definition at line 42 of file class.ilFileSystemStorageMailMigration.php.

Referenced by getContainerId(), and init().

ilFileSystemStorageMailMigration::$path
private
ilFileSystemStorageMailMigration::$path_conversion = false
private

Definition at line 44 of file class.ilFileSystemStorageMailMigration.php.

ilFileSystemStorageMailMigration::$storage_type
private

Definition at line 43 of file class.ilFileSystemStorageMailMigration.php.

Referenced by getStorageType().

const ilFileSystemStorageMailMigration::FACTOR = 100

Definition at line 38 of file class.ilFileSystemStorageMailMigration.php.

const ilFileSystemStorageMailMigration::MAX_EXPONENT = 3

Definition at line 39 of file class.ilFileSystemStorageMailMigration.php.

const ilFileSystemStorageMailMigration::STORAGE_DATA = 2

Definition at line 36 of file class.ilFileSystemStorageMailMigration.php.

const ilFileSystemStorageMailMigration::STORAGE_WEB = 1

Definition at line 35 of file class.ilFileSystemStorageMailMigration.php.


The documentation for this class was generated from the following file: