Advertisement:

Author Topic: What does osc_do_auto_upgrade() in cron.php?  (Read 542 times)

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
What does osc_do_auto_upgrade() in cron.php?
« on: February 10, 2018, 05:44:00 pm »
Hello,
I saw my alerts aren't working anymore and I started to study the code.

In cron.php i found

osc_do_auto_upgrade();

Is this autoupdating some scripts or db in osclass?

Code: [Select]
function osc_do_auto_upgrade() {
    $data = osc_file_get_contents('http://osclass.org/latest_version_v1.php?callback=?');
    $data = preg_replace('|^\?\((.*?)\);$|', '$01', $data);
    $json = json_decode($data);
    $result['error'] = 0;
    if(isset($json->version)) {
        if ($json->version > osc_version()) {
            osc_set_preference('update_core_json', $data);
            if (osc_check_dir_writable()) {
                if (substr($json->version, 0, 1) != substr(osc_version(), 0, 1)) {
                    // NEW BRANCH
                    if (strpos(osc_auto_update(), 'branch') !== false) {
                        osc_run_hook('before_auto_upgrade');
                        $result = osc_do_upgrade();
                        osc_run_hook('after_auto_upgrade', $result);
                    }
                } else if (substr($json->version, 1, 1) != substr(osc_version(), 1, 1)) {
                    // MAJOR RELEASE
                    if (strpos(osc_auto_update(), 'branch') !== false || strpos(osc_auto_update(), 'major') !== false) {
                        osc_run_hook('before_auto_upgrade');
                        $result = osc_do_upgrade();
                        osc_run_hook('after_auto_upgrade', $result);
                    }
                } else if (substr($json->version, 2, 1) != substr(osc_version(), 2, 1)) {
                    // MINOR RELEASE
                    if (strpos(osc_auto_update(), 'branch') !== false || strpos(osc_auto_update(), 'major') !== false || strpos(osc_auto_update(), 'minor') !== false) {
                        osc_run_hook('before_auto_upgrade');
                        $result = osc_do_upgrade();
                        osc_run_hook('after_auto_upgrade', $result);
                    }
                }
            }
        } else {
            osc_set_preference('update_core_json', '');
        }
        osc_set_preference('last_version_check', time());
    } else {
        osc_set_preference('update_core_json', '');
        osc_set_preference('last_version_check', time() - 23*3600);
    }

    if($result['error']==0 || $result['error']==6) {
        if(strpos(osc_auto_update(), 'plugins')!==false) {
            $total = osc_check_plugins_update(true);
            if($total>0) {
                $elements = osc_get_preference('plugins_to_update');
                foreach($elements as $element) {
                    if(osc_is_update_compatible('plugins', $element, $json->s_name)) {
                        osc_market('plugins', $element);
                    }
                }
            }
        }

        if(strpos(osc_auto_update(), 'themes')!==false) {
            $total = osc_check_themes_update(true);
            if($total>0) {
                $elements = osc_get_preference('themes_to_update');
                foreach($elements as $element) {
                    if(osc_is_update_compatible('themes', $element, $json->s_name)) {
                        osc_market('themes', $element);
                    }
                }
            }
        }

        if(strpos(osc_auto_update(), 'languages')!==false) {
            $total = osc_check_languages_update(true);
            if($total>0) {
                $elements = osc_get_preference('languages_to_update');
                foreach($elements as $element) {
                    if(osc_is_update_compatible('languages', $element, $json->s_name)) {
                        osc_market('languages', $element);
                    }
                }
            }
        }
    }
}

EDIT.
In oc-admin all of my auto update preferences are off.

EDIT AGAIN.
I think this is doing nothing if in oc-admin all autoupgrade options are off.
« Last Edit: February 10, 2018, 07:16:25 pm by marius-ciclistu »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: What does osc_do_auto_upgrade() in cron.php?
« Reply #1 on: February 10, 2018, 06:16:53 pm »
I figured it out. Solved
« Last Edit: February 10, 2018, 07:17:00 pm by marius-ciclistu »

BazarulDeCase

  • Newbie
  • *
  • Posts: 6
I want to know how to make the phone number appear with a single click!
« Reply #2 on: February 10, 2018, 06:44:05 pm »
I want to know how to make the phone number appear with a single click!
Now you have to click to see the phone number.
The theme is Veronika!
The site is https://www.bazaruldecase.ro/
marius-ciclistul ma poti ajuta cu acesta problema sa fac la tema Veronika sa apara nr de telefon cu un click?
multumesc!

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: I want to know how to make the phone number appear with a single click!
« Reply #3 on: February 10, 2018, 06:49:53 pm »
I want to know how to make the phone number appear with a single click!
Now you have to click to see the phone number.
The theme is Veronika!
The site is https://www.bazaruldecase.ro/
marius-ciclistul ma poti ajuta cu acesta problema sa fac la tema Veronika sa apara nr de telefon cu un click?
multumesc!

You should open a new topic for this
Answer: https://forums.osclass.org/3-7-x/i-want-to-know-how-to-make-the-phone-number-appear-with-a-single-click!/
« Last Edit: February 10, 2018, 06:59:53 pm by marius-ciclistu »

BazarulDeCase

  • Newbie
  • *
  • Posts: 6
Re: What does osc_do_auto_upgrade() in cron.php?
« Reply #4 on: February 10, 2018, 07:05:34 pm »
am primit un cod dar nu stiu unde se pune!! ma poti ajuta te rog frumos...multumesc

BazarulDeCase

  • Newbie
  • *
  • Posts: 6
Re: I want to know how to make the phone number appear with a single click!
« Reply #5 on: February 10, 2018, 08:29:03 pm »

marius-ciclistul ma poti ajuta cu acesta problema sa fac la tema Veronika sa apara nr de telefon cu un click?
multumesc!
 am gasit asta
<div class="header-search-mobile is767"> aici trebuie pus acel cod sa afiseze nr de tel cu un click?

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"