當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Version::save_dbversion方法代碼示例

本文整理匯總了PHP中Version::save_dbversion方法的典型用法代碼示例。如果您正苦於以下問題:PHP Version::save_dbversion方法的具體用法?PHP Version::save_dbversion怎麽用?PHP Version::save_dbversion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Version的用法示例。


在下文中一共展示了Version::save_dbversion方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testSave_dbversion

 public function testSave_dbversion()
 {
     Options::delete('db_version');
     Version::save_dbversion();
     $this->assertEquals(Version::DB_VERSION, Options::get('db_version'));
 }
開發者ID:psaintlaurent,項目名稱:Habari,代碼行數:6,代碼來源:versionTest.php

示例2: test_save_dbversion

 function test_save_dbversion()
 {
     Options::delete('db_version');
     Version::save_dbversion();
     $this->assert_equal(Version::DB_VERSION, Options::get('db_version'));
 }
開發者ID:habari,項目名稱:tests,代碼行數:6,代碼來源:test_version.php

示例3: upgrade_db

 /**
  * Upgrade the database when the database version stored is lower than the one in source
  * @todo Make more db-independent
  */
 public function upgrade_db()
 {
     if (Options::get('db_upgrading')) {
         // quit with an error message.
         $this->display_currently_upgrading();
     }
     // don't allow duplicate upgrades.
     Options::set('db_upgrading', true);
     // This database-specific code needs to be moved into the schema-specific functions
     list($schema, $remainder) = explode(':', Config::get('db_connection')->connection_string);
     switch ($schema) {
         case 'sqlite':
             $db_name = '';
             break;
         case 'mysql':
         case 'pgsql':
             $pairs = $this->parse_dsn($remainder);
             $db_name = $pairs['dbname'];
             break;
     }
     Cache::purge();
     // get the current db version
     $version = Options::get('db_version');
     // do some pre-dbdelta ad-hoc hacky hack code
     $this->upgrade_db_pre($version);
     // run schema-specific upgrade scripts for before dbdelta
     DB::upgrade_pre($version);
     // Get the queries for this database and apply the changes to the structure
     $queries = $this->get_create_table_queries($schema, Config::get('db_connection')->prefix, $db_name);
     DB::dbdelta($queries);
     // Apply data changes to the database based on version, call the db-specific upgrades, too.
     $this->upgrade_db_post($version);
     // run schema-specific upgrade scripts for after dbdelta
     DB::upgrade_post($version);
     Version::save_dbversion();
     Options::delete('db_upgrading');
 }
開發者ID:habari,項目名稱:system,代碼行數:41,代碼來源:installhandler.php

示例4: upgrade_db

 /**
  * Upgrade the database when the database version stored is lower than the one in source
  * @todo Make more db-independent
  */
 public function upgrade_db()
 {
     // This database-specific code needs to be moved into the schema-specific functions
     list($schema, $remainder) = explode(':', Config::get('db_connection')->connection_string);
     switch ($schema) {
         case 'sqlite':
             $db_name = '';
             break;
         case 'mysql':
             list($host, $name) = explode(';', $remainder);
             list($discard, $db_name) = explode('=', $name);
             break;
         case 'pgsql':
             list($host, $name) = explode(' ', $remainder);
             list($discard, $db_name) = explode('=', $name);
             break;
     }
     // get the current db version
     $version = Options::get('db_version');
     // do some pre-dbdelta ad-hoc hacky hack code
     $this->upgrade_db_pre($version);
     // run schema-specific upgrade scripts for before dbdelta
     DB::upgrade_pre($version);
     // Get the queries for this database and apply the changes to the structure
     $queries = $this->get_create_table_queries($schema, Config::get('db_connection')->prefix, $db_name);
     DB::dbdelta($queries);
     // Apply data changes to the database based on version, call the db-specific upgrades, too.
     $this->upgrade_db_post($version);
     // run schema-specific upgrade scripts for after dbdelta
     DB::upgrade_post($version);
     Version::save_dbversion();
 }
開發者ID:anupom,項目名稱:my-blog,代碼行數:36,代碼來源:installhandler.php


注:本文中的Version::save_dbversion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。