Ejemplo n.º 1
0
/**
 * Check Log
 *
 * This function finds that last tag for the current release and shows you 
 * any changes between them
 *
 * @param The git module directory
 * @return String of `git log` output
 */
function checklog($moddir)
{
    $repo = Git::open($moddir);
    $ltags = $repo->list_tags();
    if ($ltags === false) {
        return 'No Tags found!';
    }
    list($rawname, $ver, $supported) = freepbx::check_xml_file($moddir);
    //Get current module version
    preg_match('/(\\d*\\.\\d*)\\./i', $ver, $matches);
    $rver = $matches[1];
    //cycle through the tags and create a new array with relavant tags
    $tagArray = array();
    foreach ($ltags as $tag) {
        if (preg_match('/release\\/(.*)/i', $tag, $matches)) {
            if (strpos($matches[1], $rver) !== false) {
                $tagArray[] = $matches[1];
            }
        }
    }
    if (!empty($tagArray)) {
        usort($tagArray, "freepbx::version_compare_freepbx");
        $htag = array_pop($tagArray);
        $tagref = $repo->show_ref_tag($htag);
        return $repo->log($tagref, 'HEAD');
    }
    return;
}
Ejemplo n.º 2
0
 if ($vars['log'] && !$vars['debug']) {
     freepbx::outn("\tUpdating Changelog...");
     $msg = $vars['msg'] ? $vars['msg'] : 'Packaging of ver ' . $ver;
     package_update_changelog($module, $msg);
     freepbx::out("Done");
 }
 // Run xml script through the exact method that FreePBX currently uses. There have
 // been cases where XML is valid but this method still fails so it won't be caught
 // with the proper XML checer, better here then breaking the online repository
 // -Philippe L.
 $parser = new xml2ModuleArray();
 $xmlarray = $parser->parseAdvanced(file_get_contents($mod_dir . '/module.xml'));
 //Check XML File one more time to be safe
 freepbx::outn("\tChecking Modified Module XML...");
 //test xml file and get some of its values
 list($rawname, $ver, $supported, $license, $licenselink) = freepbx::check_xml_file($mod_dir);
 //dont continue if there is an issue with the xml
 if ($rawname == false || $ver == false || $supported == false || $license == false || $licenselink == false) {
     $missing = $rawname == false ? 'rawname' : ($ver == false ? 'version' : ($supported == false ? 'supported' : ($license == false ? 'license' : ($licenselink == false ? 'licenselink' : 'Unknown'))));
     freepbx::out('module.xml is missing ' . $missing);
     freepbx::out("Module " . $module . " will not be tagged!");
     continue;
 }
 //sanity check
 if ($rawname != $xmlarray['module']['rawname'] || $ver != $xmlarray['module']['version']) {
     freepbx::out('simple_xml_object and xml2modulearray mismatch');
     freepbx::out("Module " . $module . " will not be tagged!");
     continue;
 }
 freepbx::out("Done");
 //Package javascript because Andrew always forgets