Moodle  2.2.1
http://www.collinsharper.com
moodle1_file_manager Class Reference
Inheritance diagram for moodle1_file_manager:
Collaboration diagram for moodle1_file_manager:

Public Member Functions

 __construct (moodle1_converter $converter, $contextid=null, $component=null, $filearea=null, $itemid=0, $userid=null)
 migrate_file ($sourcepath, $filepath= '/', $filename=null, $sortorder=0, $timecreated=null, $timemodified=null)
 migrate_directory ($rootpath, $relpath='/')
 get_fileids ()
 reset_fileids ()
 log ($message, $level, $a=null, $depth=null, $display=false)

Data Fields

 $converter
 $contextid
 $component
 $filearea
 $itemid = 0
 $userid

Protected Member Functions

 make_file_record (array $fileinfo)
 internal implementation details ////////////////////////////////////////
 add_file_to_pool ($pathname)
 stash_file (array $filerecord)

Protected Attributes

 $basepath
 $textlib
 $fileids = array()

Detailed Description

The class responsible for files migration

The files in Moodle 1.9 backup are stored in moddata, user_files, group_files, course_files and site_files folders.

Definition at line 1141 of file lib.php.


Constructor & Destructor Documentation

__construct ( moodle1_converter converter,
contextid = null,
component = null,
filearea = null,
itemid = 0,
userid = null 
)

Constructor optionally accepting some default values for the migrated files

Parameters:
moodle1_converter$converterthe converter instance we serve to
int$contextidinitial context id of the files being migrated
string$componentinitial component name of the files being migrated
string$fileareainitial file area of the files being migrated
int$itemidinitial item id of the files being migrated
int$useridinitial user id of the files being migrated

Definition at line 1180 of file lib.php.

Here is the call graph for this function:


Member Function Documentation

add_file_to_pool ( pathname) [protected]

Copies the given file to the pool directory

Returns an array containing SHA1 hash of the file contents, the file size and a flag indicating whether the file was actually added to the pool or whether it was already there.

Parameters:
string$pathnamethe full path to the file
Returns:
array with keys (string)contenthash, (int)filesize, (bool)newfile

Definition at line 1386 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the list of all file ids migrated by this instance so far

Returns:
array of int

Definition at line 1314 of file lib.php.

log ( message,
level,
a = null,
depth = null,
display = false 
)

This function will be responsible for handling the params, and to call to the corresponding logger->process() once all modifications in params have been performed

Implements loggable.

Definition at line 1334 of file lib.php.

Here is the caller graph for this function:

make_file_record ( array fileinfo) [protected]

internal implementation details ////////////////////////////////////////

Prepares a fake record from the files table

Parameters:
array$fileinfoexplicit file data
Returns:
array

Definition at line 1346 of file lib.php.

Here is the caller graph for this function:

migrate_directory ( rootpath,
relpath = '/' 
)

Definition at line 1265 of file lib.php.

Here is the call graph for this function:

migrate_file ( sourcepath,
filepath = '/',
filename = null,
sortorder = 0,
timecreated = null,
timemodified = null 
)

Definition at line 1204 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Explicitly clear the list of file ids migrated by this instance so far

Definition at line 1321 of file lib.php.

stash_file ( array filerecord) [protected]

Stashes the file record into 'files' stash and adds the record id to list of migrated files

Parameters:
array$filerecord

Definition at line 1426 of file lib.php.

Here is the caller graph for this function:


Field Documentation

$basepath [protected]

Definition at line 1162 of file lib.php.

Definition at line 1150 of file lib.php.

Definition at line 1147 of file lib.php.

$converter

Definition at line 1144 of file lib.php.

$filearea

Definition at line 1153 of file lib.php.

$fileids = array() [protected]

Definition at line 1168 of file lib.php.

$itemid = 0

Definition at line 1156 of file lib.php.

$textlib [protected]

Definition at line 1165 of file lib.php.

Definition at line 1159 of file lib.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations