/** * Check for required gears * * @param Gear $gear Gear itself * @return boolean */ public function requiredCheck(Gear $gear) { if (!($required = $gear->info('required'))) { return TRUE; } $errors = array(); foreach ($required as $requirement) { $result = self::parseVersion($requirement); $size = sizeof($result); if (!($required_gear = $this->gears->{$result}[0])) { $errors[] = $requirement; } else { $version = $required_gear->info('version'); if (3 == $size && !version_compare($version, $result[2], $result[1]) or 2 == $size && !version_compare($version, $result[1], '>=')) { $errors[] = $requirement; } else { return TRUE; } } } $errors && systemError(t('Gear <b>%s</b> can\'t be loaded, due to the following requirements conditions: %s.', 'Loader', $gear->info('name'), '<b>' . implode('</b> ,<b>', $errors) . '</b>'), t('Gears requirements interruption', 'Loader')); return FALSE; }