示例#1
0
 public function fetchAllCache($cacheNames)
 {
     $cacheNames = is_array($cacheNames) ? $cacheNames : array($cacheNames);
     $data = CacheUtil::get($cacheNames);
     if (is_array($data) && in_array(false, $data, true) || !$data) {
         $data = false;
     }
     $newArray = $data !== false ? array_diff($cacheNames, array_keys($data)) : $cacheNames;
     if (empty($newArray)) {
         foreach ($data as &$cache) {
             $isSerialized = $cache == serialize(false) || @unserialize($cache) !== false;
             $cache = $isSerialized ? unserialize($cache) : $cache;
         }
         return $data;
     } else {
         $cacheNames = $newArray;
     }
     $caches = $this->fetchAll(sprintf("FIND_IN_SET(name,'%s')", implode(",", $cacheNames)));
     if ($caches) {
         foreach ($caches as $sysCache) {
             $data[$sysCache["name"]] = $sysCache["type"] ? unserialize($sysCache["value"]) : $sysCache["value"];
             CacheUtil::set($sysCache["name"], $data[$sysCache["name"]]);
         }
         foreach ($cacheNames as $name) {
             if ($data[$name] === null) {
                 $data[$name] = null;
                 CacheUtil::rm($name);
             }
         }
     }
     return $data;
 }
示例#2
0
 public function actionAdd()
 {
     $flowId = intval(EnvUtil::getRequest("flowid"));
     $flow = new ICFlowType($flowId);
     if (EnvUtil::submitCheck("formhash")) {
         $this->checkFlowAccess($flowId, 1, $this->createUrl("new/add"));
         $this->beforeAdd($_POST, $flow);
         $run = array("name" => $_POST["name"], "flowid" => $flowId, "beginuser" => $this->uid, "begintime" => TIMESTAMP);
         $runId = FlowRun::model()->add($run, true);
         $runProcess = array("runid" => $runId, "processid" => 1, "uid" => $this->uid, "flag" => FlowConst::PRCS_UN_RECEIVE, "flowprocess" => 1, "createtime" => TIMESTAMP);
         FlowRunProcess::model()->add($runProcess);
         if (strstr($flow->autoname, "{N}")) {
             FlowType::model()->updateCounters(array("autonum" => 1), sprintf("flowid = %d", $flowId));
             CacheUtil::rm("flowtype_" . $flowId);
         }
         $runData = array("runid" => $runId, "name" => $_POST["name"], "beginuser" => $this->uid, "begin" => TIMESTAMP);
         $this->handleRunData($flow, $runData);
         $param = array("flowid" => $flowId, "runid" => $runId, "processid" => 1, "flowprocess" => 1, "fromnew" => 1);
         $jumpUrl = $this->createUrl("form/index", array("key" => WfCommonUtil::param($param)));
         $this->ajaxReturn(array("isSuccess" => true, "jumpUrl" => $jumpUrl));
     } else {
         $this->checkFlowAccess($flowId, 1);
         if (!empty($flow->autoname)) {
             $runName = WfNewUtil::replaceAutoName($flow, $this->uid);
         } else {
             $runName = sprintf("%s (%s)", $flow->name, date("Y-m-d H:i:s"));
         }
         $data = array("flow" => $flow->toArray(), "runName" => $runName, "lang" => Ibos::getLangSources());
         $this->renderPartial("add", $data);
     }
 }
示例#3
0
 public static function cleanCache($uid)
 {
     $users = UserUtil::loadUser();
     if (isset($users[$uid])) {
         unset($users[$uid]);
         User::model()->makeCache($users);
     }
     CacheUtil::rm("userData_" . $uid);
 }
示例#4
0
 public function deleteWeiboJoinTopic($feedId)
 {
     $del["feedid"] = $feedId;
     $topicId = $this->getDbConnection()->createCommand()->select("topicid")->from("{{feed_topic_link}}")->where("feedid = " . intval($feedId))->queryScalar();
     if ($topicId) {
         FeedTopicLink::model()->deleteAllByAttributes($del);
         $this->updateCounters(array("count" => 1), "topicid = " . intval($topicId));
         $recommend = $this->getDbConnection()->createCommand()->select("recommend")->from($this->tableName())->where("topicid = " . $topicId)->queryScalar();
         if ($recommend == 1) {
             CacheUtil::rm("feed_topic_recommend");
         }
     }
 }
