当前位置: 首页>>代码示例>>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;未经允许,请勿转载。