Changeset 28548
- Timestamp:
- 03/16/10 12:23:02 (3 years ago)
- Files:
-
- plugins/sfCouchPlugin/trunk/lib/sfCouchConnection.class.php (modified) (2 diffs)
- plugins/sfCouchPlugin/trunk/lib/sfCouchDocument.class.php (modified) (4 diffs)
- plugins/sfCouchPlugin/trunk/lib/sfCouchResponse.class.php (modified) (1 diff)
- plugins/sfCouchPlugin/trunk/lib/sfCouchView.class.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfCouchPlugin/trunk/lib/sfCouchConnection.class.php
r28546 r28548 365 365 break; 366 366 } 367 368 if ($headers['content-type'] == 'application/octet-stream') { 369 return ($body); 370 } 367 371 368 372 // Create repsonse object from couch db response … … 370 374 } 371 375 } 372 plugins/sfCouchPlugin/trunk/lib/sfCouchDocument.class.php
r28546 r28548 346 346 ); 347 347 } 348 349 print_r($response);350 348 351 349 if (empty($response)) { … … 417 415 * 418 416 * @param string $fileName 419 * @return sfCouchDataResponse417 * @return String tempFileName 420 418 */ 421 419 public function getFile( $fileName ) … … 423 421 if ( !isset( $this->storage->_attachments[$fileName] ) ) 424 422 { 425 throw new sfException( $fileName );423 return null; 426 424 } 427 425 … … 432 430 ); 433 431 434 return $response; 432 if (is_null($response)) { 433 return null; 434 } 435 436 $fileName = tempnam(sys_get_temp_dir(), 'sfCouch_'); 437 file_put_contents($fileName, $response); 438 439 return $fileName; 435 440 } 436 441 } plugins/sfCouchPlugin/trunk/lib/sfCouchResponse.class.php
r28546 r28548 151 151 } 152 152 } 153 154 plugins/sfCouchPlugin/trunk/lib/sfCouchView.class.php
r28546 r28548 1 1 <?php 2 2 /** 3 * Wrapper basefor views in the database3 * Wrapper for views in the database 4 4 * 5 5 * @package Core … … 24 24 * @return string 25 25 */ 26 private static function buildViewQuery( array $options)26 private static function buildViewQuery(array $options) 27 27 { 28 28 // Return empty query string, if no options has been passed … … 113 113 // Always refresh the configuration in debug mode 114 114 if(sfConfig::get('sf_debug')) { 115 self:: refreshDesignDoc();115 self::checkDesignDoc($view); 116 116 } 117 117 … … 127 127 // the query again. If it still fails, there is most probably a 128 128 // real problem. 129 if (!sfConfig::get('sf_debug') && self:: refreshDesignDoc()) {129 if (!sfConfig::get('sf_debug') && self::checkDesignDoc($view)) { 130 130 $response = $db->get($url); 131 131 } … … 145 145 * @return void 146 146 */ 147 public static function refreshDesignDoc()147 public static function checkDesignDoc($checkView = null) 148 148 { 149 149 $designDoc = new sfCouchDocument(self::viewName); … … 156 156 157 157 $designDoc->save(); 158 159 if ($checkView) { 160 if (!array_key_exists($checkView, $designDoc->views)) { 161 throw new sfException("The view '$checkView' doesn't exist. 162 Create it in /config/couchdb/".$checkView."_map.js"); 163 } 164 } 165 166 return true; 158 167 } 159 168