[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Shared utility functions for session handlers. 19 * 20 * This contains functions that are shared between two or more handlers. 21 * 22 * @package core 23 * @copyright 2014 The Open University 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 27 namespace core\session; 28 29 defined('MOODLE_INTERNAL') || die(); 30 31 /** 32 * Shared utility functions for session handlers. 33 * 34 * This contains functions that are shared between two or more handlers. 35 * 36 * @package core 37 * @copyright 2014 The Open University 38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 39 */ 40 abstract class util { 41 /** 42 * Convert a connection string to an array of servers 43 * 44 * EG: Converts: "abc:123, xyz:789" to 45 * 46 * array( 47 * array('abc', '123'), 48 * array('xyz', '789'), 49 * ) 50 * 51 * @copyright 2013 Moodlerooms Inc. (http://www.moodlerooms.com) 52 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 53 * @author Mark Nielsen 54 * 55 * @param string $str save_path value containing memcached connection string 56 * @return array 57 */ 58 public static function connection_string_to_memcache_servers($str) { 59 $servers = array(); 60 $parts = explode(',', $str); 61 foreach ($parts as $part) { 62 $part = trim($part); 63 $pos = strrpos($part, ':'); 64 if ($pos !== false) { 65 $host = substr($part, 0, $pos); 66 $port = substr($part, ($pos + 1)); 67 } else { 68 $host = $part; 69 $port = 11211; 70 } 71 $servers[] = array($host, $port); 72 } 73 return $servers; 74 } 75 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |