version_format() static public méthode

static public version_format ( $v )
Exemple #1
0
 static function perform($from, $to)
 {
     $from = gb::version_parse($from);
     $to = gb::version_parse($to);
     $froms = gb::version_format($from);
     $tos = gb::version_format($to);
     if ($from === $to) {
         return null;
     }
     $is_upgrade = $from < $to;
     $stages = self::build_stages($from, $to);
     gb::log('%s gitblog %s -> %s in %d stages', $is_upgrade ? 'upgrading' : 'downgrading', $froms, $tos, count($stages));
     # don't break on client abort
     ignore_user_abort(true);
     foreach ($stages as $v => $stagefunc) {
         $prevvs = gb::version_format($v > 0 ? $v - 1 : $v);
         gb::log('%s -> %s (%s)', $prevvs, gb::version_format($v), $stagefunc[1], $v);
         # write prev version to site.json so next run will take off where we crashed, if we crash.
         $orig_v = gb::$version;
         gb::$version = $prevvs;
         gb_maint::sync_site_state();
         gb::$version = $orig_v;
         $stages[$v] = call_user_func($stagefunc, $from, $to);
     }
     gb_maint::sync_site_state();
     return $stages;
 }