[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/lib/ -> componentlib.class.php (summary)

(no description)

File Size: 524 lines (21 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

component_installer:: (10 methods):
  component_installer()
  check_requisites()
  install()
  need_upgrade()
  change_zip_file()
  get_local_md5()
  get_component_md5()
  get_all_components_md5()
  get_error()
  get_extra_md5_field()


Class: component_installer  - X-Ref

This class is used to check, download and install items from
download.moodle.org to the moodledata directory. It always
return true/false in all their public methods to say if
execution has ended succesfuly or not. If there is any problem
its getError() method can be called, returning one error string
to be used with the standard get/print_string() functions.

component_installer($sourcebase, $zippath, $zipfilename, $md5filename='', $destpath='')   X-Ref
Standard constructor of the class. It will initialize all attributes.
without performing any check at all.

param: string Full http URL, base for downloadeable items
param: string Relative path (from sourcebase) where the
param: string Name of the .zip file to be downloaded
param: string Name of the .md5 file to be read (default '' = same
param: string Relative path (from moodledata) where the .zip file will
return: object

check_requisites()   X-Ref
This function will check if everything is properly set to begin
one installation. Also, it will check for required settings
and will fill everything as needed.

return: boolean true/false (plus detailed error in errorstring)

install()   X-Ref
This function will perform the full installation if needed, i.e.
compare md5 values, download, unzip, install and regenerate
local md5 file

return: int COMPONENT_(ERROR | UPTODATE | INSTALLED)

need_upgrade()   X-Ref
This function will detect if remote component needs to be installed
because it's different from the local one

return: int COMPONENT_(ERROR | UPTODATE | NEEDUPDATE)

change_zip_file($newzipfilename)   X-Ref
This function will change the zip file to install on the fly
to allow the class to process different components of the
same md5 file without intantiating more objects.

param: string New zip filename to process
return: boolean true/false

get_local_md5()   X-Ref
This function will get the local md5 value of the installed
component.

return: string md5 of the local component (false on error)

get_component_md5()   X-Ref
This function will download the specified md5 file, looking for the
current componentname, returning its md5 field and storing extramd5info
if present. Also it caches results to cachedmd5components for better
performance in the same request.

return: mixed md5 present in server (or false if error)

get_all_components_md5()   X-Ref
This function allows you to retrieve the complete array of components found in
the md5filename

return: array array of components in md5 file or false if error

get_error()   X-Ref
This function returns the errorstring

return: string the error string

get_extra_md5_field()   X-Ref
No description



Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7