示例#5
0
 private function processCmdCache($cmd, $name, $ttl = 0)
 {
     $ret = "";
     switch ($cmd) {
         case "set":
             $ret = CacheUtil::set("process_lock_" . $name, TIMESTAMP, $ttl);
             break;
         case "get":
             $ret = CacheUtil::get("process_lock_" . $name);
             break;
         case "rm":
             $ret = CacheUtil::rm("process_lock_" . $name);
     }
     return $ret;
 }
示例#6
0
 protected function beforeDelete()
 {
     if ($this->getIsAllowCache()) {
         $key = $this->getCacheKey();
         CacheUtil::rm($key);
     }
     return parent::beforeDelete();
 }
示例#7
0
文件: index.php 项目: AxelPanda/ibos
        header("Location: index.php?op=updateCache");
    } else {
        $errorMsg = $_GET['msg'];
        include 'errorInfo.php';
        exit;
    }
} elseif ($option == 'updateCache') {
    // 初始化ibos,执行各个已安装模块有extention.php的安装文件,更新缓存
    define('ENGINE', 'LOCAL');
    $yii = PATH_ROOT . '/library/yii.php';
    $ibosApplication = PATH_ROOT . '/system/core/components/ICApplication.php';
    require_once $yii;
    require_once $ibosApplication;
    $commonConfig = (require CONFIG_PATH . 'common.php');
    Yii::createApplication('ICApplication', $commonConfig);
    CacheUtil::rm('module');
    $allModules = getModuleDirs();
    $customModules = array_diff($allModules, $sysModules);
    $modules = !empty($customModules) ? array_merge($sysModules, $customModules) : $sysModules;
    defined('IN_MODULE_ACTION') or define('IN_MODULE_ACTION', true);
    foreach ($modules as $module) {
        if (getIsInstall($module)) {
            $installPath = getInstallPath($module);
            $config = (require $installPath . 'config.php');
            if (isset($config['authorization'])) {
                ModuleUtil::updateAuthorization($config['authorization'], $module, $config['param']['category']);
            }
            $extentionScript = $installPath . 'extention.php';
            // 执行模块扩展脚本(如果有)
            if (file_exists($extentionScript)) {
                include_once $extentionScript;
示例#8
0
 public static function cleanPurvCache($posId)
 {
     CacheUtil::rm("purv_" . $posId);
 }
示例#9
0
 public function setKeyValue($uid, $key, $value)
 {
     $map["uid"] = $uid;
     $map["key"] = $key;
     $this->deleteAllByAttributes($map);
     $map["value"] = intval($value);
     $map["mtime"] = date("Y-m-d H:i:s");
     $this->add($map);
     CacheUtil::rm("userData_" . $uid);
 }
示例#10
0
 public function actionEdit()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $newPrcsId = intval(EnvUtil::getRequest("processid"));
         $oldPrcsId = intval(EnvUtil::getRequest("oldprcsid"));
         if ($newPrcsId != $oldPrcsId && FlowProcess::model()->checkProcessIdIsExist($this->flow->getID(), $newPrcsId)) {
             $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Step number already exists")));
         }
         $this->setGuideProcess($this->flow, 3);
         $data = $this->beforeSave();
         FlowProcess::model()->updateAll($data, sprintf("flowid = %d AND processid = %d", $this->flow->getID(), $oldPrcsId));
         if ($newPrcsId != $oldPrcsId) {
             FlowProcess::model()->updateProcessto($this->flow->getID(), $oldPrcsId, $newPrcsId);
         }
         $process = new ICFlowProcess($this->flow->getID(), $data["processid"]);
         $return = $this->handleListData(array($process->toArray()));
         CacheUtil::rm("flowprocess_" . $this->flow->getID());
         $this->ajaxReturn(array("isSuccess" => true, "data" => array_shift($return)));
     } else {
         $processId = intval(EnvUtil::getRequest("processid"));
         $op = EnvUtil::getRequest("op");
         $opList = array("base", "field", "handle", "condition", "setting");
         if (!in_array($op, $opList)) {
             $op = "base";
         }
         $process = new ICFlowProcess($this->flow->getID(), $processId);
         $prcs = $process->toArray();
         if ($prcs["type"] == "1") {
             $op = "base";
         }
         $structure = $this->flow->form->parser->getStructure();
         $data = array("lang" => Ibos::getLangSources(array("workflow.item")), "prcs" => $prcs, "structure" => $structure, "op" => $op, "flows" => FlowType::model()->fetchAllFlow());
         $this->handleBase($data);
         $this->handleFormItem($data);
         $this->handleProcess($data);
         $this->renderPartial("edit", $data);
     }
 }
示例#11
0
<?php

CacheUtil::rm("notifyNode");
示例#12
0
 public function actionDesign()
 {
     if (filter_input(INPUT_GET, "op") == "showcomponet") {
         $type = filter_input(INPUT_GET, "type");
         return $this->renderPartial("ic" . $type, null, false);
     }
     $formId = intval(EnvUtil::getRequest("formid"));
     $mode = EnvUtil::getRequest("mode");
     if (!in_array($mode, array("advanced", "simple"))) {
         $mode = "advanced";
     }
     if (EnvUtil::submitCheck("formhash")) {
         $content = preg_replace("/<form.*?>(.*?)<\\/form>/is", "", $_POST["content"]);
         if ($_POST["op"] == "version") {
             $verMax = FlowFormVersion::model()->getMaxMark($formId);
             $mark = $verMax ? $verMax + 1 : 1;
             $oldForm = FlowFormType::model()->fetchByPk($formId);
             $data = array("formid" => $formId, "printmodel" => $oldForm["printmodel"], "printmodel_short" => $oldForm["printmodelshort"], "script" => $oldForm["script"], "css" => $oldForm["css"], "time" => TIMESTAMP, "mark" => $mark);
             FlowFormVersion::model()->add($data);
             MainUtil::setCookie("form_op_version", 1, 30, 0);
         } else {
             $this->setAllGuideInfo($formId);
             MainUtil::setCookie("form_op_save", 1, 30, 0);
         }
         FlowFormType::model()->modify($formId, array("printmodel" => $content));
         CacheUtil::rm("form_" . $formId);
         $form = new ICFlowForm($formId);
         $form->parser->parse();
         $url = $this->createUrl("formtype/design", array("mode" => $mode, "formid" => $formId));
         $this->redirect($url);
         exit;
     }
     $form = new ICFlowForm($formId);
     $arr = $form->toArray();
     $data = array("form" => $arr, "mode" => $mode, "formid" => $formId);
     $this->layout = false;
     $this->render("designer" . ucfirst($mode), $data, false, array("workflow.item"));
 }
示例#13
0
 public static function updateConfig($module = "")
 {
     static $execute = false;
     if (!$execute) {
         defined("IN_MODULE_ACTION") || define("IN_MODULE_ACTION", true);
         $updateList = empty($module) ? array() : (is_array($module) ? $module : array($module));
         $modules = array();
         $installedModule = Ibos::app()->getEnabledModule();
         if (!$updateList) {
             foreach ($installedModule as $module) {
                 $modules[] = $module["module"];
             }
         } else {
             $modules = $updateList;
         }
         foreach ($modules as $name) {
             $installPath = self::getInstallPath($name);
             $file = $installPath . "config.php";
             if (is_file($file) && is_readable($file)) {
                 $config = (include_once $file);
                 if (isset($config) && is_array($config) && array_key_exists($name, $installedModule)) {
                     $icon = self::getModulePath() . $name . "/static/image/icon.png";
                     if (is_file($icon)) {
                         $config["param"]["icon"] = 1;
                     } else {
                         $config["param"]["icon"] = 0;
                     }
                     if (!isset($config["param"]["category"])) {
                         $config["param"]["category"] = "";
                     }
                     $data = array("updatedate" => TIMESTAMP, "config" => CJSON::encode($config), "icon" => $config["param"]["icon"], "name" => $config["param"]["name"], "category" => $config["param"]["category"], "version" => $config["param"]["version"], "description" => $config["param"]["description"]);
                     Module::model()->modify($name, $data);
                     if (isset($config["authorization"])) {
                         self::updateAuthorization($config["authorization"], $name, $config["param"]["category"]);
                     }
                 }
             }
         }
         CacheUtil::rm("module");
         $execute = true;
     }
     return $execute;
 }
示例#14
0
文件: Feed.php 项目: AxelPanda/ibos
 public function cleanCache($feedIds = array(), $uid = "")
 {
     if (!empty($uid)) {
         CacheUtil::rm("feed_foli_" . $uid);
         CacheUtil::rm("feed_uli_" . $uid);
     }
     if (empty($feedIds)) {
         return true;
     }
     if (is_array($feedIds)) {
         foreach ($feedIds as $v) {
             CacheUtil::rm("feed_" . $v);
             CacheUtil::rm("feed_info_" . $v);
         }
     } else {
         CacheUtil::rm("feed_" . $feedIds);
         CacheUtil::rm("feed_info_" . $feedIds);
     }
 }