gyro/modules/systemupdate/lib/components/installedvalidator.cls.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * Tools for checking if some third party tools are installed 00004 * 00005 * @author Gerd Riesselmann 00006 * @ingroup SystemUpdate 00007 */ 00008 class InstalledValidator { 00009 /** 00010 * Checks if given PEAR modules are installed 00011 * 00012 * @attention 00013 * Usually PEAR modules follow the rule that a _ in a class name maps to 00014 * a directory in the path name. E.g. module "Text_Diff" maps to file 00015 * Text/Diff.php. Some PEAR modules however do not follow this convention, 00016 * Mail_Mime for example. This should be reflected by passing "Mail_mime" 00017 * in $pear_classes 00018 * 00019 * @param $pear_classes Array of Module names, e.g. "Text_Diff", "Mail_mime" etc 00020 * @return Status 00021 */ 00022 public function validate_pear_modules_are_installed($pear_classes) { 00023 $ret = new Status(); 00024 foreach(Arr::force($pear_classes, false) as $cls) { 00025 // A_B_C => A/B/C.php 00026 // There are PEAR modules that do not follow this convention, Mail_Mime, e.g. 00027 // which becomes Mail/mime.php - This should be reflected by passing 00028 // Mail_mime in $pear_classes 00029 $file = str_replace('_', '/', $cls) . '.php'; 00030 @include_once($file); 00031 if ((!class_exists($cls))) { 00032 $ret->append(tr('PEAR module %mod not installed! Please execute "pear install %mod"', 'systemupdate', array('%mod' => $cls))); 00033 } 00034 } 00035 00036 return $ret; 00037 } 00038 00039 00040 }