Exemplo n.º 1
0
 static function checkUpdate($plugin)
 {
     $info = Plugins::getInfo($plugin);
     return osc_check_plugin_update($info['plugin_update_uri'], $info['version']);
 }
Exemplo n.º 2
0
function _osc_check_plugins_update()
{
    $total = 0;
    $array = array();
    $array_downloaded = array();
    $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();
    return $total;
}
Exemplo n.º 3
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;
}