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


PHP CMS::cached_run方法代码示例

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


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

示例1: setup

 public function setup()
 {
     foreach (array('Dir', 'String', 'Textarea', 'HTML', 'WIKI', 'Content', 'Array', 'File', 'Image', 'Gallery', 'YesNo') as $type) {
         self::register_type(strtolower($type), "CMS.Vars2.Type.{$type}");
     }
     //Core::load('CMS.Vars2.Init'); CMS_Vars2_Init::run();
     CMS::cached_run('CMS.Vars2.Init');
 }
开发者ID:techart,项目名称:tao,代码行数:8,代码来源:Vars2.php

示例2: initialize

 /**
  * @param array $config
  */
 static function initialize($config = array())
 {
     self::$files_dir = './' . Core::option('files_name') . '/vars';
     foreach ($config as $key => $value) {
         self::${$key} = $value;
     }
     Core::load('CMS.Vars.Types');
     if (self::$type == 'orm') {
         Core::load('CMS.Vars.ORM');
         WS::env()->orm->submapper('vars', 'CMS.Vars.ORM.Mapper');
     }
     if (self::$type == 'storage') {
         Core::load('Storage');
         Storage::manager()->add('vars', 'CMS.Vars.Storage');
     }
     CMS::cached_run('CMS.Vars.Schema');
     self::register_type('CMS.Vars.Types.Dir', 'CMS.Vars.Types.Integer', 'CMS.Vars.Types.String', 'CMS.Vars.Types.Text', 'CMS.Vars.Types.Html', 'CMS.Vars.Types.Array', 'CMS.Vars.Types.Mail', 'CMS.Vars.Types.HtmlP', 'CMS.Vars.Types.File');
     CMS_Dumps::dumper('VARS', 'CMS.Dumps.Vars');
 }
开发者ID:techart,项目名称:tao,代码行数:22,代码来源:Vars.php

示例3: process_schema

 public function process_schema()
 {
     // process schema modules
     $modules = $this->schema_modules();
     if (!empty($modules)) {
         foreach ($modules as $name => $module) {
             CMS::cached_run($module);
         }
     }
     // get data from config
     $schema = $this->config('schema');
     $fields = $this->config('fields');
     $tmp1 = (array) $schema;
     $tmp2 = (array) $fields;
     if (empty($tmp1) && empty($tmp2)) {
         return;
     }
     if (empty($fields)) {
         $fields = Core::hash();
     }
     $schema = clone $schema;
     // some time we have fields without info in schema
     // fix it
     $schema_keys = array_keys((array) $schema);
     $fields_keys = array_keys((array) $fields);
     $diff = array_diff($fields_keys, $schema_keys);
     foreach ($diff as $name) {
         $schema->{$name} = array();
     }
     //fields to schema
     Core::load('DB.Schema');
     Core::load('CMS.Fields');
     foreach ($schema as $name => &$table) {
         if (!empty($fields->{$name})) {
             $table_fields = $fields->{$name};
             $table_name = $name;
             CMS_Fields::fields_to_schema($fields->{$name}, $name, $table);
             Events::add_once('db.schema.after_execute.' . $name, function ($tf_schema) use($table_fields, $table_name) {
                 foreach ($table_fields as $tf_name => $tf_data) {
                     $tf_type = CMS_Fields::type($tf_data);
                     $tf_type->process_schema($tf_name, $tf_data, $table_name, $table_fields);
                 }
             });
         }
     }
     // remove empty values
     foreach ($schema as $name => $ttable) {
         if (empty($ttable)) {
             unset($schema->{$name});
         }
     }
     // cache
     $cname = strtolower($this->get_name());
     if (!empty($cname)) {
         $cache_key = 'cms:component:' . $cname . ':schema:' . md5(serialize($schema));
         if ($this->cache->has($cache_key)) {
             return $this;
         }
         $this->cache->set($cache_key, 1, 0);
     }
     // run
     DB_Schema::process_cache($schema);
 }
开发者ID:techart,项目名称:tao,代码行数:63,代码来源:Component.php

示例4: get_call_time

 static function get_call_time($name)
 {
     static $schema_checked = false;
     if (!$schema_checked) {
         CMS::cached_run('CMS.Schema.CLI');
         $schema_checked = true;
     }
     $row = CMS::orm()->connection->prepare('SELECT * FROM tao_cli_calls WHERE name=:name ORDER BY time desc LIMIT 1')->bind(array('name' => $name))->execute()->fetch();
     if (!$row) {
         return 0;
     }
     return $row['time'];
 }
开发者ID:techart,项目名称:tao,代码行数:13,代码来源:CLI.php


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