* 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;
}
* 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;
+ }
}
}
* @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 );
}
/**
* @return null
*/
function wfDeprecated( $function ) {
+ global $wgDebugLogFile;
+ if ( !$wgDebugLogFile ) {
+ return;
+ }
$callers = wfDebugBacktrace();
if( isset( $callers[2] ) ){
$callerfunc = $callers[2];
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" );
}
/**
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;
-}