* Fix image redirect caching so it doesn't break image redirects on shared repositories
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index fb2dfaa..8aac928 100644 (file)
@@ -2337,13 +2337,8 @@ function wfFormatStackFrame($frame) {
  * Get a cache key
  */
 function wfMemcKey( /*... */ ) {
-       global $wgDBprefix, $wgDBname;
        $args = func_get_args();
-       if ( $wgDBprefix ) {
-               $key = "$wgDBname-$wgDBprefix:" . implode( ':', $args );
-       } else {
-               $key = $wgDBname . ':' . implode( ':', $args );
-       }
+       $key = wfWikiID() . ':' . implode( ':', $args );
        return $key;
 }
 
@@ -2364,12 +2359,16 @@ function wfForeignMemcKey( $db, $prefix /*, ... */ ) {
  * Get an ASCII string identifying this wiki
  * This is used as a prefix in memcached keys
  */
-function wfWikiID() {
-       global $wgDBprefix, $wgDBname;
-       if ( $wgDBprefix ) {
-               return "$wgDBname-$wgDBprefix";
+function wfWikiID( $db = null ) {
+       if( $db instanceof Database ) {
+               return $db->getWikiID();
        } else {
-               return $wgDBname;
+       global $wgDBprefix, $wgDBname;
+               if ( $wgDBprefix ) {
+                       return "$wgDBname-$wgDBprefix";
+               } else {
+                       return $wgDBname;
+               }
        }
 }
 
@@ -2425,10 +2424,11 @@ function &wfGetLBFactory() {
  * @param mixed $time Requested time for an archived image, or false for the
  *                    current version. An image object will be returned which
  *                    was created at the specified time.
+ * @param mixed $flags FileRepo::FIND_ flags
  * @return File, or false if the file does not exist
  */
-function wfFindFile( $title, $time = false ) {
-       return RepoGroup::singleton()->findFile( $title, $time );
+function wfFindFile( $title, $time = false, $flags = 0 ) {
+       return RepoGroup::singleton()->findFile( $title, $time, $flags );
 }
 
 /**
@@ -2547,6 +2547,10 @@ function wfMaxlagError( $host, $lag, $maxLag ) {
  * @return null
  */
 function wfDeprecated( $function ) {
+       global $wgDebugLogFile;
+       if ( !$wgDebugLogFile ) {
+               return;
+       }
        $callers = wfDebugBacktrace();
        if( isset( $callers[2] ) ){
                $callerfunc = $callers[2];
@@ -2560,10 +2564,11 @@ function wfDeprecated( $function ) {
                if( isset( $callerfunc['class'] ) )
                        $func .= $callerfunc['class'] . '::';
                $func .= @$callerfunc['function'];
-               trigger_error( "Use of $function is deprecated. Called from $func in $file", E_USER_NOTICE );
+               $msg = "Use of $function is deprecated. Called from $func in $file";
        } else {
-               trigger_error( "Use of $function is deprecated.", E_USER_NOTICE );
+               $msg = "Use of $function is deprecated.";
        }
+       wfDebug( "$msg\n" );
 }
 
 /**
@@ -2603,23 +2608,3 @@ function wfWaitForSlaves( $maxLag ) {
 
        return md5( mt_rand( 0, 0x7fffffff ) . $salt );
 }
-
-/**
- * Generate a list of all available rights.
- * @todo Doesn't list any rights which aren't assigned to a group.
- */
-function wfGetAvailableRights() {
-       global $wgGroupPermissions;
-       
-       $rights = array();
-       
-       foreach( $wgGroupPermissions as $permissions ) {
-               $rights = array_merge( array_keys($permissions),$rights );
-       }
-       
-       $rights = array_unique($rights);
-       
-       wfRunHooks( 'GetAvailableRights', array( &$rights ) );
-       
-       return $rights;
-}