Esempio n. 1
0
 public static function makeUpdate($params)
 {
     //@tosee:
     //https://site.ru/local/dev/lp_b24_hosting/lp_b24_hosting.php?className=ShefAutoUpdate&functionName=makeUpdate&token=dekqkddeiorsojdoaixuiqcafwnhwudi&projectId=2
     $result = array();
     $update = new AutoUpdate(true);
     $update->currentVersion = iLPB24HOSTINGVER;
     $update->updateUrl = DEFAULT_UPDATE_SERVER;
     //Check for a new update
     $latest = $update->checkUpdate();
     if ($latest !== false) {
         if ($latest > $update->currentVersion) {
             //Install new update
             if ($update->update()) {
                 $result = array('response' => array('status' => 'ok', 'message' => 'Update_successful'), 'values' => array($update->latestVersionName));
             } else {
                 $result = array('response' => array('status' => 'error', 'message' => 'Update_failed'), 'values' => array());
             }
         } else {
             $result = array('response' => array('status' => 'ok', 'message' => 'Current_Version_is_up_to_date'), 'values' => array());
         }
     } else {
         $result = array('response' => array('status' => 'error', 'message' => $update->getLastError()), 'values' => array());
     }
     return $result;
 }
Esempio n. 2
0
 /**
  * Function checking if new okovision version is available
  * 
  * @return json 
  */
 public function checkUpdate()
 {
     $r = array();
     $r['newVersion'] = false;
     $r['information'] = '';
     $this->addOkoStat();
     $update = new AutoUpdate();
     $update->setCurrentVersion($this->getCurrentVersion());
     if ($update->checkUpdate() === false) {
         $r['information'] = session::getInstance()->getLabel('lang.error.maj.information');
     } elseif ($update->newVersionAvailable()) {
         $r['newVersion'] = true;
         $r['list'] = $update->getVersionsInformationToUpdate();
     } else {
         $r['information'] = session::getInstance()->getLabel('lang.valid.maj.information');
     }
     return $this->sendResponse($r);
 }
Esempio n. 3
0
You should have received a copy of the GNU General Public License
along with Bittytorrent.  If not, see <http://www.gnu.org/licenses/>. 
*/
if (!defined("IN_TORRENT")) {
    die("Access denied!");
}
$smarty->assign('returnUpdate', false);
if (isset($_GET['updateNow'])) {
    require $path . '/libs/Update.class.php';
    $update = new AutoUpdate(true);
    $update->currentVersion = 2;
    //Must be an integer - you can't compare strings
    $update->updateUrl = 'http://localhost/libs';
    //Replace with your server update directory
    //Check for a new update
    $latest = $update->checkUpdate();
    if ($latest !== false) {
        // var_dump($update->currentVersion);
        if ($latest > $update->currentVersion) {
            //Install new update
            $rUpdate = "";
            $rUpdate .= "New Version: " . $update->latestVersionName . "<br />";
            $rUpdate .= "Installing Update...<br />";
            if ($update->update()) {
                $rUpdate .= "Update successful!";
            } else {
                $rUpdate .= "Update failed!";
            }
        } else {
            $rUpdate .= "Current Version is up to date";
        }