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


PHP D::clear_cache方法代码示例

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


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

示例1: sync

 /**
  * Checks for differences in mapping information compared to the database, and creates a migration if there are any
  * 
  * @param  string $name Name of module or package, unless this is just an 'app' migration
  * @param  string $type Type of migration - 'app', 'module' or 'package'
  * @return void
  */
 public static function sync($name = 'default', $type = 'app', $run = false, $reset = false)
 {
     try {
         set_time_limit(0);
         ignore_user_abort(true);
         ini_set('memory_limit', '256M');
     } catch (\Exception $e) {
         // Nothing!
     }
     \Config::load("db", true, true);
     \D::$clear_cache = true;
     $em = \D::manager();
     $files = glob(APPPATH . "migrations/*_*.php");
     if ($reset) {
         $files[] = APPPATH . 'config/development/migrations.php';
         $files[] = APPPATH . 'config/production/migrations.php';
         $files[] = APPPATH . 'config/staging/migrations.php';
         foreach ($files as $file) {
             try {
                 \File::delete($file);
             } catch (\Exception $e) {
             }
         }
         $files = array();
         \Config::load('migrations', true, true);
     }
     // This will create the migrations table if necessary
     Migrate::_init();
     $last_file = end($files);
     if ($last_file) {
         // Try and find the last file migration in the DB
         $last_name = basename($last_file, ".php");
         $migration_table = \Config::get('migrations.table', 'migration');
         $last_migration = \DB::query("SELECT migration FROM {$migration_table} WHERE type = '{$type}' AND name = '{$name}' AND migration = '{$last_name}'")->execute();
         if (count($last_migration) === 0) {
             if (\Fuel::$is_cli && \Cli::prompt('You have previous migrations to run - you must run these before generating a new one. Continue?', array('y', 'n')) == 'y') {
                 \Cli::write("\tRunning previous migrations...", 'green');
                 Migrate::latest($name, $type);
             } else {
                 return array('error' => 'There are previous migrations to run - please do this first before syncing.');
             }
         }
     }
     $diff = static::getDiff();
     if (array_key_exists('error', $diff)) {
         if (\Fuel::$is_cli) {
             \Cli::write($diff['error'], 'red');
             return;
         } else {
             return $diff;
         }
     }
     static::generateMigration($diff['up'], $diff['down']);
     if (\Fuel::$is_cli && ($run === true || \Cli::prompt('Would you like to run the new migration now?', array('y', 'n')) == 'y') || !\Fuel::$is_cli && $run) {
         Migrate::latest($name, $type);
         static::createAllStaticInstances();
     }
     return array('success' => 'The sync was completed and all migrations performed successfully');
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:66,代码来源:Project.php


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