* @brief Implementation file for uninstaller task database updating
*/
-#ifdef DBOX_ENABLED
-#include <web_provider_livebox_info.h>
-#endif
+#include <dpl/platform.h>
#include <widget_uninstall/task_db_update.h>
#include <widget_uninstall/job_widget_uninstall.h>
#include <widget_uninstall/widget_uninstall_errors.h>
+#if USE(WEB_PROVIDER)
+#include <web_provider_widget_info.h>
+#endif
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
-#include <dpl/utils/wrt_utility.h>
-#include <dpl/utils/path.h>
-#include <ace_api_install.h>
#include <dpl/assert.h>
-#include <ace-common/ace_api_common.h>
#include <dpl/wrt-dao-rw/widget_dao.h>
-#include <installer_log.h>
+#include <boost/filesystem.hpp>
+#include <dpl/log/secure_log.h>
using namespace WrtDB;
+namespace bf = boost::filesystem;
namespace Jobs {
namespace WidgetUninstall {
AddStep(&TaskDbUpdate::StartStep);
AddStep(&TaskDbUpdate::StepRemoveExternalLocations);
AddStep(&TaskDbUpdate::StepDbUpdate);
-#ifdef DBOX_ENABLED
+#if USE(WEB_PROVIDER)
AddStep(&TaskDbUpdate::StepLiveboxDBDelete);
#endif
AddStep(&TaskDbUpdate::EndStep);
{
//TODO: widget handle should not be used any more
FOREACH(it , m_context.tzAppIdList){
- ace_unregister_widget(static_cast<ace_widget_handle_t>(WidgetDAOReadOnly::getHandle(*it)));
WidgetDAO::unregisterWidget(*it);
}
_D("Unregistered widget successfully!");
}
}
-#ifdef DBOX_ENABLED
+#if USE(WEB_PROVIDER)
void TaskDbUpdate::StepLiveboxDBDelete()
{
FOREACH(it, m_context.tzAppIdList){
int ret =
- web_provider_livebox_delete_by_app_id(DPL::ToUTF8String(*it).c_str());
+ web_provider_widget_delete_by_app_id(DPL::ToUTF8String(*it).c_str());
- if (ret < 0) {
- _D("failed to delete box info");
- } else {
+ if (ret < 0) {
+ _D("failed to delete box info");
+ } else {
_D("delete box info: %s", it);
}
}
WrtDB::ExternalLocationList externalPaths = dao.getWidgetExternalLocations();
FOREACH(file, externalPaths)
{
- DPL::Utils::Path path(*file);
- if(path.Exists()){
- if(path.IsFile()){
- _D(" -> %s", path.Fullpath().c_str());
- Try {
- DPL::Utils::Remove(path);
- } Catch(DPL::Utils::Path::BaseException){
- _E("Failed to remove the file: %s", path.Fullpath().c_str());
- }
- } else if (path.IsDir()){
- _D(" -> %s", path.Fullpath().c_str());
- Try {
- DPL::Utils::Remove(path);
- } Catch(DPL::Utils::Path::BaseException){
- Throw(Jobs::WidgetUninstall::TaskDbUpdate::
- Exception::RemoveFilesFailed);
- }
+ bf::path path(*file);
+ try {
+ if(bf::exists(path)){
+ JobWidgetUninstall::SecureRemove(path);
+ } else {
+ _W(" -> %s(no such a path)", path.c_str());
}
- } else {
- _W(" -> %s(no such a path)", path.Fullpath().c_str());
+ } catch (const bf::filesystem_error& ex) {
+ _E("Failed to remove the file: %s", path.c_str());
+ Throw(Jobs::WidgetUninstall::TaskDbUpdate::Exception::RemoveFilesFailed);
}
}
dao.unregisterAllExternalLocations();
void TaskDbUpdate::StartStep()
{
- LOGD("--------- <TaskDbUpdate> : START ----------");
+ LOGI("--------- <TaskDbUpdate> : START ----------");
}
void TaskDbUpdate::EndStep()
UninstallerContext::UNINSTALL_DB_UPDATE,
"Widget DB Update Finished");
- LOGD("--------- <TaskDbUpdate> : END ----------");
+ LOGI("--------- <TaskDbUpdate> : END ----------");
}
} //namespace WidgetUninstall
} //namespace Jobs