function _osc_check_themes_update() { $total = 0; $array = array(); $array_downloaded = array(); $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(); return $total; }
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; }