예제 #1
0
 public function enterpriseSystemUpdate($data)
 {
     if (count(glob(PATH_DATA_SITE . 'license/*.dat')) == 0) {
         return;
     }
     require_once "classes/model/Users.php";
     $user = $data;
     $criteria = new Criteria("workflow");
     //SELECT
     $criteria->addSelectColumn(UsersPeer::USR_UID);
     //FROM
     //WHERE
     $criteria->add(UsersPeer::USR_USERNAME, $user->lName);
     //$user->lPassword
     $criteria->add(UsersPeer::USR_ROLE, "PROCESSMAKER_ADMIN");
     //query
     $rsSQLUSR = UsersPeer::doSelectRS($criteria);
     $rsSQLUSR->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $sw = 0;
     if (UsersPeer::doCount($criteria) > 0) {
         //if ($rsSQLUSR->getRecordCount() > 0) {
         $sw = 1;
     }
     /*
     $cnn = Propel::getConnection("workflow");
     $stmt = $cnn->createStatement();
     
     $sql = "SELECT USR.USR_UID
             FROM   USERS AS USR
             WHERE  USR.USR_USERNAME = '******' AND USR.USR_ROLE = 'PROCESSMAKER_ADMIN'";
     $rsSQLUSR = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
     
     $sw = 0;
     
     if ($rsSQLUSR->getRecordCount() > 0) {
         $sw = 1;
     }
     */
     if ($sw == 1) {
         //Upgrade available
         $swUpgrade = 0;
         $addonList = AddonsStore::addonList();
         $addon = $addonList["addons"];
         if (count($addon) > 0) {
             $status = array("ready", "upgrade", "available");
             $pmVersion = EnterpriseUtils::pmVersion(PM_VERSION);
             foreach ($addon as $index => $value) {
                 if ($addon[$index]["id"] == "processmaker") {
                     if (version_compare($pmVersion . "", EnterpriseUtils::pmVersion($addon[$index]["version"]) . "", "<")) {
                         $swUpgrade = 1;
                         break;
                     }
                 } else {
                     if (in_array($addon[$index]["status"], $status)) {
                         $swUpgrade = 1;
                         break;
                     }
                 }
             }
         }
         if ($swUpgrade == 1) {
             $_SESSION["__ENTERPRISE_SYSTEM_UPDATE__"] = 1;
         }
     }
 }
예제 #2
0
             if ($sysConf['proxy_user'] != '') {
                 if (!isset($option['http']['header'])) {
                     $option['http']['header'] = '';
                 }
                 $option['http']['header'] .= 'Proxy-Authorization: Basic ' . base64_encode($sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
             }
         }
     }
     $context = stream_context_create($option);
     $results = file_get_contents($url, false, $context);
     $results = G::json_decode($results);
     $results = isset($results[0]) ? $results[0] : array();
     $pmVersion = EnterpriseUtils::pmVersion(PM_VERSION);
     $versions = array();
     foreach ($results as $key => $result) {
         $version = EnterpriseUtils::pmVersion($result->OBJ_VERSION_NAME);
         if (version_compare($pmVersion . "", $version . "", "<")) {
             $versions[] = $result;
         }
     }
     if (isset($results[0])) {
         $results[0]->OBJ_VERSION_NAME .= " (Stable)";
     }
     $response->status = "OK";
     $response->results = $versions;
 } catch (Exception $e) {
     $response->message = $e->getMessage();
     $status = 0;
 }
 if ($status == 0) {
     $response->status = "ERROR";
예제 #3
0
 /**
  * Returns the currently installed version of this addon.
  *
  * @return string the installed version or an empty string otherwise.
  */
 public function getInstalledVersion()
 {
     if ($this->isCore()) {
         G::LoadClass("system");
         return EnterpriseUtils::pmVersion(System::getVersion());
     } else {
         if ($this->isPlugin()) {
             if (!$this->isInstalled()) {
                 return null;
             }
             $oPluginRegistry =& PMPluginRegistry::getSingleton();
             $details = $oPluginRegistry->getPluginDetails($this->getAddonName() . ".php");
             $v = !($details == null) ? $details->iVersion : null;
             if ($v != "") {
                 return $v;
             }
             if (file_exists(PATH_PLUGINS . $this->getAddonName() . PATH_SEP . "VERSION")) {
                 return trim(file_get_contents(PATH_PLUGINS . $this->getAddonName() . PATH_SEP . "VERSION"));
             }
         } else {
             if ($this->getAddonType() == "core") {
                 throw new Exception("Addon type \"" . $this->getAddonType() . "\" unsupported");
             }
         }
     }
 }