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


PHP DatabaseBase::selectRow方法代码示例

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


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

示例1: populateInterwikiTable

 /**
  * Common function for databases that don't understand the MySQLish syntax of interwiki.sql.
  *
  * @return Status
  */
 public function populateInterwikiTable()
 {
     $status = $this->getConnection();
     if (!$status->isOK()) {
         return $status;
     }
     $this->db->selectDB($this->getVar('wgDBname'));
     if ($this->db->selectRow('interwiki', '*', array(), __METHOD__)) {
         $status->warning('config-install-interwiki-exists');
         return $status;
     }
     global $IP;
     wfSuppressWarnings();
     $rows = file("{$IP}/maintenance/interwiki.list", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
     wfRestoreWarnings();
     $interwikis = array();
     if (!$rows) {
         return Status::newFatal('config-install-interwiki-list');
     }
     foreach ($rows as $row) {
         $row = preg_replace('/^\\s*([^#]*?)\\s*(#.*)?$/', '\\1', $row);
         // strip comments - whee
         if ($row == "") {
             continue;
         }
         $row .= "||";
         $interwikis[] = array_combine(array('iw_prefix', 'iw_url', 'iw_local', 'iw_api', 'iw_wikiid'), explode('|', $row));
     }
     $this->db->insert('interwiki', $interwikis, __METHOD__);
     return Status::newGood();
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:36,代码来源:DatabaseInstaller.php

示例2: fixTemplate

 /**
  * fixTemplate
  *
  * This code ensures that the version of the Template that was in existence
  * at the same time as the Memento gets loaded and displayed with the
  * Memento.
  *
  * @fixme make this compatible with parser cache
  * @param Title $title
  * @param Parser $parser
  * @param integer $id
  *
  * @return array containing the text, finalTitle, and deps
  */
 public function fixTemplate(Title $title, Parser $parser, &$id)
 {
     // stopgap measure until we can find a better way
     // to work with parser cache
     $parser->disableCache();
     $request = $parser->getUser()->getRequest();
     if ($request->getHeader('ACCEPT-DATETIME')) {
         $requestDatetime = $request->getHeader('ACCEPT-DATETIME');
         $mwMementoTimestamp = $this->parseRequestDateTime($requestDatetime);
         $firstRev = $title->getFirstRevision();
         // if the template no longer exists, return gracefully
         if ($firstRev != null) {
             if ($firstRev->getTimestamp() < $mwMementoTimestamp) {
                 $pgID = $title->getArticleID();
                 $this->db->begin();
                 $res = $this->db->selectRow('revision', array('rev_id'), array('rev_page' => $pgID, 'rev_timestamp <=' . $this->db->addQuotes($mwMementoTimestamp)), __METHOD__, array('ORDER BY' => 'rev_id DESC', 'LIMIT' => '1'));
                 $id = $res->rev_id;
             } else {
                 // if we get something prior to the first memento, just
                 // go with the first one
                 $id = $firstRev->getId();
             }
         }
     }
 }
开发者ID:NDKilla,项目名称:memento,代码行数:39,代码来源:MementoResource.php

示例3: getUsageCount

 /**
  * @since 2.2
  *
  * @param integer $propertyId
  *
  * @return integer
  */
 public function getUsageCount($propertyId)
 {
     if (!is_int($propertyId)) {
         return 0;
     }
     $row = $this->dbConnection->selectRow($this->table, array('usage_count'), array('p_id' => $propertyId), __METHOD__);
     return $row !== false ? (int) $row->usage_count : 0;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:15,代码来源:PropertyStatisticsTable.php

示例4: checkMissingImage

 function checkMissingImage($fullpath)
 {
     $filename = wfBaseName($fullpath);
     $row = $this->dbw->selectRow('image', array('img_name'), array('img_name' => $filename), __METHOD__);
     if (!$row) {
         // file not registered
         $this->addMissingImage($filename, $fullpath);
     }
 }
开发者ID:Acidburn0zzz,项目名称:mediawiki,代码行数:9,代码来源:rebuildImages.php

示例5: doGetText

 /**
  * May throw a database error if, say, the server dies during query.
  * @param DatabaseBase $db
  * @param int $id The old_id
  * @return string
  */
 private function doGetText($db, $id)
 {
     $id = intval($id);
     $row = $db->selectRow('text', ['old_text', 'old_flags'], ['old_id' => $id], __METHOD__);
     $text = Revision::getRevisionText($row);
     if ($text === false) {
         return false;
     }
     return $text;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:16,代码来源:fetchText.php

示例6: initFromCond

 /**
  * @param $cond array
  * @return bool
  */
 private function initFromCond($cond)
 {
     global $wgExternalAuthConf;
     $this->mDb = DatabaseBase::factory($wgExternalAuthConf['DBtype'], array('host' => $wgExternalAuthConf['DBserver'], 'user' => $wgExternalAuthConf['DBuser'], 'password' => $wgExternalAuthConf['DBpassword'], 'dbname' => $wgExternalAuthConf['DBname'], 'tablePrefix' => $wgExternalAuthConf['DBprefix']));
     $row = $this->mDb->selectRow('user', array('user_name', 'user_id', 'user_password', 'user_email', 'user_email_authenticated'), $cond, __METHOD__);
     if (!$row) {
         return false;
     }
     $this->mRow = $row;
     return true;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:15,代码来源:MediaWiki.php

示例7: getTextDb

 /**
  * May throw a database error if, say, the server dies during query.
  * @param $id
  * @return bool|string
  */
 private function getTextDb($id)
 {
     global $wgContLang;
     $row = $this->db->selectRow('text', array('old_text', 'old_flags'), array('old_id' => $id), __METHOD__);
     $text = Revision::getRevisionText($row);
     if ($text === false) {
         return false;
     }
     $stripped = str_replace("\r", "", $text);
     $normalized = $wgContLang->normalize($stripped);
     return $normalized;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:17,代码来源:dumpTextPass.php

示例8: checkStats

 /**
  * Check the site_stats table is not properly populated.
  */
 protected function checkStats()
 {
     $this->output("...site_stats is populated...");
     $row = $this->db->selectRow('site_stats', '*', array('ss_row_id' => 1), __METHOD__);
     if ($row === false) {
         $this->output("data is missing! rebuilding...\n");
     } elseif (isset($row->site_stats) && $row->ss_total_pages == -1) {
         $this->output("missing ss_total_pages, rebuilding...\n");
     } else {
         $this->output("done.\n");
         return;
     }
     SiteStatsInit::doAllAndCommit($this->db);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:17,代码来源:DatabaseUpdater.php

示例9: getTextDb

 /**
  * May throw a database error if, say, the server dies during query.
  * @param int $id
  * @return bool|string
  * @throws MWException
  */
 private function getTextDb($id)
 {
     global $wgContLang;
     if (!isset($this->db)) {
         throw new MWException(__METHOD__ . "No database available");
     }
     $row = $this->db->selectRow('text', array('old_text', 'old_flags'), array('old_id' => $id), __METHOD__);
     $text = Revision::getRevisionText($row);
     if ($text === false) {
         return false;
     }
     $stripped = str_replace("\r", "", $text);
     $normalized = $wgContLang->normalize($stripped);
     return $normalized;
 }
开发者ID:OrBin,项目名称:mediawiki,代码行数:21,代码来源:dumpTextPass.php

示例10: checkMissingImage

 function checkMissingImage($fullpath)
 {
     $filename = wfBaseName($fullpath);
     if (is_dir($fullpath)) {
         return;
     }
     if (is_link($fullpath)) {
         $this->output("skipping symlink at {$fullpath}\n");
         return;
     }
     $row = $this->dbw->selectRow('image', array('img_name'), array('img_name' => $filename), __METHOD__);
     if ($row) {
         // already known, move on
         return;
     } else {
         $this->addMissingImage($filename, $fullpath);
     }
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:18,代码来源:rebuildImages.php

示例11: updateUnit

 /**
  * Updates an existing unit. If the unit already had a version for the current number,
  * it will be updated, otherwise a new one will be created.
  * 
  * @since 0.1
  * 
  * @param $unit
  * @param $unitValues Array
  * @param $versionValues Array
  * @param $dbr DatabaseBase
  */
 protected static function updateUnit($unit, array $unitValues, array $versionValues, DatabaseBase $dbr)
 {
     $dbw = wfGetDB(DB_MASTER);
     $versionValues['version_unit_id'] = $unit->unit_id;
     // Query for existing versions of this unit with the same version number.
     $version = $dbr->selectRow('distribution_unit_versions', array('version_id'), array('unit_id' => $unit->unit_id, 'version_nr' => $unitValues['current_version_nr']));
     // If this version does not exist yet, create it.
     if ($version == false) {
         $versionValues['version_nr'] = $unitValues['current_version_nr'];
         $dbw->insert('distribution_unit_versions', $versionValues);
         $unitValues['unit_current'] = $dbw->insertId();
     } else {
         // If the version already exists, update it.
         $dbw->update('distribution_unit_versions', $versionValues, array('version_id' => $version->version_id));
         $unitValues['unit_current'] = $version->version_id;
     }
     // Update the unit so it points to the correct version.
     $dbw->update('distribution_units', $unitValues, array('unit_id' => $unit->unit_id));
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:30,代码来源:ExtensionDataImporter.php

示例12: selectRow

 function selectRow($table, $vars, $conds, $fname = 'DatabaseOracle::selectRow', $options = array(), $join_conds = array())
 {
     if (is_array($conds)) {
         $conds = $this->wrapConditionsForWhere($table, $conds);
     }
     return parent::selectRow($table, $vars, $conds, $fname, $options, $join_conds);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:DatabaseOracle.php

示例13: getHiddenFromDb

 /**
  * @brief auxiliary method for getting hidden pages/wikis from db
  *
  * @param DatabaseBase $dbHandler
  *
  * @author ADi
  * @return array
  */
 private function getHiddenFromDb($dbHandler)
 {
     wfProfileIn(__METHOD__);
     $result = false;
     if (!$this->user->isAnon()) {
         $row = $dbHandler->selectRow(array('page_wikia_props'), array('props'), array('page_id' => $this->user->getId(), 'propname' => self::PAGE_WIKIA_PROPS_PROPNAME), __METHOD__, array());
         if (!empty($row)) {
             $result = unserialize($row->props);
         }
         $result = empty($result) ? array() : $result;
     }
     wfProfileOut(__METHOD__);
     return $result;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:22,代码来源:FavoriteWikisModel.class.php

示例14: prepareConceptTableInserts

 /**
  * Add cache information to concept data and make sure that there is
  * exactly one value for the concept table.
  *
  * @note This code will vanish when concepts have a more standard
  * handling. So not point in optimizing this much now.
  *
  * @since 1.8
  * @param integer $sid
  * @param &array $insertData
  * @param DatabaseBase $dbr used for reading only
  */
 private function prepareConceptTableInserts($sid, &$insertData, DatabaseBase $dbr)
 {
     // Make sure that there is exactly one row to be written:
     if (array_key_exists('smw_fpt_conc', $insertData) && !empty($insertData['smw_fpt_conc'])) {
         $insertValues = end($insertData['smw_fpt_conc']);
     } else {
         $insertValues = array('concept_txt' => '', 'concept_docu' => '', 'concept_features' => 0, 'concept_size' => -1, 'concept_depth' => -1);
     }
     // Add existing cache status data to this row:
     $row = $dbr->selectRow('smw_fpt_conc', array('cache_date', 'cache_count'), array('s_id' => $sid), 'SMWSQLStoreQueries::updateConcData');
     if ($row === false) {
         $insertValues['cache_date'] = null;
         $insertValues['cache_count'] = null;
     } else {
         $insertValues['cache_date'] = $row->cache_date;
         $insertValues['cache_count'] = $row->cache_count;
     }
     $insertValueKey = self::makeDatabaseRowKey($insertValues);
     $insertData['smw_fpt_conc'] = array($insertValueKey => $insertValues);
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:32,代码来源:SMW_SQLStore3_Writers.php

示例15: getCurrentRenameCount

 protected function getCurrentRenameCount(DatabaseBase $dbw)
 {
     $row = $dbw->selectRow(array('renameuser_status'), array('COUNT(*) as count'), array(), __METHOD__);
     return (int) $row->count;
 }
开发者ID:NDKilla,项目名称:mediawiki-extensions-CentralAuth,代码行数:5,代码来源:forceRenameUsers.php


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