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


PHP Package::installDB方法代碼示例

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


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

示例1: refresh_database_schema

 public function refresh_database_schema()
 {
     if ($this->token->validate("refresh_database_schema")) {
         $msg = '';
         if ($this->post('refresh_global_schema')) {
             // refresh concrete/config/db.xml and all installed blocks
             $cnt = Loader::controller("/upgrade");
             try {
                 $cnt->refresh_schema();
                 $msg .= t('Core database files and installed blocks refreshed.');
             } catch (Exception $e) {
                 $this->set('error', $e);
             }
         }
         if ($this->post('refresh_local_schema')) {
             // refresh concrete/config/db.xml and all installed blocks
             if (file_exists('config/' . FILENAME_LOCAL_DB)) {
                 try {
                     Package::installDB(DIR_BASE . '/config/' . FILENAME_LOCAL_DB);
                     $msg .= ' ' . t('Local database file refreshed.');
                 } catch (Exception $e) {
                     $this->set('error', $e);
                 }
             }
         }
         $msg = trim($msg);
         $this->set('message', $msg);
     } else {
         $this->set('error', array($this->token->getErrorMessage()));
     }
 }
開發者ID:ricardomccerqueira,項目名稱:rcerqueira.portfolio,代碼行數:31,代碼來源:database.php

示例2: prepare

 public function prepare()
 {
     // we install the updated schema just for tables that matter
     Package::installDB(dirname(__FILE__) . '/db/version_540.xml');
     $db = Loader::db();
     $db->Execute('alter table CollectionVersionBlockStyles drop primary key');
     $db->Execute('alter table CollectionVersionBlockStyles add primary key (cID, bID, cvID, arHandle)');
 }
開發者ID:ojalehto,項目名稱:concrete5-legacy,代碼行數:8,代碼來源:version_540.php

示例3: upgrade

 public function upgrade()
 {
     Package::installDB($this->getPackagePath() . '/' . FILENAME_PACKAGE_DB);
     // now we refresh all blocks
     $items = $this->getPackageItems();
     if (is_array($items['block_types'])) {
         foreach ($items['block_types'] as $item) {
             $item->refresh();
         }
     }
 }
開發者ID:ojalehto,項目名稱:concrete5-legacy,代碼行數:11,代碼來源:package.php

示例4: add

	public static function add($atHandle, $atName, $pkg = false) {
		$pkgID = 0;
		if (is_object($pkg)) {
			$pkgID = $pkg->getPackageID();
		}
		$db = Loader::db();
		$db->Execute('insert into AttributeTypes (atHandle, atName, pkgID) values (?, ?, ?)', array($atHandle, $atName, $pkgID));
		$id = $db->Insert_ID();
		$est = AttributeType::getByID($id);
		
		$path = $est->getAttributeTypeFilePath(FILENAME_ATTRIBUTE_DB);
		if ($path) {
			Package::installDB($path);
		}
		return $est;
	}
開發者ID:nbourguig,項目名稱:concrete5,代碼行數:16,代碼來源:type.php

示例5: install_database

 public function install_database()
 {
     $db = Loader::db();
     $installDirectory = DIR_BASE_CORE . '/config';
     try {
         Database::ensureEncoding();
         Package::installDB($installDirectory . '/db.xml');
     } catch (Exception $e) {
         throw new Exception(t('Unable to install database: %s', $db->ErrorMsg()));
     }
 }
開發者ID:ronlobo,項目名稱:concrete5-de,代碼行數:11,代碼來源:starting_point_package.php

示例6: prepare

	public function prepare() {
		$db = Loader::db();
		Package::installDB(dirname(__FILE__) . '/db/version_5331.xml');
	}
開發者ID:rii-J,項目名稱:concrete5-de,代碼行數:4,代碼來源:version_5331.php

