mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
Fixing getting random photo with mysql #683
This commit is contained in:
parent
33ca2040a8
commit
8fc0512998
@ -1,6 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
* Keeps the environment context
|
* Keeps the environment context
|
||||||
*/
|
*/
|
||||||
export const ServerEnvironment = {
|
export const ServerEnvironment: { sendMailAvailable?: boolean } = {};
|
||||||
sendMailAvailable: false
|
|
||||||
};
|
|
||||||
|
@ -382,8 +382,9 @@ export class SearchManager {
|
|||||||
case SortingMethods.random:
|
case SortingMethods.random:
|
||||||
if (Config.Database.type === DatabaseType.mysql) {
|
if (Config.Database.type === DatabaseType.mysql) {
|
||||||
query.groupBy('RAND(), media.id');
|
query.groupBy('RAND(), media.id');
|
||||||
}
|
} else {
|
||||||
query.groupBy('RANDOM()');
|
query.groupBy('RANDOM()');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,6 @@ import {IConfigClass} from 'typeconfig/common';
|
|||||||
import {PasswordHelper} from '../../../backend/model/PasswordHelper';
|
import {PasswordHelper} from '../../../backend/model/PasswordHelper';
|
||||||
import {TAGS} from '../public/ClientConfig';
|
import {TAGS} from '../public/ClientConfig';
|
||||||
import {ServerEnvironment} from '../../../backend/Environment';
|
import {ServerEnvironment} from '../../../backend/Environment';
|
||||||
import {EmailMessagingType} from './MessagingConfig';
|
|
||||||
import {Logger} from '../../../backend/Logger';
|
|
||||||
|
|
||||||
declare const process: any;
|
declare const process: any;
|
||||||
|
|
||||||
@ -82,8 +80,10 @@ export class PrivateConfigClass extends ServerConfig {
|
|||||||
require('../../../../package.json').buildCommitHash;
|
require('../../../../package.json').buildCommitHash;
|
||||||
this.Environment.upTime = upTime;
|
this.Environment.upTime = upTime;
|
||||||
this.Environment.isDocker = !!process.env.PI_DOCKER;
|
this.Environment.isDocker = !!process.env.PI_DOCKER;
|
||||||
|
if (typeof ServerEnvironment.sendMailAvailable !== 'undefined') {
|
||||||
this.Environment.sendMailAvailable = ServerEnvironment.sendMailAvailable;
|
this.Environment.sendMailAvailable = ServerEnvironment.sendMailAvailable;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async original(): Promise<PrivateConfigClass & IConfigClass> {
|
async original(): Promise<PrivateConfigClass & IConfigClass> {
|
||||||
const pc = ConfigClassBuilder.attachPrivateInterface(new PrivateConfigClass());
|
const pc = ConfigClassBuilder.attachPrivateInterface(new PrivateConfigClass());
|
||||||
|
Loading…
Reference in New Issue
Block a user