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


PHP Kwf_Model_Abstract::clearInstances方法代码示例

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


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

示例1: initTestDb

 protected function initTestDb($bootstrapFile)
 {
     Kwf_Test_SeparateDb::createSeparateTestDb($bootstrapFile);
     $dbName = Kwf_Test_SeparateDb::getDbName();
     $this->createCookie('test_special_db=' . $dbName, 'path=/, max_age=60*5');
     Kwf_Registry::set('db', Kwf_Test::getTestDb($dbName));
     Kwf_Model_Abstract::clearInstances();
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:8,代码来源:SeleniumTestCase.php

示例2: setUp

 public function setUp()
 {
     parent::setUp();
     if (!Kwf_Registry::get('config')->amazon || !Kwf_Registry::get('config')->amazon->key) {
         $this->markTestSkipped();
     }
     sleep(1);
     Kwf_Model_Abstract::clearInstances();
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:9,代码来源:Test.php

示例3: tearDown

 public function tearDown()
 {
     Kwf_Events_ModelObserver::getInstance()->setSkipFnF(true);
     Kwf_Component_Data_Root::reset();
     Kwf_Component_Cache::clearInstance();
     Kwf_Model_Abstract::clearInstances();
     Kwf_Events_Dispatcher::clearCache();
     Kwf_Events_Subscriber::clearInstances();
     Kwf_Component_PagesMetaModel::clearInstance();
     Kwf_Trl::getInstance()->unsetTrlElements();
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:11,代码来源:TestCase.php

示例4: createSeparateTestDb

 /**
  * Muss im Test separat aufgerufen werden wenn für den Test eine eigene DB
  * benötigt wird
  */
 public static function createSeparateTestDb($bootstrapFile)
 {
     if (substr($bootstrapFile, 0, 1) != '/') {
         throw new Kwf_Exception("First argument 'bootstrapFile' must be an absolute path to the file");
     }
     $section = preg_replace('/[^a-zA-Z0-9]/', '', Kwf_Registry::get('config')->getSectionName());
     Kwf_Test_SeparateDb::$_dbName = 'test_' . $section . date('_Ymd_His_') . substr(uniqid(), -5);
     $testDb = Kwf_Test::getTestDb();
     $testDb->query('CREATE DATABASE ' . Kwf_Test_SeparateDb::getDbName());
     Kwf_Registry::set('db', Kwf_Test::getTestDb(Kwf_Test_SeparateDb::getDbName()));
     $ret = null;
     passthru('mysql ' . Kwf_Test_SeparateDb::getDbName() . ' < ' . $bootstrapFile, $ret);
     if ($ret != 0) {
         throw new Kwf_Exception("bootstrap file could not be processed through mysql");
     }
     Kwf_Model_Abstract::clearInstances();
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:21,代码来源:SeparateDb.php

示例5: _executeUpdatesAction

 private function _executeUpdatesAction($method)
 {
     $ret = true;
     foreach ($this->_updates as $update) {
         Kwf_Model_Abstract::clearInstances();
         //wegen eventueller meta-data-caches die sich geändert haben
         Kwf_Component_Generator_Abstract::clearInstances();
         Kwf_Component_Data_Root::reset();
         if ($this->_progressBar && $method == 'update') {
             $this->_progressBar->next(1, $update->getUniqueName());
         }
         $e = false;
         try {
             if (!$this->_verbose) {
                 ob_start();
                 //update script should not output anything, if it still does discard it
             }
             $update->{$method}();
             if (!$this->_verbose) {
                 ob_end_clean();
             }
         } catch (Exception $e) {
             if (!$this->_verbose) {
                 ob_end_clean();
             }
             if ($this->_debug) {
                 throw $e;
             }
             $this->_errors[] = array('name' => $update->getUniqueName(), 'message' => $e->getMessage());
             if ($this->_verbose) {
                 echo "\n[31mError:[0m\n";
                 echo $e->getMessage() . "\n\n";
                 flush();
             }
             $ret = false;
         }
     }
     return $ret;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:39,代码来源:Runner.php

示例6: testFindFeeds

 /**
  * @group slow
  */
 public function testFindFeeds()
 {
     Kwf_Model_Abstract::clearInstances();
     $m = Kwf_Model_Abstract::getInstance('Kwf_Util_Model_Feed_Feeds');
     /*
     $feeds = $m->findFeeds('http://www.prosalzburg.at');
     $this->assertEquals(1, count($feeds));
     $feeds = array_keys($feeds);
     $this->assertEquals('http://www.prosalzburg.at/news/feed', $feeds[0]);
     */
     $feeds = $m->findFeeds('http://www.heise.de');
     $this->assertEquals(2, count($feeds));
     $feeds = array_keys($feeds);
     $this->assertEquals('http://www.heise.de/newsticker/heise-atom.xml', $feeds[0]);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:18,代码来源:Test.php

示例7: runAction

 public function runAction()
 {
     $debug = $this->_getParam('debug');
     if (file_exists('temp/shutdown-maintenance')) {
         unlink('temp/shutdown-maintenance');
     }
     $lastDailyRun = null;
     if (file_exists('temp/maintenance-daily-run')) {
         $lastDailyRun = file_get_contents('temp/maintenance-daily-run');
         if ($debug) {
             echo "last daily run: " . date('Y-m-d H:i:s', $lastDailyRun) . "\n";
         }
     }
     $lastHourlyRun = null;
     if (file_exists('temp/maintenance-hourly-run')) {
         $lastHourlyRun = file_get_contents('temp/maintenance-hourly-run');
         if ($debug) {
             echo "last hourly run: " . date('Y-m-d H:i:s', $lastHourlyRun) . "\n";
         }
     }
     $dailyMaintenanceWindowStart = "01:00";
     //don't set before 00:00
     $dailyMaintenanceWindowEnd = "05:00";
     $nextDailyRun = null;
     $lastMinutelyRun = null;
     while (true) {
         if (!$nextDailyRun) {
             if ($lastDailyRun && $lastDailyRun > strtotime($dailyMaintenanceWindowStart)) {
                 //today already run
                 //maintenance window of tomorrow
                 $nextDailyRun = rand(strtotime("tomorrow {$dailyMaintenanceWindowStart}"), strtotime("tomorrow {$dailyMaintenanceWindowEnd}"));
             } else {
                 //not yet run or today not yet run
                 if (time() < strtotime($dailyMaintenanceWindowEnd)) {
                     //window not yet over for today
                     //maintenance window of today
                     $nextDailyRun = rand(max(time(), strtotime($dailyMaintenanceWindowStart)), strtotime($dailyMaintenanceWindowEnd));
                 } else {
                     //maintenance window of tomorrow
                     $nextDailyRun = rand(strtotime("tomorrow {$dailyMaintenanceWindowStart}"), strtotime("tomorrow {$dailyMaintenanceWindowEnd}"));
                 }
             }
             if ($debug) {
                 echo "Next daily run: " . date('Y-m-d H:i:s', $nextDailyRun) . "\n";
             }
         }
         Kwf_Util_Maintenance_Dispatcher::executeJobs(Kwf_Util_Maintenance_Job_Abstract::FREQUENCY_SECONDS, $debug);
         if (!$lastMinutelyRun || time() - $lastMinutelyRun > 60) {
             $lastMinutelyRun = time();
             Kwf_Util_Maintenance_Dispatcher::executeJobs(Kwf_Util_Maintenance_Job_Abstract::FREQUENCY_MINUTELY, $debug);
             //discard connection to database to reconnect on next job run
             //avoids problems with auto closed connections due to inactivity
             if (function_exists('gc_collect_cycles()')) {
                 Kwf_Model_Abstract::clearAllRows();
                 Kwf_Model_Abstract::clearInstances();
                 gc_collect_cycles();
                 Kwf_Registry::getInstance()->offsetUnset('db');
                 Kwf_Registry::getInstance()->offsetUnset('dao');
             }
         }
         Kwf_Component_Data_Root::getInstance()->freeMemory();
         if (!$lastHourlyRun || time() - $lastHourlyRun > 3600) {
             if ($debug) {
                 echo date('Y-m-d H:i:s') . " execute hourly jobs\n";
             }
             $lastHourlyRun = time();
             file_put_contents('temp/maintenance-hourly-run', $lastHourlyRun);
             Kwf_Util_Maintenance_Dispatcher::executeJobs(Kwf_Util_Maintenance_Job_Abstract::FREQUENCY_HOURLY, $debug);
         }
         Kwf_Component_Data_Root::getInstance()->freeMemory();
         if (time() > $nextDailyRun) {
             if ($debug) {
                 echo date('Y-m-d H:i:s') . " execute daily jobs\n";
             }
             $lastDailyRun = time();
             file_put_contents('temp/maintenance-daily-run', $lastDailyRun);
             $nextDailyRun = null;
             Kwf_Util_Maintenance_Dispatcher::executeJobs(Kwf_Util_Maintenance_Job_Abstract::FREQUENCY_DAILY, $debug);
         }
         sleep(10);
     }
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:82,代码来源:MaintenanceJobsController.php

示例8: _createModelInstance

 private function _createModelInstance()
 {
     Kwf_Model_Abstract::clearInstances();
     return Kwf_Model_Abstract::getInstance('Kwf_Model_RowCache_RowCacheModel');
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:5,代码来源:Test.php

示例9: indexAction

 public function indexAction()
 {
     self::initForTests();
     if (!Kwf_Registry::get('config')->server->domain) {
         throw new Kwf_Exception_Client("Can't run tests; server.domain is not set. Please set in tests/config.local.ini");
     }
     $arguments = array();
     $arguments['colors'] = true;
     $arguments['filter'] = false;
     if ($this->_getParam('filter')) {
         $arguments['filter'] = $this->_getParam('filter');
     }
     $arguments['groups'] = array();
     if ($this->_getParam('group')) {
         $arguments['groups'] = explode(',', $this->_getParam('group'));
     }
     $arguments['excludeGroups'] = array();
     if ($this->_getParam('exclude-group')) {
         $arguments['excludeGroups'] = explode(',', $this->_getParam('exclude-group'));
     }
     $arguments['verbose'] = false;
     if ($this->_getParam('verbose')) {
         $arguments['verbose'] = $this->_getParam('verbose');
     }
     if ($this->_getParam('stop-on-failure')) {
         $arguments['stopOnFailure'] = $this->_getParam('stop-on-failure');
     }
     if ($this->_getParam('log-xml')) {
         $arguments['xmlLogfile'] = $this->_getParam('log-xml');
     }
     if ($this->_getParam('log-pmd')) {
         $arguments['pmdXML'] = $this->_getParam('log-pmd');
     }
     if ($this->_getParam('log-metrics')) {
         $arguments['metricsXML'] = $this->_getParam('log-metrics');
     }
     if ($this->_getParam('coverage-xml')) {
         $arguments['coverageClover'] = $this->_getParam('coverage-xml');
     }
     if ($this->_getParam('retry-on-error')) {
         $arguments['retryOnError'] = $this->_getParam('retry-on-error');
     }
     if ($this->_getParam('coverage')) {
         if (!extension_loaded('tokenizer') || !extension_loaded('xdebug')) {
             throw new Kwf_ClientException('tokenizer and xdebug extensions must be loaded');
         }
         if (!is_string($this->_getParam('coverage'))) {
             $arguments['reportDirectory'] = './report';
         } else {
             $arguments['reportDirectory'] = $this->_getParam('coverage');
         }
     }
     Kwf_Registry::set('testDomain', Kwf_Registry::get('config')->server->domain);
     Kwf_Registry::set('testServerConfig', Kwf_Registry::get('config'));
     if ($this->_getParam('report')) {
         $resultLogger = new Kwf_Test_ResultLogger(true);
         $arguments['listeners'][] = $resultLogger;
     }
     if ($this->_getParam('testdox')) {
         $arguments['printer'] = new PHPUnit_Util_TestDox_ResultPrinter_Text();
         $arguments['noProgress'] = true;
     } else {
         if ($this->_getParam('no-progress')) {
             $arguments['noProgress'] = true;
         }
     }
     if ($this->_getParam('disable-debug')) {
         Kwf_Debug::disable();
     }
     //nur temporär deaktiviert, damit ich selenium-verbindungs-probleme besser debuggen kann
     //         PHPUnit_Util_Filter::setFilter(false);
     $runner = new Kwf_Test_TestRunner();
     $suite = new Kwf_Test_TestSuite();
     Kwf_Model_Abstract::clearInstances();
     $result = $runner->doRun($suite, $arguments);
     if ($this->_getParam('report')) {
         $resultLogger->printResult($result);
         $reportData = array('tests' => $result->count(), 'failures' => $result->failureCount() + $result->errorCount(), 'skipped' => $result->skippedCount(), 'not_implemented' => $result->notImplementedCount(), 'kwf_version' => Kwf_Util_Git::kwf()->getActiveBranch() . ' (' . Kwf_Util_Git::kwf()->revParse('HEAD') . ')');
         if (Kwf_Registry::get('config')->application->id != 'kwf') {
             $reportData['web_version'] = Kwf_Util_Git::web()->getActiveBranch() . ' (' . Kwf_Util_Git::web()->revParse('HEAD') . ')';
         }
         echo "===REPORT===";
         echo serialize($reportData);
         echo "===/REPORT===";
     }
     Kwf_Benchmark::shutDown();
     if ($result->wasSuccessful()) {
         exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
     } else {
         if ($result->errorCount() > 0) {
             exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
         } else {
             exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT);
         }
     }
     $this->_helper->viewRenderer->setNoRender(true);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:97,代码来源:TestController.php


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