WidgetHandle removal - part 2. Task order change
[framework/web/wrt-installer.git] / src / jobs / widget_install / task_remove_backup.cpp
index 77e0f4d..bcf7317 100644 (file)
@@ -24,7 +24,6 @@
 #include <sys/stat.h>
 #include <string>
 #include <sstream>
-#include <dpl/wrt-dao-rw/widget_dao.h>
 #include <dpl/wrt-dao-ro/global_config.h>
 #include <dpl/foreach.h>
 #include <dpl/log/log.h>
@@ -42,52 +41,27 @@ TaskRemoveBackupFiles::TaskRemoveBackupFiles(InstallerContext& context) :
     DPL::TaskDecl<TaskRemoveBackupFiles>(this),
     m_context(context)
 {
-    AddStep(&TaskRemoveBackupFiles::StepDeleteDB);
     AddStep(&TaskRemoveBackupFiles::StepRemoveBackupFiles);
 }
 
-void TaskRemoveBackupFiles::StepDeleteDB()
-{
-    LogInfo("Delete old widget DB");
-    Try
-    {
-        // If there is existing model, remove its database data
-        if (true == m_context.existingWidgetInfo.isExist) {
-            WidgetHandle old = m_context.existingWidgetInfo.existingHandle;
-            LogInfo("Unregistering widget...: " << old);
-            WidgetDAO::unregisterWidget(old);
-            LogInfo("Widget unregistered");
-        }
-    }
-    Catch(DPL::DB::SqlConnection::Exception::Base)
-    {
-        LogError("Failed to clean up old widget DB!");
-        ReThrowMsg(Exceptions::RemoveBackupFailed, "Database failure!");
-    }
-
-    m_context.job->UpdateProgress(
-        InstallerContext::INSTALL_DELETE_OLD_DB,
-        "Backup widget db delete Finished");
-}
-
 void TaskRemoveBackupFiles::StepRemoveBackupFiles()
 {
     std::ostringstream backupDir;
     backupDir << m_context.locations->getBackupDir();
 
-    if (_WrtUtilRemoveDir(backupDir.str().c_str())) {
+    if (WrtUtilRemove(backupDir.str())) {
         LogDebug("Success to remove backup files : " << backupDir.str());
     } else {
-        LogDebug("Failed to remove backup directory : " << backupDir.str());
+        LogError("Failed to remove backup directory : " << backupDir.str());
         ThrowMsg(Exceptions::RemoveBackupFailed,
                  "Error occurs during removing existing folder");
     }
 
     std::string tmp = m_context.locations->getTemporaryPackageDir();
-    if (_WrtUtilRemoveDir(tmp.c_str())) {
+    if (WrtUtilRemove(tmp)) {
         LogDebug("Success to remove temp directory : " << tmp);
     } else {
-        LogDebug("Failed to remove temp directory : " << tmp);
+        LogError("Failed to remove temp directory : " << tmp);
         ThrowMsg(Exceptions::RemoveBackupFailed,
                  "Error occurs during removing existing folder");
     }