admin: detect recognize installed but not enabled (fix #789)
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/803/head
parent
68cdcffb8d
commit
b0bf05df31
|
@ -83,8 +83,9 @@ class OtherController extends GenericApiController
|
||||||
'places_gis' => Util::getSystemConfig('memories.gis_type'),
|
'places_gis' => Util::getSystemConfig('memories.gis_type'),
|
||||||
|
|
||||||
'systemtags_enabled' => Util::tagsIsEnabled(),
|
'systemtags_enabled' => Util::tagsIsEnabled(),
|
||||||
'recognize_enabled' => Util::recognizeIsEnabled(),
|
|
||||||
'albums_enabled' => Util::albumsIsEnabled(),
|
'albums_enabled' => Util::albumsIsEnabled(),
|
||||||
|
'recognize_installed' => Util::recognizeIsInstalled(),
|
||||||
|
'recognize_enabled' => Util::recognizeIsEnabled(),
|
||||||
'facerecognition_installed' => Util::facerecognitionIsInstalled(),
|
'facerecognition_installed' => Util::facerecognitionIsInstalled(),
|
||||||
'facerecognition_enabled' => Util::facerecognitionIsEnabled(),
|
'facerecognition_enabled' => Util::facerecognitionIsEnabled(),
|
||||||
'preview_generator_enabled' => Util::previewGeneratorIsEnabled(),
|
'preview_generator_enabled' => Util::previewGeneratorIsEnabled(),
|
||||||
|
|
33
lib/Util.php
33
lib/Util.php
|
@ -84,6 +84,23 @@ class Util
|
||||||
* Check if recognize is enabled for this user.
|
* Check if recognize is enabled for this user.
|
||||||
*/
|
*/
|
||||||
public static function recognizeIsEnabled(): bool
|
public static function recognizeIsEnabled(): bool
|
||||||
|
{
|
||||||
|
if (!self::recognizeIsInstalled()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$config = \OC::$server->get(IAppConfig::class);
|
||||||
|
if ('true' !== $config->getValue('recognize', 'faces.enabled', 'false')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if recognize is installed.
|
||||||
|
*/
|
||||||
|
public static function recognizeIsInstalled(): bool
|
||||||
{
|
{
|
||||||
$appManager = \OC::$server->get(IAppManager::class);
|
$appManager = \OC::$server->get(IAppManager::class);
|
||||||
|
|
||||||
|
@ -96,11 +113,6 @@ class Util
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$c = \OC::$server->get(IAppConfig::class);
|
|
||||||
if ('true' !== $c->getValue('recognize', 'faces.enabled', 'false')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,16 +121,21 @@ class Util
|
||||||
*/
|
*/
|
||||||
public static function facerecognitionIsEnabled(): bool
|
public static function facerecognitionIsEnabled(): bool
|
||||||
{
|
{
|
||||||
|
if (!self::facerecognitionIsInstalled()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$uid = self::getUID();
|
$uid = self::getUID();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = \OC::$server->get(IConfig::class);
|
$enabled = \OC::$server->get(IConfig::class)
|
||||||
$e = $config->getUserValue($uid, 'facerecognition', 'enabled', 'false');
|
->getUserValue($uid, 'facerecognition', 'enabled', 'false')
|
||||||
|
;
|
||||||
|
|
||||||
return 'true' === $e;
|
return 'true' === $enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -168,7 +168,7 @@ export default defineComponent({
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.config.facerecognition_enabled) {
|
if (this.config.facerecognition_installed) {
|
||||||
return t('memories', 'People (Recognize)');
|
return t('memories', 'People (Recognize)');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,10 @@
|
||||||
<NcNoteCard :type="sconfig.recognize_enabled ? 'success' : 'warning'">
|
<NcNoteCard :type="sconfig.recognize_enabled ? 'success' : 'warning'">
|
||||||
{{
|
{{
|
||||||
sconfig.recognize_enabled
|
sconfig.recognize_enabled
|
||||||
? t('memories', 'Recognize is installed and enabled.')
|
? t('memories', 'Recognize is installed and enabled for face recognition.')
|
||||||
: t(
|
: sconfig.recognize_installed
|
||||||
'memories',
|
? t('memories', 'Recognize is installed but not enabled for face recognition.')
|
||||||
'Recognize is not installed. Some features like face recognition and object tagging may be unavailable.'
|
: t('memories', 'Recognize is not installed. Face recognition and object tagging may be unavailable.')
|
||||||
)
|
|
||||||
}}
|
}}
|
||||||
</NcNoteCard>
|
</NcNoteCard>
|
||||||
<NcNoteCard v-if="sconfig.facerecognition_installed" type="success">
|
<NcNoteCard v-if="sconfig.facerecognition_installed" type="success">
|
||||||
|
|
|
@ -103,8 +103,9 @@ class StaticConfig {
|
||||||
places_gis: -1,
|
places_gis: -1,
|
||||||
|
|
||||||
systemtags_enabled: false,
|
systemtags_enabled: false,
|
||||||
recognize_enabled: false,
|
|
||||||
albums_enabled: false,
|
albums_enabled: false,
|
||||||
|
recognize_installed: false,
|
||||||
|
recognize_enabled: false,
|
||||||
facerecognition_installed: false,
|
facerecognition_installed: false,
|
||||||
facerecognition_enabled: false,
|
facerecognition_enabled: false,
|
||||||
preview_generator_enabled: false,
|
preview_generator_enabled: false,
|
||||||
|
|
|
@ -236,8 +236,9 @@ export type IConfig = {
|
||||||
places_gis: number;
|
places_gis: number;
|
||||||
|
|
||||||
systemtags_enabled: boolean;
|
systemtags_enabled: boolean;
|
||||||
recognize_enabled: boolean;
|
|
||||||
albums_enabled: boolean;
|
albums_enabled: boolean;
|
||||||
|
recognize_installed: boolean;
|
||||||
|
recognize_enabled: boolean;
|
||||||
facerecognition_installed: boolean;
|
facerecognition_installed: boolean;
|
||||||
facerecognition_enabled: boolean;
|
facerecognition_enabled: boolean;
|
||||||
preview_generator_enabled: boolean;
|
preview_generator_enabled: boolean;
|
||||||
|
|
Loading…
Reference in New Issue