Development

Changeset 28548

You must first sign up to be able to contribute.

Changeset 28548

Show
Ignore:
Timestamp:
03/16/10 12:23:02 (3 years ago)
Author:
rick
Message:

cleanup

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfCouchPlugin/trunk/lib/sfCouchConnection.class.php

    r28546 r28548  
    365365              break; 
    366366        } 
     367         
     368        if ($headers['content-type'] == 'application/octet-stream') { 
     369          return ($body); 
     370        } 
    367371 
    368372        // Create repsonse object from couch db response 
     
    370374    } 
    371375} 
    372  
  • plugins/sfCouchPlugin/trunk/lib/sfCouchDocument.class.php

    r28546 r28548  
    346346            ); 
    347347        } 
    348          
    349         print_r($response); 
    350348     
    351349        if (empty($response)) { 
     
    417415     * 
    418416     * @param string $fileName 
    419      * @return sfCouchDataRespons
     417     * @return String tempFileNam
    420418     */ 
    421419    public function getFile( $fileName ) 
     
    423421        if ( !isset( $this->storage->_attachments[$fileName] ) ) 
    424422        { 
    425             throw new sfException( $fileName )
     423            return null
    426424        } 
    427425 
     
    432430        ); 
    433431 
    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; 
    435440    } 
    436441} 
  • plugins/sfCouchPlugin/trunk/lib/sfCouchResponse.class.php

    r28546 r28548  
    151151    } 
    152152} 
    153  
    154  
  • plugins/sfCouchPlugin/trunk/lib/sfCouchView.class.php

    r28546 r28548  
    11<?php 
    22/** 
    3  * Wrapper base for views in the database 
     3 * Wrapper for views in the database 
    44 * 
    55 * @package Core 
     
    2424     * @return string 
    2525     */ 
    26     private static function buildViewQuery( array $options
     26    private static function buildViewQuery(array $options
    2727    { 
    2828        // Return empty query string, if no options has been passed 
     
    113113        // Always refresh the configuration in debug mode 
    114114        if(sfConfig::get('sf_debug')) { 
    115           self::refreshDesignDoc(); 
     115          self::checkDesignDoc($view); 
    116116        } 
    117117         
     
    127127            // the query again. If it still fails, there is most probably a 
    128128            // real problem. 
    129             if (!sfConfig::get('sf_debug') && self::refreshDesignDoc()) { 
     129            if (!sfConfig::get('sf_debug') && self::checkDesignDoc($view)) { 
    130130              $response = $db->get($url); 
    131131            } 
     
    145145     * @return void 
    146146     */ 
    147     public static function refreshDesignDoc(
     147    public static function checkDesignDoc($checkView = null
    148148    { 
    149149      $designDoc = new sfCouchDocument(self::viewName); 
     
    156156 
    157157        $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; 
    158167    } 
    159168