示例7: refresh_schema

 public function refresh_schema()
 {
     if ($this->upgrade_db) {
         $installDirectory = DIR_BASE_CORE . '/config';
         $file = $installDirectory . '/db.xml';
         if (!file_exists($file)) {
             throw new Exception(t('Unable to locate database import file.'));
         }
         $err = Package::installDB($file);
         // now we refresh the block schema
         $btl = new BlockTypeList();
         $btArray = $btl->getInstalledList();
         foreach ($btArray as $bt) {
             $bt->refresh();
         }
         $this->upgrade_db = false;
     }
 }
開發者ID:rmxdave,項目名稱:concrete5,代碼行數:18,代碼來源:upgrade.php

示例8: install

 /**
  * Installs the current block's DB xml file. If a block needs to do more than this, this should be overridden.
  * <code>
  * public function install($path) {
  *     $this->doMySpecialInstallMethod();
  *     $this->doSecondSpecialInstallMethod();
  *     parent::install($path);
  * }
  * </code>
  *
  * There are several different possible return values:
  *  Returns FALSE if $btTable is set but no db.xml file exists.
  *  Otherwise returns object with two properties: ->result (a boolean), and ->message (a string).
  *  If ->result is true, the installation was successful
  *  (although the db.xml file might only have one field declared which will cause C5 to have problems later on, so you you will want to check for that separately).
  *  If ->result is false, the installation failed and you can check ->message for the explanation
  *  (usually -- sometimes ->message will be blank, in which case there's either a malformed db.xml file or an "unknown database error").
  * See concrete/models/block_types.php::doInstallBlockType() for usage example.
  *
  * @param string $path
  * @return mixed boolean or object having ->result (boolean) and ->message (string) properties
  */
 function install($path)
 {
     // passed path is the path to this block (try saying that ten times fast)
     // create the necessary table
     if (!$this->btTable) {
         $r = new stdClass();
         $r->result = true;
         return $r;
     }
     $ret = Package::installDB($path . '/' . $this->dbFile);
     return $ret;
 }
開發者ID:ojalehto,項目名稱:concrete5-legacy,代碼行數:34,代碼來源:block_controller.php

示例9: prepare

	public function prepare() {
		// we install the updated schema just for tables that matter
		Package::installDB(dirname(__FILE__) . '/db/version_542.xml');
	}
開發者ID:remkoj,項目名稱:concrete5,代碼行數:4,代碼來源:version_542.php

示例10: install

 /**
  * Installs the current block's DB xml file. If a block needs to do more than this, this should be overridden.
  * <code>
  * public function install($path) {
  *     $this->doMySpecialInstallMethod();
  *     $this->doSecondSpecialInstallMethod();
  *     parent::install($path);
  * }
  * </code>
  * @param string $path
  * @return bool $didInstallCorrectly
  */
 function install($path)
 {
     // passed path is the path to this block (try saying that ten times fast)
     // create the necessary table
     $ret = Package::installDB($path . '/' . $this->dbFile);
     return $ret;
 }
開發者ID:homer6,項目名稱:concrete5-mirror,代碼行數:19,代碼來源:block_controller.php

示例11: refreshDatabaseTables

 protected function refreshDatabaseTables($tables)
 {
     $dbxml = simplexml_load_file(DIR_BASE_CORE . '/config/db.xml');
     $output = new SimpleXMLElement("<schema></schema>");
     $output->addAttribute('version', '0.3');
     foreach ($dbxml->table as $t) {
         $name = (string) $t['name'];
         if (in_array($name, $tables)) {
             $this->xmlAppend($output, $t);
         }
     }
     $xml = $output->asXML();
     if ($xml) {
         $file = Loader::helper('file')->getTemporaryDirectory() . '/tmpupgrade_' . time() . '.xml';
         @file_put_contents($file, $xml);
         if (file_exists($file)) {
             Package::installDB($file);
             @unlink($file);
         } else {
             throw new Exception(t('Unable to create temporary db xml file: %s', $file));
         }
     }
 }
開發者ID:nveid,項目名稱:concrete5,代碼行數:23,代碼來源:upgrade.php


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