auto configure CBE theme for moodle
parent
1ae7652fbb
commit
faa6a0c449
|
@ -52,8 +52,42 @@ class Postup():
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
log.info('Got moodle pem certificate.')
|
log.info('Got moodle pem certificate.')
|
||||||
|
|
||||||
|
self.select_and_configure_theme()
|
||||||
self.add_moodle_ws_token()
|
self.add_moodle_ws_token()
|
||||||
|
|
||||||
|
def select_and_configure_theme(self,theme='cbe'):
|
||||||
|
try:
|
||||||
|
self.pg.update("""UPDATE "mdl_config" SET value = '%s' WHERE "name" = 'theme';""" % (theme))
|
||||||
|
except:
|
||||||
|
log.error(traceback.format_exc())
|
||||||
|
exit(1)
|
||||||
|
None
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.pg.update("""UPDATE "mdl_config_plugins" SET value = '%s' WHERE "plugin" = 'theme_cbe' AND "name" = 'host';""" % (os.environ['DOMAIN']))
|
||||||
|
self.pg.update("""UPDATE "mdl_config_plugins" SET value = '%s' WHERE "plugin" = 'theme_cbe' AND "name" = 'logourl';""" % ("https://api."+os.environ['DOMAIN']+"/img/logo.png"))
|
||||||
|
self.pg.update("""UPDATE "mdl_config_plugins" SET value = '1' WHERE "plugin" = 'theme_cbe' AND "name" = 'header_api';""")
|
||||||
|
self.pg.update("""UPDATE "mdl_config_plugins" SET value = '1' WHERE "plugin" = 'theme_cbe' AND "name" = 'vclasses_direct';""")
|
||||||
|
self.pg.update("""UPDATE "mdl_config_plugins" SET value = '1' WHERE "plugin" = 'theme_cbe' AND "name" = 'uniquenamecourse';""")
|
||||||
|
except:
|
||||||
|
log.error(traceback.format_exc())
|
||||||
|
exit(1)
|
||||||
|
None
|
||||||
|
# INSERT INTO "mdl_config_plugins" ("id", "plugin", "name", "value") VALUES
|
||||||
|
# (202, 'theme_cbe', 'vclasses_direct', '0'),
|
||||||
|
# (203, 'theme_cbe', 'uniquenamecourse', '0'),
|
||||||
|
# (204, 'theme_cbe', 'brandcolor', '#d5045c'),
|
||||||
|
# (205, 'theme_cbe', 'secondarycolor', '#FFFFFF'),
|
||||||
|
# (206, 'theme_cbe', 'backboardcolor', '#F0F0F0'),
|
||||||
|
# (207, 'theme_cbe', 'flipcolor', '0'),
|
||||||
|
# (208, 'theme_cbe', 'scsspre', ''),
|
||||||
|
# (209, 'theme_cbe', 'scss', ''),
|
||||||
|
# (201, 'theme_cbe', 'header_api', '1'),
|
||||||
|
# (873, 'theme_cbe', 'version', '2021051700'),
|
||||||
|
# (2059, 'theme_cbe', 'themerev', '1622319429'),
|
||||||
|
# (200, 'theme_cbe', 'logourl', 'https://api.santantoni.duckdns.org/img/logo.png'),
|
||||||
|
# (199, 'theme_cbe', 'host', 'santantoni.duckdns.org');
|
||||||
|
|
||||||
def add_moodle_ws_token(self):
|
def add_moodle_ws_token(self):
|
||||||
try:
|
try:
|
||||||
token=self.pg.select("""SELECT * FROM "mdl_external_tokens" WHERE "externalserviceid" = 3""")[0][1]
|
token=self.pg.select("""SELECT * FROM "mdl_external_tokens" WHERE "externalserviceid" = 3""")[0][1]
|
||||||
|
|
Loading…
Reference in New Issue