Example #1
0
function osc_check_themes_update($force = false)
{
    $total = getPreference('themes_update_count');
    if ($force) {
        return _osc_check_themes_update();
    } else {
        if (time() - osc_themes_last_version_check() > 24 * 3600) {
            osc_add_hook('admin_footer', 'check_themes_admin_footer');
        }
    }
    return $total;
}
Example #2
0
function osc_check_themes_update( $force = false )
{
    $total = 0;
    $array = array();
    $array_downloaded = array();
    // check if exist a new version each day
    if( (time() - osc_themes_last_version_check()) > (24 * 3600) || $force ) {
        $themes = WebThemes::newInstance()->getListThemes();
        foreach($themes as $theme) {
            $info = WebThemes::newInstance()->loadThemeInfo($theme);
            if(osc_check_theme_update(@$info['theme_update_uri'], @$info['version'])) {
                $array[] = $theme;
                $total++;
            }
            $array_downloaded[] = @$info['theme_update_uri'];
        }
        osc_set_preference( 'themes_to_update', json_encode($array) );
        osc_set_preference( 'themes_downloaded', json_encode($array_downloaded) );
        osc_set_preference( 'themes_update_count', $total );
        osc_set_preference( 'themes_last_version_check', time() );
        osc_reset_preferences();
    } else {
        $total = getPreference('themes_update_count');
    }

    return $total;
}