$localconfig = get_mahara_version($GITREV, $buffer); if ($localconfig->version !== 0) { echo "ERROR: You should not update the version number in htdocs/local/version.php.\n"; $ERROR = true; } continue; } if (preg_match('#htdocs/local/upgrade.php#', $buffer, $matches)) { $localupdated = true; continue; } } pclose($p); // Now that we've got our list of updated plugins in this commit, validate each one foreach (array_keys($updates) as $dir) { validate_version("{$dir}/version.php", "{$dir}/db/upgrade.php"); } /** * Retrieves the $CFG->version number from a particular file in a particular git revision. * * @param string $gitrevision The git revision * @param string $pathtofile The relative path to the file (starting with htdocs/) */ function get_mahara_version($gitrevision, $pathtofile) { global $ERROR; exec("git show {$gitrevision}:{$pathtofile} 2> /dev/null", $lines, $returnval); if ($returnval !== 0) { $config = new stdClass(); $config->version = null; return $config;
/** * Check API Version. * * @param string|null $apiVersion * * @throws \Arcanedev\Stripe\Exceptions\ApiException */ private static function checkApiVersion(&$apiVersion) { if (!is_null($apiVersion) && !is_string($apiVersion)) { throw new ApiException('The API version must be a null or string value. ' . gettype($apiVersion) . ' is given.', 500); } if (is_null($apiVersion)) { return; } $apiVersion = trim($apiVersion); if (!validate_version($apiVersion)) { throw new ApiException('The API version must valid a semantic version [x.x.x].', 500); } }