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


PHP DataSource::listSources方法代码示例

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


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

示例1: _renameTable

 /**
  * Rename Table method
  *
  * @param string $type Type of operation to be done, this case 'rename_table'
  * @param array $tables List of tables to be renamed
  * @return boolean Return true in case of success, otherwise false
  * @access protected
  */
 protected function _renameTable($type, $tables)
 {
     foreach ($tables as $oldName => $newName) {
         $sources = $this->db->listSources();
         if (!in_array($oldName, $sources)) {
             throw new MigrationException($this, sprintf(__d('migrations', 'Table "%s" does not exists in database.', true), $oldName));
         } else {
             if (in_array($newName, $sources)) {
                 throw new MigrationException($this, sprintf(__d('migrations', 'Table "%s" already exists in database.', true), $newName));
             }
         }
         $sql = 'RENAME TABLE ' . $this->db->fullTableName($oldName) . ' TO ' . $this->db->fullTableName($newName) . ';';
         $this->_invokeCallbacks('beforeAction', 'rename_table', array('old_name' => $oldName, 'new_name' => $newName));
         if (@$this->db->execute($sql) === false) {
             throw new MigrationException($this, sprintf(__d('migrations', 'SQL Error: %s', true), $this->db->error));
         }
         $this->_invokeCallbacks('afterAction', 'rename_table', array('old_name' => $oldName, 'new_name' => $newName));
     }
     return true;
 }
开发者ID:vinicius-ianni,项目名称:PHPMyScrum,代码行数:28,代码来源:cake_migration.php

示例2: listSources

 /**
  * List available sources
  *
  * @return array of available CSV files
  */
 public function listSources()
 {
     $this->config['database'] = 'csv';
     $cache = parent::listSources();
     if ($cache !== null) {
         return $cache;
     }
     $extPattern = '\\.' . preg_quote($this->config['extension']);
     if ($this->config['recursive']) {
         $list = $this->connection->findRecursive('.*' . $extPattern, true);
         foreach ($list as &$item) {
             $item = mb_substr($item, mb_strlen($this->config['path'] . DS));
         }
     } else {
         $list = $this->connection->find('.*' . $extPattern, true);
     }
     foreach ($list as &$item) {
         $item = preg_replace('/' . $extPattern . '$/i', '', $item);
     }
     parent::listSources($list);
     unset($this->config['database']);
     return $list;
 }
开发者ID:kishoreks,项目名称:cakento,代码行数:28,代码来源:csv_source.php

示例3: listSources

 /**
  * Caches/returns cached results for child instances.
  *
  * @param mixed $data List of tables
  * @return array Array of sources available in this datasource
  */
 public function listSources($data = null)
 {
     return parent::listSources($data);
 }
开发者ID:oefenweb,项目名称:cakephp-redis,代码行数:10,代码来源:RedisSource.php

示例4: listSources

 /**
  * listSources
  * @param null $data
  * @return array|null
  */
 public function listSources($data = null)
 {
     return parent::listSources($data);
     // TODO: Change the autogenerated stub
 }
开发者ID:lsantosc,项目名称:cakephp-mediapost,代码行数:10,代码来源:MediaPostSource.php

示例5: listSources

 /**
  * Returns an array of sources (tables) in the database.
  *
  * @param mixed $data
  * @return array Array of tablenames in the database
  */
 public function listSources($data = null)
 {
     $cache = parent::listSources();
     if ($cache !== null) {
         return $cache;
     }
 }
开发者ID:byu-oit-appdev,项目名称:eamWS,代码行数:13,代码来源:LdapSource.php

示例6: listSources

 /**
  * undocumented function
  *
  * @return void
  * @access public
  */
 function listSources($refresh = false)
 {
     if (!$this->connected() && !$this->login()) {
         return false;
     }
     $cache = parent::listSources();
     if (!$refresh && $cache != null) {
         return $cache;
     }
     $sources = array();
     $response = $this->Http->get('https://www.google.com/analytics/home/?et=reset&hl=en-US&ns=100');
     $optionsRegex = '/<option.+?value="([0-9]+)".*?>([^<]+)<\\/option>/si';
     preg_match('/<select.+?name="account_list".*?>(.+?)<\\/select>/is', $response, $accounts);
     if (empty($accounts)) {
         return false;
     }
     preg_match_all($optionsRegex, $accounts[1], $accounts, PREG_SET_ORDER);
     if (empty($accounts)) {
         return false;
     }
     foreach ($accounts as $i => $account) {
         list(, $id, $name) = $account;
         if (empty($id) || !is_numeric($id)) {
             continue;
         }
         $account = array('Account' => compact('id', 'name'));
         if ($i != 0) {
             $response = $this->Http->get('https://www.google.com/analytics/home/admin?scid=' . $id . '&ns=100');
         }
         preg_match('/<select.+?name="profile_list".*?>(.+?)<\\/select>/is', $response, $profiles);
         if (empty($profiles)) {
             $account['Profile'] = array();
             continue;
         }
         preg_match_all($optionsRegex, $profiles[1], $profiles, PREG_SET_ORDER);
         foreach ($profiles as $profile) {
             list(, $id, $name) = $profile;
             if (empty($id) || !is_numeric($id)) {
                 continue;
             }
             $account['Profile'][] = compact('id', 'name');
         }
         $sources[] = $account;
     }
     parent::listSources($sources);
     return $sources;
 }
开发者ID:jimiyash,项目名称:debuggable-scraps,代码行数:53,代码来源:google_analytics_source.php

示例7: listSources

 /**
  * Lists all couchdb databases, and caches the response
  *
  * @param  array $data Data to be cached in parent call to DataSource::listSources().
  * @return array       Array of couchdb sources
  * @todo Move URI mangling to DivanSource::uri()
  */
 public function listSources($data = null)
 {
     $cache = parent::listSources($data);
     if ($cache != null) {
         return $cache;
     }
     $sources = $this->_decode($this->Socket->get($this->uri() . '_all_dbs'));
     parent::listSources($sources);
     return $sources;
 }
开发者ID:BigBlueHat,项目名称:divan,代码行数:17,代码来源:divan_source.php


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