Example #1
0
 static function parseReleaseNote($list)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $maj = $sgbl->__ver_major;
     $ver = $sgbl->__ver_major_minor_release;
     $detail = null;
     $k = 0;
     $list = array_reverse($list);
     $mine = false;
     foreach ($list as $l) {
         $dd = curl_get_file("releasenotes/release-{$l}.txt");
         // We are going backwards, and when we reach our own version we get out. We need info only about versions greater than ourselves.
         if ($l === $ver) {
             $mine = true;
         }
         foreach ((array) $dd as $d) {
             $d = trim($d);
             if (!$d) {
                 continue;
             }
             $k++;
             $v = explode(" ", $d);
             $newvar['version'] = $l;
             if ($mine) {
                 $newvar['over_r'] = 'dull';
             } else {
                 $newvar['over_r'] = 'on';
             }
             $newvar['ttype'] = array_shift($v);
             $newvar['description'] = implode(" ", $v);
             $newvar['nname'] = $k;
             $result[] = $newvar;
         }
     }
     return $result;
 }
 // Fetch updates from translatewiki.net...
 $file_url = 'http://translatewiki.net/w/i.php?' . http_build_query(array('title' => 'Special:Translate', 'task' => 'export-to-file', 'group' => 'out-statusnet-core', 'language' => $twnCode));
 $lcdir = INSTALLDIR . '/locale/' . $code;
 $msgdir = "{$lcdir}/LC_MESSAGES";
 $pofile = "{$msgdir}/statusnet.po";
 $mofile = "{$msgdir}/statusnet.mo";
 /* Check for an existing */
 if (!is_dir($msgdir)) {
     mkdir($lcdir);
     mkdir($msgdir);
     $existingSHA1 = '';
 } else {
     $existingSHA1 = file_exists($pofile) ? sha1_file($pofile) : '';
 }
 /* Get the remote one */
 $new_file = curl_get_file($file_url);
 if ($new_file === FALSE) {
     echo "Could not retrieve .po file for {$code}: {$file_url}\n";
     continue;
 }
 // Update if the local .po file is different to the one downloaded, or
 // if the .mo file is not present.
 if (sha1($new_file) != $existingSHA1 || !file_exists($mofile)) {
     echo "Updating " . $code . "\n";
     file_put_contents($pofile, $new_file);
     // --backup=off is workaround for Mac OS X fail
     system(sprintf('msgmerge -U --backup=off %s %s', $pofile, $statusnet_pot));
     /* Do not rebuild/add .mo files by default
         * FIXME: should be made a command line parameter.
        system(sprintf('msgfmt -o %s %s', $mofile, $pofile));
         */
Example #3
0
function getFullVersionList($till = null)
{
    global $gbl, $sgbl, $login, $ghtml;
    $progname = $sgbl->__var_program_name;
    static $nlist;
    if ($nlist) {
        return $nlist;
    }
    $res = curl_get_file("{$progname}/version.txt");
    //dprintr($res);
    if (!$res) {
        throw new lxException('could_not_get_version_list', '');
    }
    foreach ($res as $k => $l) {
        // Skip lines that do not start with progname or one that contains 'current'
        if (!csb($l, "{$progname}")) {
            continue;
        }
        if (csa($l, "current")) {
            continue;
        }
        $upversion = strfrom($l, "{$progname}-");
        $upversion = strtil($upversion, ".zip");
        $list[] = $upversion;
        if ($till) {
            if ($upversion === $till) {
                break;
            }
        }
    }
    return $list;
}