Merge "Fixed dependencies for jquery.collapsibleTabs"
[lhc/web/wiklou.git] / includes / ExternalStore.php
index 61d4ef7..1b7c29d 100644 (file)
  */
 class ExternalStore {
        var $mParams;
-       
+
+       /**
+        * @param $params array
+        */
        function __construct( $params = array() ) {
                $this->mParams = $params;
        }
-       
+
        /**
         * Fetch data from given URL
         *
@@ -50,8 +53,9 @@ class ExternalStore {
        static function fetchFromURL( $url, $params = array() ) {
                global $wgExternalStores;
 
-               if( !$wgExternalStores )
+               if( !$wgExternalStores ) {
                        return false;
+               }
 
                $parts = explode( '://', $url, 2 );
 
@@ -66,8 +70,10 @@ class ExternalStore {
                }
 
                $store = self::getStoreObject( $proto, $params );
-               if ( $store === false )
+               if ( $store === false ) {
                        return false;
+               }
+
                return $store->fetchFromURL( $url );
        }
 
@@ -76,15 +82,18 @@ class ExternalStore {
         *
         * @param $proto String: type of external storage, should be a value in $wgExternalStores
         * @param $params Array: associative array of parameters for the ExternalStore object.
-        * @return ExternalStore subclass or false on error
+        * @return ExternalStore|bool ExternalStore class or false on error
         */
        static function getStoreObject( $proto, $params = array() ) {
                global $wgExternalStores;
-               if( !$wgExternalStores )
+               if( !$wgExternalStores ) {
                        return false;
+               }
+
                /* Protocol not enabled */
-               if( !in_array( $proto, $wgExternalStores ) )
+               if( !in_array( $proto, $wgExternalStores ) ) {
                        return false;
+               }
 
                $class = 'ExternalStore' . ucfirst( $proto );
                /* Any custom modules should be added to $wgAutoLoadClasses for on-demand loading */
@@ -113,7 +122,7 @@ class ExternalStore {
                        return $store->store( $params, $data );
                }
        }
-       
+
        /**
         * Like insert() above, but does more of the work for us.
         * This function does not need a url param, it builds it by
@@ -121,7 +130,8 @@ class ExternalStore {
         *
         * @param $data String
         * @param $storageParams Array: associative array of parameters for the ExternalStore object.
-        * @return string The URL of the stored data item, or false on error
+        * @throws MWException|DBConnectionError|DBQueryError
+        * @return string|bool The URL of the stored data item, or false on error
         */
        public static function insertToDefault( $data, $storageParams = array() ) {
                global $wgDefaultExternalStore;
@@ -159,7 +169,7 @@ class ExternalStore {
                        throw new MWException( "Unable to store text to external storage" );
                }
        }
-       
+
        /**
         * @param $data
         * @param $wiki