示例#1
0
function osc_check_plugins_update($force = false)
{
    $total = getPreference('plugins_update_count');
    if ($force) {
        return _osc_check_plugins_update();
    } else {
        if (time() - osc_plugins_last_version_check() > 24 * 3600) {
            osc_add_hook('admin_footer', 'check_plugins_admin_footer');
        }
    }
    return $total;
}
示例#2
0
function osc_check_plugins_update( $force = false )
{
    $total = 0;
    $array = array();
    $array_downloaded = array();
    // check if exist a new version each day
    if( (time() - osc_plugins_last_version_check()) > (24 * 3600) || $force ) {
        $plugins    = Plugins::listAll();
        foreach($plugins as $plugin) {
            $info = osc_plugin_get_info($plugin);
            if(osc_check_plugin_update(@$info['plugin_update_uri'], @$info['version'])) {
                $array[] = @$info['plugin_update_uri'];
                $total++;
            }else{
            }
            $array_downloaded[] = @$info['plugin_update_uri'];
        }

        osc_set_preference( 'plugins_to_update' , json_encode($array) );
        osc_set_preference( 'plugins_downloaded', json_encode($array_downloaded) );
        osc_set_preference( 'plugins_update_count', $total );
        osc_set_preference( 'plugins_last_version_check', time() );
        osc_reset_preferences();
    } else {
        $total = getPreference('plugins_update_count');
    }

    return $total;
}