Loading plugins/media/media.cpp +6 −18 Changes for plugins/media/media.cpp: 6 added lines, 18 removed lines. Original line number Diff line number Diff line Loading @@ -495,28 +495,16 @@ namespace blogi { Args->database[0]->exec(sql,res); Args->edit->addIcon(icondata,icondatalen,"selimage","webp","Insert Image from media albums"); getConfig(*Args->database[0],"REDISHOST",host); getConfig(*Args->database[0],"REDISPASSWORD",host); std::string host,password; sql.clear(); sql << "SELECT value FROM options WHERE key='REDISPASSWORD'"; Args->database[0]->exec(sql,res); password=res[0][0]; sql.clear(); sql << "SELECT value FROM options WHERE key='REDISHOST'"; Args->database[0]->exec(sql,res); host=res[0][0]; getConfig(*Args->database[0],"REDISHOST",host); getConfig(*Args->database[0],"REDISPASSWORD",password); int port=-1,timeout=0; sql.clear(); sql << "SELECT value FROM options WHERE key='REDISPORT'"; Args->database[0]->exec(sql,res); port=atoi(res[0][0]); sql.clear(); sql << "SELECT value FROM options WHERE key='REDISTIMEOUT'"; Args->database[0]->exec(sql,res); timeout=atoi(res[0][0]); getConfig(*Args->database[0],"REDISPORT",port); getConfig(*Args->database[0],"REDISTIMEOUT",timeout); if(Args->config->getRedisPassword()){ _store = std::shared_ptr<RedisStore>(new RedisStore(host.c_str(),port,password.c_str(),timeout,Args->maxthreads)); Loading src/conf.h +14 Changes for src/conf.h: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -98,4 +98,18 @@ namespace blogi { std::string _Domain; std::string _CookieDomain; }; void getConfig(dbpp::Database &db,const std::string &key,std::string &value){ dbpp::SQL sql; dbpp::DBResult res; sql << "SELECT value FROM options WHERE key='" << key.c_str() << "'"; db.exec(sql,res); value=res[0][0]; } void getConfig(dbpp::Database &db,const std::string &key,int &value){ std::string buf; getConfig(db,key,buf); value=atoi(buf.c_str()); } }; Loading
plugins/media/media.cpp +6 −18 Changes for plugins/media/media.cpp: 6 added lines, 18 removed lines. Original line number Diff line number Diff line Loading @@ -495,28 +495,16 @@ namespace blogi { Args->database[0]->exec(sql,res); Args->edit->addIcon(icondata,icondatalen,"selimage","webp","Insert Image from media albums"); getConfig(*Args->database[0],"REDISHOST",host); getConfig(*Args->database[0],"REDISPASSWORD",host); std::string host,password; sql.clear(); sql << "SELECT value FROM options WHERE key='REDISPASSWORD'"; Args->database[0]->exec(sql,res); password=res[0][0]; sql.clear(); sql << "SELECT value FROM options WHERE key='REDISHOST'"; Args->database[0]->exec(sql,res); host=res[0][0]; getConfig(*Args->database[0],"REDISHOST",host); getConfig(*Args->database[0],"REDISPASSWORD",password); int port=-1,timeout=0; sql.clear(); sql << "SELECT value FROM options WHERE key='REDISPORT'"; Args->database[0]->exec(sql,res); port=atoi(res[0][0]); sql.clear(); sql << "SELECT value FROM options WHERE key='REDISTIMEOUT'"; Args->database[0]->exec(sql,res); timeout=atoi(res[0][0]); getConfig(*Args->database[0],"REDISPORT",port); getConfig(*Args->database[0],"REDISTIMEOUT",timeout); if(Args->config->getRedisPassword()){ _store = std::shared_ptr<RedisStore>(new RedisStore(host.c_str(),port,password.c_str(),timeout,Args->maxthreads)); Loading
src/conf.h +14 Changes for src/conf.h: 14 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -98,4 +98,18 @@ namespace blogi { std::string _Domain; std::string _CookieDomain; }; void getConfig(dbpp::Database &db,const std::string &key,std::string &value){ dbpp::SQL sql; dbpp::DBResult res; sql << "SELECT value FROM options WHERE key='" << key.c_str() << "'"; db.exec(sql,res); value=res[0][0]; } void getConfig(dbpp::Database &db,const std::string &key,int &value){ std::string buf; getConfig(db,key,buf); value=atoi(buf.c_str()); } };