Beispiel #1
0
 public static function checkUpgrade()
 {
     $return = false;
     $ibosRelease = VERSION_DATE;
     $upgradeFile = self::UPGRADE_URL . self::getVersionPath() . "/" . $ibosRelease . "/upgrade.xml";
     $remoteResponse = FileUtil::fileSockOpen($upgradeFile);
     $response = XmlUtil::xmlToArray($remoteResponse);
     if (isset($response["cross"]) || isset($response["patch"])) {
         Setting::model()->updateSettingValueByKey("upgrade", $response);
         CacheUtil::update("setting");
         $return = true;
     } else {
         Setting::model()->updateSettingValueByKey("upgrade", "");
         $return = false;
     }
     return $return;
 }
Beispiel #2
0
 public static function import($id, $file, $importUser = false)
 {
     $content = FileUtil::readFile($file);
     $xml = XmlUtil::xmlToArray($content);
     unset($xml["base"]["flowid"]);
     unset($xml["base"]["name"]);
     unset($xml["base"]["formid"]);
     unset($xml["base"]["sort"]);
     $user = array("newuser", "deptid", "uid", "positionid", "autouserop", "autouser", "mailto");
     $data = array();
     foreach ($xml["base"] as $key => $value) {
         $key = strtolower($key);
         if (!$importUser && in_array($key, $user)) {
             continue;
         }
         $data[$key] = $value;
     }
     FlowType::model()->modify($id, $data);
     unset($xml["base"]);
     unset($data);
     FlowProcess::model()->deleteAllByAttributes(array("flowid" => $id));
     if (!empty($xml)) {
         foreach ($xml as $process) {
             unset($process["id"]);
             $data = array();
             $process["flowid"] = $id;
             foreach ($process as $k => $v) {
                 if (!$importUser && in_array($k, $user)) {
                     continue;
                 }
                 $data[$k] = $v;
             }
             FlowProcess::model()->add($data);
         }
     }
     FileUtil::deleteFile($file);
 }
Beispiel #3
0
 private static function parseLocalConfig($address)
 {
     $config = array();
     if (is_file($address)) {
         $fileContent = file_get_contents($address);
         $config = XmlUtil::xmlToArray($fileContent);
     }
     return $config;
 }
Beispiel #4
0
 private function getLicence()
 {
     $file = self::OFFICE_PATH . "licence.xml";
     if (file_exists($file)) {
         $content = file_get_contents($file);
         if (is_string($content)) {
             $licence = XmlUtil::xmlToArray($content);
             return $licence;
         }
     } else {
         return false;
     }
 }
Beispiel #5
0
 public function checkUpgrade()
 {
     $return = false;
     $upgradeFile = $this->upgradeurl . $this->versionPath() . "/" . IBOS_RELEASE . "/upgrade.xml";
     $xmlContents = FileUtil::fileSockOpen($upgradeFile);
     $response = XmlUtil::xmlToArray($xmlContents);
     if (isset($response["cross"]) || isset($response["patch"])) {
         Setting::model()->updateByPk("upgrade", array("value" => serialize($response)));
         $return = true;
     } else {
         Setting::model()->updateByPk("upgrade", array("value" => ""));
         $return = false;
     }
     $setting = Yii::app()->setting->get("setting");
     $setting["upgrade"] = isset($response["cross"]) || isset($response["patch"]) ? $response : array();
     Yii::app()->setting->set("setting", $setting);
     return $return;
 }