Example #1
0
    $c = new CronRule();
    $ok = $c->set_rule($job['minute'] . ' ' . $job['hour'] . ' ' . $job['day'] . ' ' . $job['month'] . ' ' . $job['dow']);
    if (!$ok) {
        gs_log(GS_LOG_WARNING, "Phone {$mac}: Job " . $job['id'] . " has a bad cron rule (" . $c->err_msg . "). Deleting ...");
        $db->execute('DELETE FROM `prov_jobs` WHERE `id`=' . (int) $job['id'] . ' AND `running`=0');
        unset($c);
        continue;
    }
    if (!$c->validate_time()) {
        gs_log(GS_LOG_DEBUG, "Phone {$mac}: Job " . $job['id'] . ": Rule does not match");
        unset($c);
        continue;
    }
    unset($c);
    gs_log(GS_LOG_DEBUG, "Phone {$mac}: Job " . $job['id'] . ": Rule matches");
    $new_app = _snom_normalize_version($job['data']);
    if (subStr($new_app, 0, 2) == '00') {
        gs_log(GS_LOG_NOTICE, "Phone {$mac}: Bad new app vers. {$new_app}");
        $db->execute('DELETE FROM `prov_jobs` WHERE `id`=' . (int) $job['id'] . ' AND `running`=0');
        continue;
    }
    if ('x' . $new_app == 'x' . $a) {
        gs_log(GS_LOG_NOTICE, "Phone {$mac}: App {$a} == {$new_app}");
        $db->execute('DELETE FROM `prov_jobs` WHERE `id`=' . (int) $job['id'] . ' AND `running`=0');
        continue;
    }
    gs_log(GS_LOG_NOTICE, "Phone {$mac}: Upgrade app {$a} -> {$new_app}");
    $db->execute('DELETE FROM `prov_jobs` WHERE `id`=' . (int) $job['id']);
    _generate_settings($phone_model, $new_app, null, null);
    break;
}
Example #2
0
    $old_rootfs = '';
    if (!empty($rootfs_ramdisk)) {
        $new_rootfs = 'ramdiskToJffs2-3.36-br.bin';
    } elseif (!empty($rootfs_jffs2)) {
        if ($rootfs_jffs2 < '3.36') {
            $new_rootfs = 'ramdiskToJffs2-3.36-br.bin';
        }
    }
    if ($new_rootfs != '') {
        gs_log(GS_LOG_NOTICE, "Snom {$mac} ({$phone_type}, user {$user}): Update rootfs {$old_rootfs} -> {$new_rootfs}");
        _generate_settings($phone_model, null, $new_rootfs, null);
    }
}
#################################################################
#  linux
#################################################################
if (_snomAppCmp($a, '7') < 0) {
    $new_linux = '';
    if (!empty($linux)) {
        if ($linux < '3.25') {
            $new_linux = '3.25';
        } elseif (_snomAppCmp($a, '6') >= 0 && $allow_v_6_to_7 && $linux < '3.38') {
            # 3.38 is a special from6to7 linux
            $new_linux = '3.38';
        }
    }
    if ($new_linux != '') {
        gs_log(GS_LOG_NOTICE, "Snom {$mac} ({$phone_type}, user {$user}): Update linux {$linux} -> {$new_linux}");
        _generate_settings($phone_model, null, null, $new_linux);
    }
}