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


PHP DatabaseBase::tableExists方法代码示例

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


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

示例1: doMigrateUserOptions

	/**
	 * Migrates user options from the user table blob to user_properties
	 */
	protected function doMigrateUserOptions() {
		if ( $this->db->tableExists( 'user_properties' ) ) {
			$cl = $this->maintenance->runChild( 'ConvertUserOptions', 'convertUserOptions.php' );
			$cl->execute();
			$this->output( "done.\n" );
		}
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:10,代码来源:DatabaseUpdater.php

示例2: needsUpgrade

 /**
  * Determine whether an existing installation of MediaWiki is present in
  * the configured administrative connection. Returns true if there is
  * such a wiki, false if the database doesn't exist.
  *
  * Traditionally, this is done by testing for the existence of either
  * the revision table or the cur table.
  *
  * @return Boolean
  */
 public function needsUpgrade()
 {
     $status = $this->getConnection();
     if (!$status->isOK()) {
         return false;
     }
     if (!$this->db->selectDB($this->getVar('wgDBname'))) {
         return false;
     }
     return $this->db->tableExists('cur', __METHOD__) || $this->db->tableExists('revision', __METHOD__);
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:21,代码来源:DatabaseInstaller.php

示例3: modifyField

 /**
  * Modify an existing field
  *
  * @param $table String: name of the table to which the field belongs
  * @param $field String: name of the field to modify
  * @param $patch String: path to the patch file
  * @param $fullpath Boolean: whether to treat $patch path as a relative or not
  */
 public function modifyField($table, $field, $patch, $fullpath = false)
 {
     if (!$this->db->tableExists($table)) {
         $this->output("...{$table} table does not exist, skipping modify field patch\n");
     } elseif (!$this->db->fieldExists($table, $field)) {
         $this->output("...{$field} field does not exist in {$table} table, skipping modify field patch\n");
     } else {
         $this->output("Modifying {$field} field of table {$table}...");
         $this->applyPatch($patch, $fullpath);
         $this->output("ok\n");
     }
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:20,代码来源:DatabaseUpdater.php

示例4: modifyField

 /**
  * Modify an existing field
  *
  * @param $table String: name of the table to which the field belongs
  * @param $field String: name of the field to modify
  * @param $patch String: path to the patch file
  * @param $fullpath Boolean: whether to treat $patch path as a relative or not
  */
 public function modifyField($table, $field, $patch, $fullpath = false)
 {
     $updateKey = "{$table}-{$field}-{$patch}";
     if (!$this->db->tableExists($table, __METHOD__)) {
         $this->output("...{$table} table does not exist, skipping modify field patch.\n");
     } elseif (!$this->db->fieldExists($table, $field, __METHOD__)) {
         $this->output("...{$field} field does not exist in {$table} table, skipping modify field patch.\n");
     } elseif ($this->updateRowExists($updateKey)) {
         $this->output("...{$field} in table {$table} already modified by patch {$patch}.\n");
     } else {
         $this->applyPatch($patch, $fullpath, "Modifying {$field} field of table {$table}");
         $this->insertUpdateRow($updateKey);
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:22,代码来源:DatabaseUpdater.php

示例5: doDeletes

 /**
  * @param DatabaseBase $dbw
  * @param string $table
  * @param string $column
  * @param string $wiki
  */
 function doDeletes($dbw, $table, $column, $wiki)
 {
     if (!$dbw->tableExists($table)) {
         $this->error("Maintenance script cannot be run on this wiki as there is no {$table} table", 1);
     }
     $this->output("{$table}:\n");
     $count = 0;
     do {
         $wikiQuoted = $dbw->addQuotes($wiki);
         $dbw->query("DELETE FROM {$table} WHERE {$column}={$wikiQuoted} LIMIT 500", __METHOD__);
         $affected = $dbw->affectedRows();
         $count += $affected;
         $this->output("{$count}\n");
         wfWaitForSlaves();
     } while ($affected === 500);
     $this->output("{$count} {$table} rows deleted\n");
 }
开发者ID:reviforks,项目名称:MirahezeMagic,代码行数:23,代码来源:removeDeletedWikis.php

示例6: doEnableProfiling

 /**
  * Enable profiling table when it's turned on
  */
 protected function doEnableProfiling()
 {
     global $wgProfiler;
     if (!$this->doTable('profiling')) {
         return true;
     }
     $profileToDb = false;
     if (isset($wgProfiler['output'])) {
         $out = $wgProfiler['output'];
         if ($out === 'db') {
             $profileToDb = true;
         } elseif (is_array($out) && in_array('db', $out)) {
             $profileToDb = true;
         }
     }
     if ($profileToDb && !$this->db->tableExists('profiling', __METHOD__)) {
         $this->applyPatch('patch-profiling.sql', false, 'Add profiling table');
     }
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:22,代码来源:DatabaseUpdater.php

示例7: execute

    function execute()
    {
        $this->dbw = wfGetDB(DB_MASTER);
        $logging = $this->dbw->tableName('logging');
        $logging_1_10 = $this->dbw->tableName('logging_1_10');
        $logging_pre_1_10 = $this->dbw->tableName('logging_pre_1_10');
        if ($this->dbw->tableExists('logging_pre_1_10') && !$this->dbw->tableExists('logging')) {
            # Fix previous aborted run
            echo "Cleaning up from previous aborted run\n";
            $this->dbw->query("RENAME TABLE {$logging_pre_1_10} TO {$logging}", __METHOD__);
        }
        if ($this->dbw->tableExists('logging_pre_1_10')) {
            echo "This script has already been run to completion\n";
            return;
        }
        # Create the target table
        if (!$this->dbw->tableExists('logging_1_10')) {
            global $wgDBTableOptions;
            $sql = <<<EOT
CREATE TABLE {$logging_1_10} (
  -- Log ID, for referring to this specific log entry, probably for deletion and such.
  log_id int unsigned NOT NULL auto_increment,

  -- Symbolic keys for the general log type and the action type
  -- within the log. The output format will be controlled by the
  -- action field, but only the type controls categorization.
  log_type varbinary(10) NOT NULL default '',
  log_action varbinary(10) NOT NULL default '',

  -- Timestamp. Duh.
  log_timestamp binary(14) NOT NULL default '19700101000000',

  -- The user who performed this action; key to user_id
  log_user int unsigned NOT NULL default 0,

  -- Key to the page affected. Where a user is the target,
  -- this will point to the user page.
  log_namespace int NOT NULL default 0,
  log_title varchar(255) binary NOT NULL default '',

  -- Freeform text. Interpreted as edit history comments.
  log_comment varchar(255) NOT NULL default '',

  -- LF separated list of miscellaneous parameters
  log_params blob NOT NULL,

  -- rev_deleted for logs
  log_deleted tinyint unsigned NOT NULL default '0',

  PRIMARY KEY log_id (log_id),
  KEY type_time (log_type, log_timestamp),
  KEY user_time (log_user, log_timestamp),
  KEY page_time (log_namespace, log_title, log_timestamp),
  KEY times (log_timestamp)

) {$wgDBTableOptions}
EOT;
            echo "Creating table logging_1_10\n";
            $this->dbw->query($sql, __METHOD__);
        }
        # Synchronise the tables
        echo "Doing initial sync...\n";
        $this->sync('logging', 'logging_1_10');
        echo "Sync done\n\n";
        # Rename the old table away
        echo "Renaming the old table to {$logging_pre_1_10}\n";
        $this->dbw->query("RENAME TABLE {$logging} TO {$logging_pre_1_10}", __METHOD__);
        # Copy remaining old rows
        # Done before the new table is active so that $copyPos is accurate
        echo "Doing final sync...\n";
        $this->sync('logging_pre_1_10', 'logging_1_10');
        # Move the new table in
        echo "Moving the new table in...\n";
        $this->dbw->query("RENAME TABLE {$logging_1_10} TO {$logging}", __METHOD__);
        echo "Finished.\n";
    }
开发者ID:seedbank,项目名称:old-repo,代码行数:76,代码来源:upgradeLogging.php

示例8: testUnknownTableCorruptsResults

 public function testUnknownTableCorruptsResults()
 {
     $res = $this->db->select('page', '*', array('page_id' => 1));
     $this->assertFalse($this->db->tableExists('foobarbaz'));
     $this->assertInternalType('int', $res->numRows());
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:6,代码来源:DatabaseTest.php


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