コード例 #1
0
 /**
  * Returns a singleton instance
  *
  * @return Cache_Redis
  * @access public
  */
 public static function &getInstance()
 {
     if (!isset(self::$_instances[0]) || !self::$_instances[0]) {
         self::$_instances[0] = Cache::factory('redis');
     }
     return self::$_instances[0];
 }
コード例 #2
0
ファイル: Welcome.php プロジェクト: adawongframework/project
 /**
  * 缓存
  *+----
  */
 public function action_cache()
 {
     $cache = Cache::factory('file');
     //获取一个文件缓存实例
     //$cache->set('name', time(), 60); //设置有效期60s
     echo $cache->get('name');
     //$cache->del('name');
 }
コード例 #3
0
ファイル: CacheFilter.class.php プロジェクト: ruxon/framework
 public function run(FilterChain $oFilterChain)
 {
     $aDb = Core::app()->config()->getCache();
     foreach ($aDb as $k => $val) {
         Manager::getInstance()->getCache()->add(Cache::factory($val['Driver'], $val['Params']), $k);
     }
     $oFilterChain->next();
 }
コード例 #4
0
ファイル: App.php プロジェクト: nylmarcos/estagio
 /**
  * Contrutor da classe
  * @param	string	$url	url acessada pelo usuário
  */
 public function __construct($url)
 {
     define('CACHE_TIME', 60);
     $cache_config = Config::get('cache');
     if ($cache_config['page']) {
         $cache = Cache::factory();
         if ($cache->has(URL)) {
             $data = $cache->read(URL);
             exit($data);
         }
     }
     $registry = Registry::getInstance();
     $this->args = $this->args($url);
     //I18n
     define('lang', $this->args['lang']);
     define('LANG', $this->args['lang']);
     $i18n = I18n::getInstance();
     $i18n->setLang(LANG);
     $registry->set('I18n', $i18n);
     function __($string, $format = null)
     {
         return I18n::getInstance()->get($string, $format);
     }
     function _e($string, $format = null)
     {
         echo I18n::getInstance()->get($string, $format);
     }
     define('controller', Inflector::camelize($this->args['controller']) . 'Controller');
     define('action', str_replace('-', '_', $this->args['action']));
     define('CONTROLLER', Inflector::camelize($this->args['controller']) . 'Controller');
     define('ACTION', str_replace('-', '_', $this->args['action']));
     try {
         header('Content-type: text/html; charset=' . Config::get('charset'));
         Import::core('Controller', 'Template', 'Annotation');
         Import::controller(CONTROLLER);
         $this->controller();
         $this->auth();
         $tpl = new Template();
         $registry->set('Template', $tpl);
         $tpl->render($this->args);
         if ($cache_config['page']) {
             $cache = Cache::factory();
             $data = ob_get_clean();
             $cache->write(URL, $data, $cache_config['time']);
         }
         Debug::show();
     } catch (PageNotFoundException $e) {
         header('HTTP/1.1 404 Not Found');
         $this->loadError($e);
         exit;
     } catch (Exception $e) {
         header('HTTP/1.1 500 Internal Server Error');
         $this->loadError($e);
     }
 }
コード例 #5
0
ファイル: cache.php プロジェクト: Sywooch/dobox
 /**
  * @param string имя драйвера кеша
  * @param mixed false или array()
  * @return Cache объект
  */
 static function &singleton($driver = 'apc', $init = true)
 {
     static $instances = array();
     $signature = serialize(array($driver, $init));
     if (empty($instances[$signature])) {
         $instances[$signature] = Cache::factory($driver);
         if ($init !== false) {
             $instances[$signature]->init($init);
         }
     }
     return $instances[$signature];
 }
コード例 #6
0
ファイル: i18n.php プロジェクト: pihizi/qf
 static function load_domain($domain)
 {
     if (!isset(self::$items[$domain])) {
         $cache = Cache::factory();
         $locale = self::$locale;
         $cache_key = "i18n/{$locale}/{$domain}";
         $lang = Config::get('debug.i18n_nocache') ? false : $cache->get($cache_key);
         if ($lang === false) {
             $lang = array();
             foreach (array_reverse(Core::file_paths(I18N_BASE . $locale . EXT, $domain)) as $path) {
                 !file_exists($path) or @(include $path);
             }
             $cache->set($cache_key, $lang);
         }
         self::$items[$domain] = (array) $lang;
     }
 }
