public function fire() { $clearAll = true; if ($this->input->getOption('config-only')) { $clearAll = false; Config::clearCache(); $this->info('Config cache cleared.'); } if ($this->input->getOption('meta-only')) { $clearAll = false; Db::clearMetadata(); $this->info('Model metadata cleared.'); } if ($this->input->getOption('locale-only')) { $clearAll = false; I18n::clearCache(); $this->info('Locale cache cleared.'); } if ($this->input->getOption('assets-only')) { $clearAll = false; View::clearAssetsCache(); $this->info('Assets cache cleared.'); } if ($clearAll) { Cache::flush(); Config::clearCache(); $this->info('Cache cleared.'); } Events::fire('cache:after_clear', $this); }
public function setUp() { parent::setUp(); Db::clearMetadata(); $this->di->set(Order::class, TestOrderModel::class); $this->di->set(OrderData::class, TestOrderDataModel::class); $this->getOrderModelInstance()->delete(); }
public function setUp() { parent::setUp(); Db::clearMetadata(); $this->di->set(User::class, TestUserModel::class); $this->di->set(UserProfile::class, TestUserProfileModel::class); $this->getUserModelInstance()->delete(); }
protected function revertMigration($filename) { $db = $this->db; $db->begin(); $file = migrationPath($filename); try { $this->logAndShowInfo(sprintf('Start reverting migration "%s"', $filename)); $migration = (include $file); if (isset($migration['down']) && is_callable($migration['down'])) { call_user_func($migration['down'], $db, $this); } $this->migrationExecuted($filename, false); $db->commit(); Db::clearMetadata(); $this->logAndShowInfo(sprintf('Finish reverting migration "%s"', $filename)); } catch (Exception $e) { $db->rollback(); Log::exception($e); $this->error(sprintf('Error when reverting migration "%s"', $filename)); $this->error($e->getMessage()); } // @codeCoverageIgnoreEnd }
protected function runMigration() { $db = $this->db; $migrated = false; foreach (glob(migrationPath('*.php')) as $file) { $filename = basename($file); if ($this->migrationExecuted($filename)) { continue; } $migrated = true; $this->logAndShowInfo(sprintf('Start migration "%s"', $filename)); $db->begin(); try { $migration = (include $file); if (isset($migration['up']) && is_callable($migration['up'])) { call_user_func($migration['up'], $db, $this); } $this->migrationExecuted($filename, true); $db->commit(); } catch (Exception $e) { $db->rollback(); Log::exception($e); $this->error(sprintf('Error in migration "%s"', $filename)); $this->error($e->getMessage()); return; } // @codeCoverageIgnoreEnd $this->logAndShowInfo(sprintf('Finish migration "%s"', $filename)); } if ($migrated) { Db::clearMetadata(); } else { $this->info('Nothing to be migrated.'); } // @codeCoverageIgnoreEnd }