mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 08:28:11 +00:00
is_db_sqlite3 (#5607)
This commit is contained in:
@@ -8,7 +8,7 @@ import { Utils } from '../utils/utils';
|
|||||||
import toaster from './toast';
|
import toaster from './toast';
|
||||||
import Group from '../models/group';
|
import Group from '../models/group';
|
||||||
|
|
||||||
import { canViewOrg, isDocs, isPro, customNavItems } from '../utils/constants';
|
import { canViewOrg, isDocs, isPro, isDBSqlite3, customNavItems } from '../utils/constants';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
currentTab: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
currentTab: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
||||||
@@ -180,7 +180,7 @@ class MainSideNav extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let showActivity = isDocs || isPro;
|
let showActivity = isDocs || isPro || !isDBSqlite3;
|
||||||
return (
|
return (
|
||||||
<div className="side-nav">
|
<div className="side-nav">
|
||||||
<div className="side-nav-con">
|
<div className="side-nav-con">
|
||||||
|
@@ -6,7 +6,7 @@ import { gettext, siteRoot, isPro, otherPermission, canViewSystemInfo, canViewSt
|
|||||||
canConfigSystem, canManageLibrary, canManageUser, canManageGroup, canViewUserLog,
|
canConfigSystem, canManageLibrary, canManageUser, canManageGroup, canViewUserLog,
|
||||||
canViewAdminLog, constanceEnabled, multiTenancy, multiInstitution, sysadminExtraEnabled,
|
canViewAdminLog, constanceEnabled, multiTenancy, multiInstitution, sysadminExtraEnabled,
|
||||||
enableGuestInvitation, enableTermsAndConditions, enableFileScan, enableWorkWeixin, enableDingtalk,
|
enableGuestInvitation, enableTermsAndConditions, enableFileScan, enableWorkWeixin, enableDingtalk,
|
||||||
enableShareLinkReportAbuse } from '../../utils/constants';
|
enableShareLinkReportAbuse, isDBSqlite3 } from '../../utils/constants';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
isSidePanelClosed: PropTypes.bool.isRequired,
|
isSidePanelClosed: PropTypes.bool.isRequired,
|
||||||
@@ -44,7 +44,7 @@ class SidePanel extends React.Component {
|
|||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
{isPro && canViewStatistic &&
|
{(isPro || !isDBSqlite3) && canViewStatistic &&
|
||||||
<li className="nav-item">
|
<li className="nav-item">
|
||||||
<Link className={`nav-link ellipsis ${this.getActiveClass('statistic')}`}
|
<Link className={`nav-link ellipsis ${this.getActiveClass('statistic')}`}
|
||||||
to={siteRoot + 'sys/statistics/file/'}
|
to={siteRoot + 'sys/statistics/file/'}
|
||||||
|
@@ -16,6 +16,7 @@ export const siteName = window.app.config.siteName;
|
|||||||
export const logoWidth = window.app.config.logoWidth;
|
export const logoWidth = window.app.config.logoWidth;
|
||||||
export const logoHeight = window.app.config.logoHeight;
|
export const logoHeight = window.app.config.logoHeight;
|
||||||
export const isPro = window.app.config.isPro === 'True';
|
export const isPro = window.app.config.isPro === 'True';
|
||||||
|
export const isDBSqlite3 = window.app.config.isDBSqlite3;
|
||||||
export const isDocs = window.app.config.isDocs === 'True';
|
export const isDocs = window.app.config.isDocs === 'True';
|
||||||
export const lang = window.app.config.lang;
|
export const lang = window.app.config.lang;
|
||||||
export const fileServerRoot = window.app.config.fileServerRoot;
|
export const fileServerRoot = window.app.config.fileServerRoot;
|
||||||
|
@@ -10,7 +10,7 @@ from rest_framework.permissions import IsAuthenticated
|
|||||||
from rest_framework.authentication import SessionAuthentication
|
from rest_framework.authentication import SessionAuthentication
|
||||||
|
|
||||||
from seahub.base.templatetags.seahub_tags import email2contact_email
|
from seahub.base.templatetags.seahub_tags import email2contact_email
|
||||||
from seahub.utils import EVENTS_ENABLED, get_user_activities
|
from seahub.utils import EVENTS_ENABLED, get_user_activities, is_pro_version, IS_DB_SQLITE3
|
||||||
from seahub.utils.timeutils import utc_datetime_to_isoformat_timestr
|
from seahub.utils.timeutils import utc_datetime_to_isoformat_timestr
|
||||||
from seahub.api2.utils import api_error
|
from seahub.api2.utils import api_error
|
||||||
from seahub.api2.throttling import UserRateThrottle
|
from seahub.api2.throttling import UserRateThrottle
|
||||||
@@ -27,7 +27,7 @@ class ActivitiesView(APIView):
|
|||||||
throttle_classes = (UserRateThrottle, )
|
throttle_classes = (UserRateThrottle, )
|
||||||
|
|
||||||
def get(self, request, format=None):
|
def get(self, request, format=None):
|
||||||
if not EVENTS_ENABLED:
|
if not EVENTS_ENABLED or (not is_pro_version() and IS_DB_SQLITE3):
|
||||||
events = None
|
events = None
|
||||||
return api_error(status.HTTP_404_NOT_FOUND, 'Events not enabled.')
|
return api_error(status.HTTP_404_NOT_FOUND, 'Events not enabled.')
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ from django.http import HttpResponse
|
|||||||
|
|
||||||
from seaserv import ccnet_api
|
from seaserv import ccnet_api
|
||||||
|
|
||||||
from seahub.utils import get_file_ops_stats_by_day, \
|
from seahub.utils import get_file_ops_stats_by_day, IS_DB_SQLITE3, \
|
||||||
get_total_storage_stats_by_day, get_user_activity_stats_by_day, \
|
get_total_storage_stats_by_day, get_user_activity_stats_by_day, \
|
||||||
is_pro_version, EVENTS_ENABLED, get_system_traffic_by_day, \
|
is_pro_version, EVENTS_ENABLED, get_system_traffic_by_day, \
|
||||||
get_all_users_traffic_by_month, get_all_orgs_traffic_by_month
|
get_all_users_traffic_by_month, get_all_orgs_traffic_by_month
|
||||||
@@ -34,7 +34,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
def check_parameter(func):
|
def check_parameter(func):
|
||||||
def _decorated(view, request, *args, **kwargs):
|
def _decorated(view, request, *args, **kwargs):
|
||||||
if not is_pro_version() or not EVENTS_ENABLED:
|
if not EVENTS_ENABLED or (not is_pro_version() and IS_DB_SQLITE3):
|
||||||
return api_error(status.HTTP_404_NOT_FOUND, 'Events not enabled.')
|
return api_error(status.HTTP_404_NOT_FOUND, 'Events not enabled.')
|
||||||
start_time = request.GET.get("start", "")
|
start_time = request.GET.get("start", "")
|
||||||
end_time = request.GET.get("end", "")
|
end_time = request.GET.get("end", "")
|
||||||
|
@@ -34,7 +34,8 @@ from seahub.utils import get_site_name, get_service_url
|
|||||||
from seahub.avatar.templatetags.avatar_tags import api_avatar_url
|
from seahub.avatar.templatetags.avatar_tags import api_avatar_url
|
||||||
|
|
||||||
|
|
||||||
from seahub.utils import HAS_FILE_SEARCH, EVENTS_ENABLED, is_pro_version, ENABLE_REPO_AUTO_DEL
|
from seahub.utils import HAS_FILE_SEARCH, EVENTS_ENABLED, is_pro_version, ENABLE_REPO_AUTO_DEL, \
|
||||||
|
IS_DB_SQLITE3
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from seahub.settings import MULTI_TENANCY
|
from seahub.settings import MULTI_TENANCY
|
||||||
@@ -151,6 +152,7 @@ def base(request):
|
|||||||
'enable_terms_and_conditions': config.ENABLE_TERMS_AND_CONDITIONS,
|
'enable_terms_and_conditions': config.ENABLE_TERMS_AND_CONDITIONS,
|
||||||
'show_logout_icon': SHOW_LOGOUT_ICON,
|
'show_logout_icon': SHOW_LOGOUT_ICON,
|
||||||
'is_pro': True if is_pro_version() else False,
|
'is_pro': True if is_pro_version() else False,
|
||||||
|
'is_db_sqlite3': IS_DB_SQLITE3,
|
||||||
'is_docs': ENABLE_SEAFILE_DOCS,
|
'is_docs': ENABLE_SEAFILE_DOCS,
|
||||||
'enable_upload_folder': dj_settings.ENABLE_UPLOAD_FOLDER,
|
'enable_upload_folder': dj_settings.ENABLE_UPLOAD_FOLDER,
|
||||||
'enable_resumable_fileupload': dj_settings.ENABLE_RESUMABLE_FILEUPLOAD,
|
'enable_resumable_fileupload': dj_settings.ENABLE_RESUMABLE_FILEUPLOAD,
|
||||||
|
@@ -43,6 +43,7 @@
|
|||||||
siteRoot: '{{ SITE_ROOT }}',
|
siteRoot: '{{ SITE_ROOT }}',
|
||||||
loginUrl: '{{ LOGIN_URL }}',
|
loginUrl: '{{ LOGIN_URL }}',
|
||||||
isPro: '{{ is_pro }}',
|
isPro: '{{ is_pro }}',
|
||||||
|
isDBSqlite3: {% if is_db_sqlite3 %} true {% else %} false {% endif %},
|
||||||
isDocs: '{{ is_docs }}',
|
isDocs: '{{ is_docs }}',
|
||||||
lang: '{{ LANGUAGE_CODE }}',
|
lang: '{{ LANGUAGE_CODE }}',
|
||||||
fileServerRoot: '{{ FILE_SERVER_ROOT }}',
|
fileServerRoot: '{{ FILE_SERVER_ROOT }}',
|
||||||
|
@@ -105,6 +105,17 @@ def is_cluster_mode():
|
|||||||
|
|
||||||
CLUSTER_MODE = is_cluster_mode()
|
CLUSTER_MODE = is_cluster_mode()
|
||||||
|
|
||||||
|
def is_db_sqlite3():
|
||||||
|
is_db_sqlite3 = False
|
||||||
|
try:
|
||||||
|
if 'sqlite3' in seahub.settings.DATABASES['default']['ENGINE']:
|
||||||
|
is_db_sqlite3 = True
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return is_db_sqlite3
|
||||||
|
|
||||||
|
IS_DB_SQLITE3 = is_db_sqlite3()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from seahub.settings import OFFICE_CONVERTOR_ROOT
|
from seahub.settings import OFFICE_CONVERTOR_ROOT
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
Reference in New Issue
Block a user