コード例 #7
0
ファイル: Annotation.php プロジェクト: nylmarcos/estagio
        $key = 'Trilado.Annotation.Property.' . $this->classname . '->' . $property;
        $cache = Cache::factory();
        if (Debug::enabled() && $cache->has($key)) {
            return $cache->read($key);
        } else {
            $reflection = new ReflectionProperty($this->classname, $property);
            $comment = $reflection->getDocComment();
            $annotation = $this->extractAnnotation($comment);
            $cache->write($key, $annotation, CACHE_TIME);
            return $annotation;
        }
    }
    /**
	 * Pega a anotação todas as propriedades da classe
	 * @return	array	lista com instâncias de sdtClass
	 */
    public function getProperties()
    {
コード例 #8
0
ファイル: q.php プロジェクト: pihizi/qf
 function parse()
 {
     if (!$this->_is_parsed) {
         $cache_data = false;
         $cache_key = Misc::key('Q:', $this->selector);
         $cache = Cache::factory();
         if (!Config::get('debug.Q_nocache', FALSE)) {
             $cache_data = $cache->get($cache_key);
         }
         if (false === $cache_data) {
             $query = $this->parse_selector();
             $cache_data = array('name' => $query->name, 'SQL' => $query->SQL, 'count_SQL' => $query->count_SQL, 'sum_SQL' => $query->sum_SQL);
             if ($cache) {
                 $cache->set($cache_key, $cache_data);
             }
         }
         $this->SQL = $cache_data['SQL'];
         $this->count_SQL = $cache_data['count_SQL'];
         $this->sum_SQL = $cache_data['sum_SQL'];
         $this->_is_parsed = TRUE;
         $this->name = $cache_data['name'];
     }
 }
コード例 #9
0
ファイル: I18n.php プロジェクト: nylmarcos/estagio
 /**
  * Carrega um arquivo de tradução pegando as mensagens e traduções e joga em array retornando-o
  * @param	string	$lang		nome do arquivo
  * @throws	TriladoException	disparada caso o arquivo não exista ou o conteúdo esteja vazio
  * @return	array				retorna um array com as mensagens de tradução, sendo as chaves o MD5 da mensagem original
  */
 private function load($lang)
 {
     $key = 'Trilado.I18n.' . $lang;
     $cache = Cache::factory();
     if ($cache->has($key)) {
         return $cache->read($key);
     }
     $file_path = ROOT . 'app/i18n/' . $lang . '.lang';
     if (!file_exists($file_path)) {
         throw new FileNotFoundException($file_path);
     }
     $lines = file($file_path);
     if (!count($lines)) {
         throw new TriladoException('Arquivo "' . $file_path . '" está vazio');
     }
     $key = false;
     $result = array();
     foreach ($lines as $line) {
         $line = trim($line);
         if (preg_match('@^(msgid|msgstr)@', $line)) {
             if (preg_match('/^msgid "(.+)"/', $line, $match)) {
                 $key = md5($match[1]);
             } elseif (preg_match('/^msgstr "(.+)"/', $line, $match)) {
                 if (!$key) {
                     throw new TriladoException('Erro de sintax no arquivo "' . $file_path . '" na linha "' . $match[1] . '"');
                 }
                 $result[$key] = $match[1];
                 $key = false;
             }
         }
     }
     foreach ($this->hook as $hook) {
         $result = $hook->load($result);
     }
     $cache->write($key, $result, CACHE_TIME);
     return $result;
 }
コード例 #10
0
 public function getCache($which)
 {
     // do we already have the cache object in the Registry ?
     if (Registry::isRegistered('cache_' . $which)) {
         return Registry::get('cache_' . $which);
     } else {
         // get the config for our cache object
         $config = Registry::get('config');
         if (isset($config->cache->{$which}->handler)) {
             $cache = Cache::factory($config->cache->{$which}->handler, isset($config->cache->{$which}->params) ? $config->cache->{$which}->params : array(), isset($config->cache->{$which}->lifetime) ? $config->cache->{$which}->lifetime : Cache::DEFAULT_LIFETIME);
             return $cache;
         } else {
             throw new Exception('The cache handler "' . $which . '" is not set in config file');
         }
     }
 }
コード例 #11
0
ファイル: run.php プロジェクト: Spark-Eleven/revive-adserver
define('CACHE_EXIT_ON_ERROR', true);
error_reporting(E_ALL);
// number of iterations
define('TEST_ITERATIONS', 100);
// how many reads should be performed per each set/update
define('TEST_READS', 1);
require "Benchmark/Timer.php";
require 'testCases/Cache.php';
$t = new Benchmark_Timer();
$t->start();
$aTests = array(25, 50, 75, 100);
$t->setMarker('Script init');
foreach ($aTests as $concurrency) {
    $oTest = Cache::factory(array('type' => 'memcached', 'host' => '127.0.0.1', 'port' => 11211));
    test_update($oTest, $concurrency, $t, 'MEMCACHED ');
    $oTest = Cache::factory(array('type' => 'sharedance', 'host' => 'localhost'));
    test_update($oTest, $concurrency, $t, 'SHAREDANCE');
}
$t->stop();
$t->display();
exit;
function test_update($oTest, $concurrency, $t, $text)
{
    $oTest->disconnect();
    $oTest->invalidateAll();
    $oTest->init($concurrency, TEST_ITERATIONS);
    for ($c = 0; $c < $concurrency; $c++) {
        mt_srand(1000 + $c);
        $pid = pcntl_fork();
        if ($pid == 0) {
            $oTest->connect();
コード例 #12
0
ファイル: Gear.php プロジェクト: brussens/cogear2
 /**
  * Конструктор
  */
 public function __construct($config)
 {
     parent::__construct($config);
     hook('preload', array($this, 'hookPreload'));
     $this->object(Cache::factory('normal', config('cache')));
 }
コード例 #13
0
ファイル: zula.php プロジェクト: jinshana/tangocms
 /**
  * Loads the default most commonly used libraries for the framework
  *
  * @return object
  */
 public function loadDefaultLibs()
 {
     $config = Registry::get('config');
     foreach ($this->defaultLibs as $library) {
         if ($library == 'cache') {
             try {
                 $cache = Cache::factory($config->get('cache/type'));
             } catch (Config_KeyNoExist $e) {
                 // Revert to file based caching.
                 $cache = Cache::factory('file');
             }
             try {
                 $cache->ttl($config->get('cache/ttl'));
             } catch (Exception $e) {
             }
         } else {
             if ($library == 'i18n') {
                 try {
                     I18n::factory($config->get('locale/engine'));
                 } catch (Config_KeyNoExist $e) {
                     I18n::factory('failsafe');
                 }
             } else {
                 $this->loadLib($library);
             }
         }
     }
     return $this;
 }
コード例 #14
0
ファイル: Import.php プロジェクト: nylmarcos/estagio
 /**
  * Função que importa classes automaticamente, baseado nos diretórios 
  * registrados pelo método Import::register($dir).
  * @param	string	$class	Nome da classe a ser carregada.
  * @return	void
  */
 public static function autoload($class)
 {
     $key = 'Trilado.Import.Files';
     $cache = Cache::factory();
     if ($cache->has($key)) {
         $files = $cache->read($key);
         if (isset($files[$class])) {
             require_once $files[$class];
             return;
         }
     }
     foreach (self::$directories as $dir) {
         $file = ROOT . $dir . $class . '.php';
         if (file_exists($file)) {
             require_once $file;
             $files = $cache->read($key);
             if ($files === false) {
                 $files = array();
             }
             $files[$class] = $file;
             $cache->write($key, $files, CACHE_TIME);
             return;
         }
     }
 }
コード例 #15
0
 /**
  * 获取用户信息
  *
  * @param int $userid 用户 id
  * @param array $column 列
  */
 public static function getUser($userid, $column = array())
 {
     $ret = array('id', 'userid', 'pwd', 'kid', 'mobile', 'email', 'status', 'regtime', 'regip', 'logintime', 'loginip', 'login_nums');
     $ret = array_merge($ret, $column);
     /*$select = Da_Wrapper::select()
     			->table(self::DB_TABLE_USER)
     			->columns($ret)
     			->where('id', $userid);
     
     		return $select->getRow();*/
     $cache = Cache::factory();
     $key = 'user_' . $userid;
     $cacheData = $cache->get($key);
     if (false == $cacheData) {
         $select = Da_Wrapper::select()->table(self::DB_TABLE_USER)->where('id', $userid)->getRow();
         $cache->set($key, $select);
     } else {
         $select = $cacheData;
     }
     foreach ($select as $key => $value) {
         if (false == in_array($key, $ret)) {
             unset($select[$key]);
         }
     }
     return $select;
 }
コード例 #16
0
ファイル: trace.php プロジェクト: brussens/cogear2
<?php

$caches = array();
foreach (array('system', 'normal') as $cache) {
    $caches[$cache] = Cache::factory($cache)->stats;
}
echo '<br/>' . t('<b>Кэшировние:</b> ');
foreach ($caches as $name => $results) {
    echo '' . $name . ' <span title="' . t('Чтение/Запись') . '">(' . $results->read . '/' . $results->write . ')</span> ';
}
コード例 #17
0
ファイル: core.php プロジェクト: pihizi/qf
 static function autoload($class)
 {
     //定义类后缀与类路径的对应关系
     static $CLASS_BASES = array(MODEL_SUFFIX => MODEL_BASE, WIDGET_SUFFIX => WIDGET_BASE, CONTROLLER_SUFFIX => CONTROLLER_BASE, AJAX_SUFFIX => CONTROLLER_BASE, '*' => LIBRARY_BASE);
     static $CLASS_PATTERN;
     if ($CLASS_PATTERN === NULL) {
         $SUFFIX1 = CONTROLLER_SUFFIX . '|' . AJAX_SUFFIX . '|' . VIEW_SUFFIX;
         $SUFFIX2 = MODEL_SUFFIX . '|' . WIDGET_SUFFIX;
         $CLASS_PATTERN = "/^(_)?(\\w+?)(?:({$SUFFIX1})?|({$SUFFIX2})?)\$/i";
     }
     $class = strtolower($class);
     $nocache = FALSE;
     if (preg_match($CLASS_PATTERN, $class, $parts)) {
         list(, $is_core, $name, $suffix1, $suffix2) = $parts;
         if ($suffix1 != CONTROLLER_SUFFIX && isset($GLOBALS['class_map']) && is_array($GLOBALS['class_map'])) {
             $class_map = $GLOBALS['class_map'];
             if (isset($class_map[$class])) {
                 require_once $class_map[$class];
             }
             return;
         }
         if ($suffix1) {
             $bases = $CLASS_BASES[$suffix1];
             $need_traverse = FALSE;
             $nocache = TRUE;
         } elseif ($suffix2) {
             $bases = $CLASS_BASES[$suffix2];
             $need_traverse = TRUE;
         } else {
             $bases = $CLASS_BASES['*'];
             $need_traverse = TRUE;
         }
         $scope = $is_core ? 'system' : ($need_traverse ? '*' : NULL);
         if (!$nocache) {
             $cacher = Cache::factory();
             $cache_key = 'autoload_path:' . $class;
             $file = $cacher->get($cache_key);
             if ($file) {
                 require_once $file;
                 return;
             }
         }
         /*
         			多重路径寻址 A_B_C
         			a/b/c.php
         			a/b_c.php
         			a_b_c.php
         */
         $units = explode('_', $name);
         $paths[] = implode('/', $units);
         $rest = array_pop($units);
         while (count($units) > 0) {
             $paths[] = implode('/', $units) . '_' . $rest;
             $rest = array_pop($units) . '_' . $rest;
         }
         $file = Core::load($bases, $paths, $scope);
         if (class_exists($class, false)) {
             //缓冲类到文件的索引
             $nocache or $cacher->set($cache_key, $file);
         } elseif (!$is_core) {
             //如果不存在原始类 加载代用类
             $sub_paths = array();
             foreach ($paths as $path) {
                 $sub_paths[] = '@/' . $path;
             }
             $file = Core::load($bases, $sub_paths, 'system');
             if (!$nocache && class_exists($class, false)) {
                 $cacher->set($cache_key, $file);
             }
         }
     }
 }
コード例 #18
0
ファイル: Core.php プロジェクト: ktrzos/plethora
 /**
  * Function which starts web application.
  *
  * @static
  * @access   public
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public static function startApp()
 {
     if (!file_exists(PATH_APP)) {
         throw new \Exception('Application directory does not exist.');
     }
     // initialize basic functionalities
     Router::loadModulesList();
     DB::create();
     Cache::factory();
     Session::init();
     Router::factory();
     // 2nd mark added to global 'indexView::php' view
     Benchmark::mark('start');
     echo Router::getInstance()->executeAction();
 }
コード例 #19
0
ファイル: orm.php プロジェクト: pihizi/qf
 function fetch_data($criteria = null, $no_fetch = false)
 {
     if (!$criteria) {
         return;
     }
     $name = $this->name();
     $real_name = self::real_name($name);
     $real_names = array_diff(self::real_names($name), array($real_name));
     if ($no_fetch) {
         $data = (array) $criteria;
     } else {
         if (is_scalar($criteria)) {
             $criteria = array('id' => $criteria);
         }
         //如果传递了 id
         //尝试 cache 获取 $data
         if ($criteria['id'] && !in_array($this->name(), Config::get('nocache.models', []))) {
             $cache_data = Cache::factory()->get($this->cache_name($criteria['id']));
             if ($cache_data !== FALSE) {
                 $data = $cache_data;
             }
         }
         if (!$data) {
             $db = self::db($real_name);
             $this->encode_objects($criteria);
             //从数据库中获取该数据
             foreach ($criteria as $k => $v) {
                 $where[] = $db->quote_ident($k) . '=' . $db->quote($v);
             }
             $schema = self::schema($name);
             //从schema中得到fields,优化查询
             $fields = $schema['fields'] ? $db->quote_ident(array_keys($schema['fields'])) : $db->quote_ident('id');
             // SELECT * from a JOIN b, c ON b.id=a.id AND c.id = b.id AND b.attr_b='xxx' WHERE a.attr_a = 'xxx';
             $SQL = 'SELECT ' . $fields . ' FROM ' . $db->quote_ident($real_name) . ' WHERE ' . implode(' AND ', $where) . ' LIMIT 1';
             $result = $db->query($SQL);
             //只取第一条记录
             if ($result) {
                 $data = (array) $result->row('assoc');
             } else {
                 $data = array();
             }
             if ($data['id'] && !in_array($this->name(), Config::get('nocache.models', []))) {
                 Cache::factory()->set($this->cache_name($data['id']), $data);
             }
         }
     }
     $delete_me = FALSE;
     if ($data['id']) {
         $id = $data['id'];
     }
     if ($id && count($real_names) > 0) {
         foreach ($real_names as $rname) {
             $db = self::db($rname);
             $result = $db->query('SELECT * FROM `%s` WHERE `id`=%d', $rname, $id);
             $d = $result ? $result->row('assoc') : NULL;
             if ($d !== NULL) {
                 $data += $d;
             } else {
                 // 父类数据不存在
                 $delete_me = TRUE;
                 $delete_me_until = $rname;
                 //删除到该父类
                 break;
             }
         }
         if ($delete_me) {
             // 如果父类数据不存在 删除相关数据
             foreach ($real_names as $rname) {
                 if ($delete_me_until == $rname) {
                     break;
                 }
                 $db = self::db($rname);
                 $db->query('DELETE FROM `%s` WHERE `id`=%d', $rname, $id);
             }
             $data = array();
         }
     }
     //给object赋值
     $this->set_data($data);
 }
コード例 #20
0
ファイル: agent.php プロジェクト: novius/core
	/**
	 * download and parse the browscap file
	 *
	 * @return	array	array with parsed download info, or empty if the download is disabled of failed
	 */
	protected static function parse_browscap()
	{
		// get the browscap.ini file
		switch (static::$config['browscap']['method'])
		{
			case 'local':
				if ( ! file_exists(static::$config['browscap']['file']) or filesize(static::$config['browscap']['file']) == 0)
				{
					throw new \Exception('Agent class: could not open the local browscap.ini file.');
				}
				$data = @file_get_contents(static::$config['browscap']['file']);
			break;

			// socket connections are not implemented yet!
			case 'sockets':
				$data = false;
			break;

			case 'curl':
				$curl = curl_init();
				curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1);
				curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
				curl_setopt($curl, CURLOPT_MAXREDIRS, 5);
				curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
				curl_setopt($curl, CURLOPT_HEADER, 0);
				curl_setopt($curl, CURLOPT_USERAGENT, 'Fuel PHP framework - Agent class (http://fuelphp.com)');
				curl_setopt($curl, CURLOPT_URL, static::$config['browscap']['url']);
				$data = curl_exec($curl);
				curl_close($curl);
			break;

			case 'wrapper':
				ini_set('user_agent', 'Fuel PHP framework - Agent class (http://fuelphp.com)');
				$data = file_get_contents(static::$config['browscap']['url']);
			default:

			break;
		}

		if ($data === false)
		{
			logger(\Fuel::L_ERROR, 'Failed to download browscap.ini file.', 'Agent::parse_browscap');
		}

		// parse the downloaded data
		$browsers = @parse_ini_string($data, true, INI_SCANNER_RAW) or $browsers = array();

		// remove the version and timestamp entry
		array_shift($browsers);

		$result = array();

		// reverse sort on key string length
		uksort($browsers, function($a, $b) { return strlen($a) < strlen($b) ? 1 : -1; } );

		$index = array();
		$count = 0;

		// reduce the array keys
		foreach($browsers as $browser => $properties)
		{
			$index[$browser] = $count++;

			// fix any type issues
			foreach ($properties as $var => $value)
			{
				if (is_numeric($value))
				{
					$properties[$var] = $value + 0;
				}
				elseif ($value == 'true')
				{
					$properties[$var] = true;
				}
				elseif ($value == 'false')
				{
					$properties[$var] = false;
				}
			}

			$result[$browser] = \Arr::replace_keys($properties, static::$keys);

		}

		// reduce parent links to
		foreach($result as $browser => &$properties)
		{
			if (array_key_exists('Parent', $properties))
			{
				if ($properties['Parent'] == 'DefaultProperties')
				{
					unset($properties['Parent']);
				}
				else
				{
					if (array_key_exists($properties['Parent'], $index))
					{
						$properties['Parent'] = $index[$properties['Parent']];
					}
					else
					{
						throw new \Exception('Agent class: parse error in browsecap.ini file. Unknown parent reference detected for: '.$browser);
					}
				}
			}
		}

		// save the result to the cache
		if ( ! empty($result))
		{
			$cache = \Cache::factory(static::$config['cache']['identifier'].'.browscap');
			$cache->set($result, static::$config['cache']['expiry']);
		}

		return $result;
	}
コード例 #21
0
    echo "<div id=\"_bt_info\" style=\"text-align: justify;clear: both; margin: 5px;\">\n";
}
if (isset($g_timer) && class_exists('Benchmark_Timer', FALSE)) {
    $g_timer->stop();
    $g_timer->display();
    // to output html formated
}
if (isset($g_error_messages)) {
    echo "<!-- error_messages:\n", print_r($g_error_messages, true), "\n-->\n";
}
if (isset($g_log_queries)) {
    echo "<!-- log_queries:\n", print_r($g_log_queries, true), "\n-->\n";
}
echo "<!-- included:\n", print_r(get_included_files(), true), "\n-->\n";
if (class_exists('Cache', false)) {
    echo "<!-- cache:\n", htmlspecialchars(print_r(Cache::factory('all_instances'), true)), "\n-->\n";
}
if (class_exists('Da_Wrapper', false)) {
    echo "<!-- dbos\n";
    foreach (Da_Wrapper::getDbos() as $key => $dbo) {
        echo $key, ":\n";
        echo 'class: ', get_class($dbo), ":\n";
        print_r($dbo->errorInfo());
        if (property_exists($dbo, 'logs')) {
            echo 'logs:', PHP_EOL;
            print_r($dbo->logs);
        }
        //echo 'querynum: ', $dbo->querynum, ":\n";
        //print_r($dbo->queries);
    }
    echo "\n-->\n";
コード例 #22
0
ファイル: setup.php プロジェクト: jinshana/tangocms
<?php

/**
 * Zula Framework setup specific
 * Does specific tasks that may be needed, such as adding new config values that previous
 * versions of Zula may not have had (If you are upgrading, for example).
 *
 * @patches submit all patches to patches@tangocms.org
 *
 * @author Alex Cartwright
 * @author Robert Clipsham
 * @copyright Copyright (C) 2007, 2008, 2009, 2010 Alex Cartwright
 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU/LGPL 2.1
 * @package Zula_Install
 */
Registry::get('cache')->purge();
Registry::unregister('cache');
Cache::factory('disabled');
I18n::factory('gettext_php');
$config->update('config/title', sprintf(t('%s %s setup'), _PROJECT_NAME, _PROJECT_LATEST_VERSION));
$config->update('acl/enable', 0);
コード例 #23
0
 public static function authCode($account = '', $code = '', $type = '')
 {
     $return = self::checkCode($account, $code, $type);
     if (1 !== $return) {
         return $return;
     }
     $update = array('phone' => array('update' => array('mobile_status' => 1), 'where' => array('mobile' => $account)), 'email' => array('update' => array('email_status' => 1), 'where' => array('email' => $account)));
     $data['code'] = $code;
     $data['sms_id'] = $type;
     $data[$type] = $account;
     $time = time() - 15 * 60;
     if ($userid = Da_Wrapper::select()->table(self::DB_TABLE_MSM)->columns('id')->where($data)->where("crttime >= {$time}")->getOne()) {
         $reUpdate = Da_Wrapper::update()->table("sp.huitong.ht_users")->data($update[$type]['update'])->where($update[$type]['where'])->execute();
         $cache = Cache::factory();
         $key = 'user_' . $userid;
         $cache->delete($key);
         return $reUpdate ? 1 : false;
     } else {
         return false;
     }
 }