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


PHP DatabaseBase::sourceFile方法代码示例

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


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

示例1: createTables

 /**
  * Create database tables from scratch.
  *
  * @return Status
  */
 public function createTables()
 {
     $status = $this->getConnection();
     if (!$status->isOK()) {
         return $status;
     }
     $this->db->selectDB($this->getVar('wgDBname'));
     if ($this->db->tableExists('archive', __METHOD__)) {
         $status->warning('config-install-tables-exist');
         $this->enableLB();
         return $status;
     }
     $this->db->setFlag(DBO_DDLMODE);
     // For Oracle's handling of schema files
     $this->db->begin(__METHOD__);
     $error = $this->db->sourceFile($this->db->getSchemaPath());
     if ($error !== true) {
         $this->db->reportQueryError($error, 0, '', __METHOD__);
         $this->db->rollback(__METHOD__);
         $status->fatal('config-install-tables-failed', $error);
     } else {
         $this->db->commit(__METHOD__);
     }
     // Resume normal operations
     if ($status->isOk()) {
         $this->enableLB();
     }
     return $status;
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:34,代码来源:DatabaseInstaller.php

示例2: stepApplySourceFile

 /**
  * Apply a SQL source file to the database as part of running an installation step.
  *
  * @param string $sourceFileMethod
  * @param string $stepName
  * @param string $archiveTableMustNotExist
  * @return Status
  */
 private function stepApplySourceFile($sourceFileMethod, $stepName, $archiveTableMustNotExist = false)
 {
     $status = $this->getConnection();
     if (!$status->isOK()) {
         return $status;
     }
     $this->db->selectDB($this->getVar('wgDBname'));
     if ($archiveTableMustNotExist && $this->db->tableExists('archive', __METHOD__)) {
         $status->warning("config-{$stepName}-tables-exist");
         $this->enableLB();
         return $status;
     }
     $this->db->setFlag(DBO_DDLMODE);
     // For Oracle's handling of schema files
     $this->db->begin(__METHOD__);
     $error = $this->db->sourceFile(call_user_func(array($this->db, $sourceFileMethod)));
     if ($error !== true) {
         $this->db->reportQueryError($error, 0, '', __METHOD__);
         $this->db->rollback(__METHOD__);
         $status->fatal("config-{$stepName}-tables-failed", $error);
     } else {
         $this->db->commit(__METHOD__);
     }
     // Resume normal operations
     if ($status->isOk()) {
         $this->enableLB();
     }
     return $status;
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:37,代码来源:DatabaseInstaller.php

示例3: createExtensionTables

 /**
  * Create the tables for each extension the user enabled
  * @return Status
  */
 public function createExtensionTables()
 {
     $status = $this->getConnection();
     if (!$status->isOK()) {
         return $status;
     }
     $updater = DatabaseUpdater::newForDB($this->db);
     $extensionUpdates = $updater->getNewExtensions();
     $ourExtensions = array_map('strtolower', $this->getVar('_Extensions'));
     foreach ($ourExtensions as $ext) {
         if (isset($extensionUpdates[$ext])) {
             $this->db->begin(__METHOD__);
             $error = $this->db->sourceFile($extensionUpdates[$ext]);
             if ($error !== true) {
                 $this->db->rollback(__METHOD__);
                 $status->warning('config-install-tables-failed', $error);
             } else {
                 $this->db->commit(__METHOD__);
             }
         }
     }
     // Now run updates to create tables for old extensions
     $updater->doUpdates(array('extensions'));
     return $status;
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:29,代码来源:DatabaseInstaller.php

示例4: applyPatch

 /**
  * Applies a SQL patch
  * @param $path String Path to the patch file
  * @param $isFullPath Boolean Whether to treat $path as a relative or not
  */
 protected function applyPatch($path, $isFullPath = false)
 {
     if ($isFullPath) {
         $this->db->sourceFile($path);
     } else {
         $this->db->sourceFile($this->db->patchPath($path));
     }
 }
开发者ID:laiello,项目名称:media-wiki-law,代码行数:13,代码来源:DatabaseUpdater.php

示例5: testStoredFunctions

 public function testStoredFunctions()
 {
     if (!in_array(wfGetDB(DB_MASTER)->getType(), array('mysql', 'postgres'))) {
         $this->markTestSkipped('MySQL or Postgres required');
     }
     global $IP;
     $this->dropFunctions();
     $this->functionTest = true;
     $this->assertTrue($this->db->sourceFile("{$IP}/tests/phpunit/data/db/{$this->db->getType()}/functions.sql"));
     $res = $this->db->query('SELECT mw_test_function() AS test', __METHOD__);
     $this->assertEquals(42, $res->fetchObject()->test);
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:12,代码来源:DatabaseTest.php

示例6: applyPatch

 /**
  * Applies a SQL patch
  * @param $path String Path to the patch file
  * @param $isFullPath Boolean Whether to treat $path as a relative or not
  * @param $msg String Description of the patch
  */
 protected function applyPatch($path, $isFullPath = false, $msg = null)
 {
     if ($msg === null) {
         $msg = "Applying {$path} patch";
     }
     if (!$isFullPath) {
         $path = $this->db->patchPath($path);
     }
     $this->output("{$msg} ...");
     $this->db->sourceFile($path);
     $this->output("done.\n");
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:18,代码来源:DatabaseUpdater.php

示例7: applyPatch

 /**
  * Applies a SQL patch
  *
  * @param string $path Path to the patch file
  * @param bool $isFullPath Whether to treat $path as a relative or not
  * @param string $msg Description of the patch
  * @return bool False if patch is skipped.
  */
 protected function applyPatch($path, $isFullPath = false, $msg = null)
 {
     if ($msg === null) {
         $msg = "Applying {$path} patch";
     }
     if ($this->skipSchema) {
         $this->output("...skipping schema change ({$msg}).\n");
         return false;
     }
     $this->output("{$msg} ...");
     if (!$isFullPath) {
         $path = $this->db->patchPath($path);
     }
     if ($this->fileHandle !== null) {
         $this->copyFile($path);
     } else {
         $this->db->sourceFile($path);
     }
     $this->output("done.\n");
     return true;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:29,代码来源:DatabaseUpdater.php


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