X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FExternalStore.php;h=1b7c29dbbbf277e1113311f5a55b3c05cc2efa0b;hb=39142e28044c514fc2841ee78f811e63eaf3e636;hp=61d4ef7c37831d746552961fb33f85b0cf752690;hpb=f2e6488dd8f00e9549e352f91bc02bd1be50ad11;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ExternalStore.php b/includes/ExternalStore.php index 61d4ef7c37..1b7c29dbbb 100644 --- a/includes/ExternalStore.php +++ b/includes/ExternalStore.php @@ -35,11 +35,14 @@ */ 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