Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initialize the database manager on start and on change of profile, so…

… that database updates are attempted only once rather than on every Open().
  • Loading branch information...
commit 0d0eb5550e597535514d867acf4054883d2ed46c 1 parent 7e05bb2
Jonathan Marshall authored
View
7 xbmc/Application.cpp
@@ -306,6 +306,7 @@
#include "utils/SaveFileStateJob.h"
#include "utils/AlarmClock.h"
#include "utils/StringUtils.h"
+#include "DatabaseManager.h"
#ifdef _LINUX
#include "XHandle.h"
@@ -709,6 +710,9 @@ bool CApplication::Create()
CAEFactory::SetMute (g_settings.m_bMute);
CAEFactory::SetSoundMode(g_guiSettings.GetInt("audiooutput.guisoundmode"));
+ // initialize the addon database (must be before the addon manager is init'd)
+ CDatabaseManager::Get().Initialize(true);
+
// start-up Addons Framework
// currently bails out if either cpluff Dll is unavailable or system dir can not be scanned
if (!CAddonMgr::Get().Init())
@@ -1153,6 +1157,9 @@ bool CApplication::Initialize()
g_curlInterface.Load();
g_curlInterface.Unload();
+ // initialize (and update as needed) our databases
+ CDatabaseManager::Get().Initialize();
+
#ifdef HAS_WEB_SERVER
CWebServer::RegisterRequestHandler(&m_httpImageHandler);
CWebServer::RegisterRequestHandler(&m_httpVfsHandler);
View
12 xbmc/dbwrappers/Database.cpp
@@ -31,6 +31,7 @@
#include "utils/URIUtils.h"
#include "mysqldataset.h"
#include "sqlitedataset.h"
+#include "DatabaseManager.h"
using namespace AUTOPTR;
@@ -255,17 +256,16 @@ bool CDatabase::Open(const DatabaseSettings &settings)
return true;
}
+ // check our database manager to see if this database can be opened
+ if (!CDatabaseManager::Get().CanOpen(GetBaseDBName()))
+ return false;
+
DatabaseSettings dbSettings = settings;
InitSettings(dbSettings);
CStdString dbName = dbSettings.name;
dbName.AppendFormat("%d", GetMinVersion());
- if (!Connect(dbName, dbSettings, false) || GetDBVersion() != GetMinVersion())
- {
- if (!Update(settings))
- return false;
- }
- return true;
+ return Connect(dbName, dbSettings, false);
}
void CDatabase::InitSettings(DatabaseSettings &dbSettings)
View
3  xbmc/settings/Settings.cpp
@@ -56,6 +56,7 @@
#include "input/MouseStat.h"
#include "filesystem/File.h"
#include "filesystem/DirectoryCache.h"
+#include "DatabaseManager.h"
using namespace std;
using namespace XFILE;
@@ -950,6 +951,8 @@ bool CSettings::LoadProfile(unsigned int index)
CButtonTranslator::GetInstance().Load(true);
g_localizeStrings.Load("special://xbmc/language/", strLanguage);
+ CDatabaseManager::Get().Initialize();
+
g_Mouse.SetEnabled(g_guiSettings.GetBool("input.enablemouse"));
g_infoManager.ResetCache();
Please sign in to comment.
Something went wrong with that request. Please try again.