This class is used to check, download and install items from download.moodle.org to the moodledata directory.
More...
|
| __construct ($sourcebase, $zippath, $zipfilename, $md5filename='', $destpath='') |
| Array of cached components to avoid to.
|
|
| change_zip_file ($newzipfilename) |
| 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.
|
|
object | check_requisites () |
| This function will check if everything is properly set to begin one installation.
|
|
| component_installer ($sourcebase, $zippath, $zipfilename, $md5filename='', $destpath='') |
| Old syntax of class constructor.
|
|
| get_all_components_md5 () |
| This function allows you to retrieve the complete array of components found in the md5filename.
|
|
| get_component_md5 () |
| This function will download the specified md5 file, looking for the current componentname, returning its md5 field and storing extramd5info if present.
|
|
| get_error () |
| This function returns the errorstring.
|
|
| get_extra_md5_field () |
| This function returns the extramd5 field (optional in md5 file)
|
|
object | get_local_md5 () |
| This function will get the local md5 value of the installed component.
|
|
| install () |
| This function will perform the full installation if needed, i.e.
|
|
| need_upgrade () |
| This function will detect if remote component needs to be installed because it's different from the local one.
|
|
|
array | $cachedmd5components |
| Flag to see if requisites check has been passed ok.
|
|
| $componentname |
| Name of the .md5 file to be read.
|
|
| $destpath |
| Name of the component.
|
|
| $errorstring |
| Relative path (from moodledata) where the .zip file will be expanded.
|
|
| $extramd5info |
| Latest error produced. It will contain one lang string key.
|
|
| $md5filename |
| Name of the .zip file to be downloaded.
|
|
| $requisitesok |
| Contents of the optional third field in the .md5 file.
|
|
string | $sourcebase |
|
| $zipfilename |
| Relative path (from sourcebase) where the downloadeable item resides.
|
|
| $zippath |
| Full http URL, base for downloadable items.
|
|
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.
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
component_installer::__construct |
( |
| $sourcebase, |
|
|
| $zippath, |
|
|
| $zipfilename, |
|
|
| $md5filename = '', |
|
|
| $destpath = '' ) |
Array of cached components to avoid to.
download the same md5 file more than once per request. Standard constructor of the class. It will initialize all attributes. without performing any check at all.
- Parameters
-
string | $sourcebase | Full http URL, base for downloadeable items |
string | $zippath | Relative path (from sourcebase) where the downloadeable item resides |
string | $zipfilename | Name of the .zip file to be downloaded |
string | $md5filename | Name of the .md5 file to be read (default '' = same than zipfilename) |
string | $destpath | Relative path (from moodledata) where the .zip file will be expanded (default='' = moodledataitself) |
- Return values
-
◆ change_zip_file()
component_installer::change_zip_file |
( |
| $newzipfilename | ) |
|
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.
- Parameters
-
string | $newzipfilename | New zip filename to process |
- Return values
-
◆ check_requisites()
object component_installer::check_requisites |
( |
| ) |
|
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 values
-
boolean | true/false (plus detailed error in errorstring) |
◆ component_installer()
component_installer::component_installer |
( |
| $sourcebase, |
|
|
| $zippath, |
|
|
| $zipfilename, |
|
|
| $md5filename = '', |
|
|
| $destpath = '' ) |
◆ get_all_components_md5()
component_installer::get_all_components_md5 |
( |
| ) |
|
This function allows you to retrieve the complete array of components found in the md5filename.
- Return values
-
bool|array | array of components in md5 file or false if error |
◆ get_component_md5()
component_installer::get_component_md5 |
( |
| ) |
|
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 values
-
mixed | md5 present in server (or false if error) |
◆ get_error()
component_installer::get_error |
( |
| ) |
|
This function returns the errorstring.
- Return values
-
◆ get_extra_md5_field()
component_installer::get_extra_md5_field |
( |
| ) |
|
This function returns the extramd5 field (optional in md5 file)
- Return values
-
◆ get_local_md5()
object component_installer::get_local_md5 |
( |
| ) |
|
This function will get the local md5 value of the installed component.
- Return values
-
bool|string | md5 of the local component (false on error) |
◆ install()
component_installer::install |
( |
| ) |
|
This function will perform the full installation if needed, i.e.
compare md5 values, download, unzip, install and regenerate local md5 file
@uses COMPONENT_ERROR @uses COMPONENT_UPTODATE @uses COMPONENT_ERROR @uses COMPONENT_INSTALLED
- Return values
-
int | COMPONENT_(ERROR | UPTODATE | INSTALLED) |
◆ need_upgrade()
component_installer::need_upgrade |
( |
| ) |
|
This function will detect if remote component needs to be installed because it's different from the local one.
@uses COMPONENT_ERROR @uses COMPONENT_UPTODATE @uses COMPONENT_NEEDUPDATE
- Return values
-
int | COMPONENT_(ERROR | UPTODATE | NEEDUPDATE) |
◆ $destpath
component_installer::$destpath |
Name of the component.
Must be the zip name without the extension. And it defines a lot of things: the md5 line to search for, the default m5 file name and the name of the root dir stored inside the zip file
The documentation for this class was generated from the following file:
- lib/componentlib.class.php