当前位置: 首页>>代码示例>>PHP>>正文


PHP AJXP_Utils::saveSerialFile方法代码示例

本文整理汇总了PHP中AJXP_Utils::saveSerialFile方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Utils::saveSerialFile方法的具体用法?PHP AJXP_Utils::saveSerialFile怎么用?PHP AJXP_Utils::saveSerialFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AJXP_Utils的用法示例。


在下文中一共展示了AJXP_Utils::saveSerialFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveBootstrapConf

 public static function saveBootstrapConf($jsonData)
 {
     $jsonPath = self::_getBootstrapFilePath();
     if (file_exists($jsonPath)) {
         copy($jsonPath, $jsonPath . ".bak");
     }
     AJXP_Utils::saveSerialFile($jsonPath, $jsonData, true, false, "json", true);
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:8,代码来源:class.CoreConfLoader.php

示例2: __destruct

 public function __destruct()
 {
     if (isset($this->channels) && is_array($this->channels)) {
         foreach ($this->channels as $channelName => $data) {
             if (is_array($data)) {
                 AJXP_Utils::saveSerialFile($this->getPluginWorkDir() . "/queues/channel-{$channelName}", $data);
             }
         }
     }
 }
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:10,代码来源:class.AJXP_SqlMessageExchanger.php

示例3: deleteUser

 function deleteUser($login)
 {
     $users = $this->listUsers();
     if (is_array($users) && array_key_exists($login, $users)) {
         unset($users[$login]);
         AJXP_Utils::saveSerialFile($this->usersSerFile, $users);
     }
 }
开发者ID:umbecr,项目名称:camilaframework,代码行数:8,代码来源:class.remoteAuthDriver.php

示例4: handleTasks

 public function handleTasks($action, $httpVars, $fileVars)
 {
     $tasks = AJXP_Utils::loadSerialFile($this->getDbFile(), false, "json");
     switch ($action) {
         case "scheduler_addTask":
             if (isset($httpVars["task_id"])) {
                 foreach ($tasks as $index => $task) {
                     if ($task["task_id"] == $httpVars["task_id"]) {
                         $data = $task;
                         $theIndex = $index;
                     }
                 }
             }
             if (!isset($theIndex)) {
                 $data = array();
                 $data["task_id"] = substr(md5(time()), 0, 16);
             }
             $data["label"] = $httpVars["label"];
             $data["schedule"] = $httpVars["schedule"];
             $data["action_name"] = $httpVars["action_name"];
             $data["repository_id"] = $httpVars["repository_id"];
             $i = 1;
             while (array_key_exists("repository_id_" . $i, $httpVars)) {
                 $data["repository_id"] .= "," . $httpVars["repository_id_" . $i];
                 $i++;
             }
             $data["user_id"] = $httpVars["user_id"];
             $data["PARAMS"] = array();
             if (!empty($httpVars["param_name"]) && !empty($httpVars["param_value"])) {
                 $data["PARAMS"][$httpVars["param_name"]] = $httpVars["param_value"];
             }
             foreach ($httpVars as $key => $value) {
                 if (preg_match('/^param_name_/', $key)) {
                     $paramIndex = str_replace("param_name_", "", $key);
                     if (preg_match('/ajxptype/', $paramIndex)) {
                         continue;
                     }
                     if (preg_match('/replication/', $paramIndex)) {
                         continue;
                     }
                     if (isset($httpVars["param_value_" . $paramIndex])) {
                         $data["PARAMS"][$value] = $httpVars["param_value_" . $paramIndex];
                     }
                 }
             }
             if (isset($theIndex)) {
                 $tasks[$theIndex] = $data;
             } else {
                 $tasks[] = $data;
             }
             AJXP_Utils::saveSerialFile($this->getDbFile(), $tasks, true, false, "json");
             AJXP_XMLWriter::header();
             AJXP_XMLWriter::sendMessage("Successfully added/edited task", null);
             AJXP_XMLWriter::reloadDataNode();
             AJXP_XMLWriter::close();
             break;
         case "scheduler_removeTask":
             $this->removeTask($httpVars["task_id"]);
             AJXP_XMLWriter::header();
             AJXP_XMLWriter::sendMessage("Successfully removed task", null);
             AJXP_XMLWriter::reloadDataNode();
             AJXP_XMLWriter::close();
             break;
         case "scheduler_loadTask":
             $found = false;
             foreach ($tasks as $task) {
                 if ($task["task_id"] == $httpVars["task_id"]) {
                     $index = 0;
                     $found = true;
                     foreach ($task["PARAMS"] as $pName => $pValue) {
                         if ($index == 0) {
                             $task["param_name"] = $pName;
                             $task["param_value"] = $pValue;
                         } else {
                             $task["param_name_" . $index] = $pName;
                             $task["param_value_" . $index] = $pValue;
                         }
                         $index++;
                     }
                     unset($task["PARAMS"]);
                     if (strpos($task["repository_id"], ",") !== false) {
                         $ids = explode(",", $task["repository_id"]);
                         $task["repository_id"] = $ids[0];
                         for ($i = 1; $i < count($ids); $i++) {
                             $task["repository_id_" . $i] = $ids[$i];
                         }
                     }
                     break;
                 }
             }
             if ($found) {
                 HTMLWriter::charsetHeader("application/json");
                 echo json_encode($task);
             }
             break;
         default:
             break;
     }
     //var_dump($tasks);
 }
开发者ID:rbrdevs,项目名称:pydio-core,代码行数:100,代码来源:class.AjxpScheduler.php

示例5: createBootstrapConf

 /**
  * Create or update the bootstrap json file.
  * @param Array $data Parsed result of the installer form
  * @return array 2 entries array containing the new Conf Driver (0) and Auth Driver (1)
  * @throws Exception
  */
 public function createBootstrapConf($data)
 {
     // Create a custom bootstrap.json file
     $coreConf = array();
     $coreAuth = array();
     $coreCache = array();
     $this->_loadPluginConfig("core.conf", $coreConf);
     $this->_loadPluginConfig("core.auth", $coreAuth);
     $this->_loadPluginConfig("core.cache", $coreCache);
     if (!isset($coreConf["UNIQUE_INSTANCE_CONFIG"])) {
         $coreConf["UNIQUE_INSTANCE_CONFIG"] = array();
     }
     if (!isset($coreAuth["MASTER_INSTANCE_CONFIG"])) {
         $coreAuth["MASTER_INSTANCE_CONFIG"] = array();
     }
     if (!isset($coreCache["UNIQUE_INSTANCE_CONFIG"])) {
         $coreCache["UNIQUE_INSTANCE_CONFIG"] = array();
     }
     $coreConf["AJXP_CLI_SECRET_KEY"] = AJXP_Utils::generateRandomString(24, true);
     // REWRITE BOOTSTRAP.JSON
     $coreConf["DIBI_PRECONFIGURATION"] = $data["db_type"];
     if (isset($coreConf["DIBI_PRECONFIGURATION"]["sqlite3_driver"])) {
         $dbFile = AJXP_VarsFilter::filter($coreConf["DIBI_PRECONFIGURATION"]["sqlite3_database"]);
         if (!file_exists(dirname($dbFile))) {
             mkdir(dirname($dbFile), 0755, true);
         }
     }
     $coreConf["UNIQUE_INSTANCE_CONFIG"] = array_merge($coreConf["UNIQUE_INSTANCE_CONFIG"], array("instance_name" => "conf.sql", "group_switch_value" => "conf.sql", "SQL_DRIVER" => array("core_driver" => "core", "group_switch_value" => "core")));
     $coreAuth["MASTER_INSTANCE_CONFIG"] = array_merge($coreAuth["MASTER_INSTANCE_CONFIG"], array("instance_name" => "auth.sql", "group_switch_value" => "auth.sql", "SQL_DRIVER" => array("core_driver" => "core", "group_switch_value" => "core")));
     $coreCache["UNIQUE_INSTANCE_CONFIG"] = array_merge($coreCache["UNIQUE_INSTANCE_CONFIG"], array());
     // DETECT REQUIRED SQL TABLES AND INSTALL THEM
     $registry = AJXP_PluginsService::getInstance()->getDetectedPlugins();
     $driverData = array("SQL_DRIVER" => $data["db_type"]);
     foreach ($registry as $type => $plugins) {
         foreach ($plugins as $plugObject) {
             if ($plugObject instanceof SqlTableProvider) {
                 $plugObject->installSQLTables($driverData);
             }
         }
     }
     $oldBoot = $this->getPluginWorkDir(true) . "/bootstrap.json";
     if (is_file($oldBoot)) {
         copy($oldBoot, $oldBoot . ".bak");
         unlink($oldBoot);
     }
     $newBootstrap = array("core.conf" => $coreConf, "core.auth" => $coreAuth, "core.cache" => $coreCache);
     AJXP_Utils::saveSerialFile($oldBoot, $newBootstrap, true, false, "json", true);
     // Write new bootstrap and reload conf plugin!
     $coreConf["UNIQUE_INSTANCE_CONFIG"]["SQL_DRIVER"] = $coreConf["DIBI_PRECONFIGURATION"];
     $coreAuth["MASTER_INSTANCE_CONFIG"]["SQL_DRIVER"] = $coreConf["DIBI_PRECONFIGURATION"];
     $newConfigPlugin = ConfService::instanciatePluginFromGlobalParams($coreConf["UNIQUE_INSTANCE_CONFIG"], "AbstractConfDriver");
     $newAuthPlugin = ConfService::instanciatePluginFromGlobalParams($coreAuth["MASTER_INSTANCE_CONFIG"], "AbstractAuthDriver");
     $newCachePlugin = ConfService::instanciatePluginFromGlobalParams($coreCache["UNIQUE_INSTANCE_CONFIG"], "AbstractCacheDriver");
     $sqlPlugs = array("core.notifications/UNIQUE_FEED_INSTANCE" => "feed.sql", "core.log/UNIQUE_PLUGIN_INSTANCE" => "log.sql", "core.mq/UNIQUE_MS_INSTANCE" => "mq.sql");
     foreach ($sqlPlugs as $core => $value) {
         list($pluginId, $param) = explode("/", $core);
         $options = array();
         $newConfigPlugin->_loadPluginConfig($pluginId, $options);
         $options[$param] = array("instance_name" => $value, "group_switch_value" => $value, "SQL_DRIVER" => array("core_driver" => "core", "group_switch_value" => "core"));
         $newConfigPlugin->_savePluginConfig($pluginId, $options);
     }
     return array($newConfigPlugin, $newAuthPlugin, $newCachePlugin);
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:69,代码来源:class.BootConfLoader.php

示例6: saveTemporaryData

 function saveTemporaryData($key, $value)
 {
     $fastCheck = $this->storage->getOption("FAST_CHECKS");
     $fastCheck = $fastCheck == "true" || $fastCheck == true;
     return AJXP_Utils::saveSerialFile($this->storage->getOption("USERS_DIRPATH") . "/" . $this->getId() . "/" . $key . ".ser", $value, !$fastCheck);
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:6,代码来源:class.AJXP_User.php

示例7: saveTemporaryData

 /**
  * Save Temporary Data.
  * Implementation uses serialised files because of the overhead incurred with a full db implementation.
  *
  * @param $key String key of data to save.
  * @param $value Value to save
  */
 public function saveTemporaryData($key, $value)
 {
     $dirPath = $this->storage->getOption("USERS_DIRPATH");
     if ($dirPath == "") {
         $dirPath = AJXP_INSTALL_PATH . "/data/users";
         AJXP_Logger::info(__CLASS__, "setTemporaryData", array("Warning" => "The conf.sql driver is missing a mandatory option USERS_DIRPATH!"));
     }
     $id = AuthService::ignoreUserCase() ? strtolower($this->getId()) : $this->getId();
     AJXP_Utils::saveSerialFile($dirPath . "/" . $id . "/temp-" . $key . ".ser", $value);
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:17,代码来源:class.AJXP_SqlUser.php

示例8: storeToPluginQueriesCache

 public function storeToPluginQueriesCache($key, $value)
 {
     if (AJXP_SKIP_CACHE) {
         return;
     }
     $test = AJXP_Utils::loadSerialFile(AJXP_PLUGINS_QUERIES_CACHE);
     if (!is_array($test)) {
         $test = array();
     }
     $test[$key] = $value;
     AJXP_Utils::saveSerialFile(AJXP_PLUGINS_QUERIES_CACHE, $test);
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:12,代码来源:class.AJXP_PluginsService.php

示例9: setTokens

 public function setTokens($oauth_tokens)
 {
     $repositoryId = $this->repository->getId();
     if (AuthService::usersEnabled()) {
         $userId = AuthService::getLoggedUser()->getId();
     } else {
         $userId = "shared";
     }
     return AJXP_Utils::saveSerialFile(AJXP_DATA_PATH . "/plugins/access.dropbox/" . $repositoryId . "_" . $userId . "_tokens", $oauth_tokens, true);
 }
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:10,代码来源:class.dropboxAccessDriver.php

示例10: deleteRepository

 /**
  * Delete a repository, given its unique ID.
  *
  * @param String $repositoryId
  */
 function deleteRepository($repositoryId)
 {
     $repositories = AJXP_Utils::loadSerialFile($this->repoSerialFile);
     $newList = array();
     foreach ($repositories as $repo) {
         if ($repo->getUniqueId() != $repositoryId) {
             $newList[$repo->getUniqueId()] = $repo;
         }
     }
     AJXP_Utils::saveSerialFile($this->repoSerialFile, $newList);
 }
开发者ID:pussbb,项目名称:CI_DEV_CMS,代码行数:16,代码来源:class.serialConfDriver.php

示例11: saveTemporaryData

 /**
  * Save Temporary Data.
  * Implementation uses serialised files because of the overhead incurred with a full db implementation.
  * 
  * @param $key String key of data to save.
  * @param $value Value to save
  * @return null (AJXP_Utils::saveSerialFile() returns nothing)
  */
 function saveTemporaryData($key, $value)
 {
     return AJXP_Utils::saveSerialFile(INSTALL_PATH . "/server/users/" . $this->getId() . "-temp-" . $key . ".ser", $value);
 }
开发者ID:umbecr,项目名称:camilaframework,代码行数:12,代码来源:class.AJXP_User.php

示例12: saveCounters

 private static function saveCounters($counters)
 {
     self::$counters = $counters;
     AJXP_Utils::saveSerialFile(PUBLIC_DOWNLOAD_FOLDER . "/.ajxp_publiclet_counters.ser", $counters, false);
 }
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:5,代码来源:class.PublicletCounter.php

示例13: setTokens

 function setTokens($repositoryId, $oauth_tokens)
 {
     return AJXP_Utils::saveSerialFile(AJXP_DATA_PATH . "/plugins/access.dropbox/" . $repositoryId . "_tokens", $oauth_tokens, true);
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:4,代码来源:class.dropboxAccessDriver.php

示例14: cachePlugSort

 /**
  * Save the plugins order in a cache
  *
  * @param array $sortedPlugins
  * @return bool|void
  */
 private function cachePlugSort($sortedPlugins)
 {
     if (!AJXP_PLUGINS_CACHE_FILE) {
         return false;
     }
     $indexes = array();
     $i = 0;
     foreach ($sortedPlugins as $plugin) {
         $indexes[$i] = $plugin->getId();
         $i++;
     }
     AJXP_Utils::saveSerialFile(AJXP_PLUGINS_CACHE_FILE, $indexes, false, true);
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:19,代码来源:class.AJXP_PluginsService.php

示例15: _savePluginConfig

 /**
  * @param String $pluginId
  * @param String $options
  */
 public function _savePluginConfig($pluginId, $options)
 {
     $jsonPath = $this->getPluginWorkDir(true) . "/bootstrap.json";
     $jsonData = AJXP_Utils::loadSerialFile($jsonPath, false, "json");
     if (!is_array($jsonData)) {
         $jsonData = array();
     }
     $jsonData[$pluginId] = $options;
     if ($pluginId == "core.conf" || $pluginId == "core.auth") {
         $testKey = $pluginId == "core.conf" ? "UNIQUE_INSTANCE_CONFIG" : "MASTER_INSTANCE_CONFIG";
         $current = array();
         $this->_loadPluginConfig($pluginId, $current);
         if (isset($current[$testKey]["instance_name"]) && $current[$testKey]["instance_name"] != $options[$testKey]["instance_name"]) {
             $forceDisconnexion = $pluginId;
         }
     }
     if (file_exists($jsonPath)) {
         copy($jsonPath, $jsonPath . ".bak");
     }
     AJXP_Utils::saveSerialFile($jsonPath, $jsonData, true, false, "json", true);
     if (isset($forceDisconnexion)) {
         if ($pluginId == "core.conf") {
             // DISCONNECT
             AuthService::disconnect();
         } else {
             if ($pluginId == "core.auth") {
                 // DELETE admin_counted file and DISCONNECT
                 @unlink(AJXP_CACHE_DIR . "/admin_counted");
             }
         }
     }
 }
开发者ID:rbrdevs,项目名称:pydio-core,代码行数:36,代码来源:class.BootConfLoader.php


注:本文中的AJXP_Utils::saveSerialFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。