#include "app_disable_app_filter_checker.hh"
-#include <string.h>
-
#include "pkgmgrinfo_basic.h"
#include "pkgmgrinfo_private.h"
+#include "utils/logging.hh"
+
namespace pkgmgr_server {
namespace database {
bool AppDisableAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node,
application_x* app_info, package_x* pkg_info) {
- return (node->value != nullptr && app_info->is_disabled != nullptr &&
- strcasecmp(node->value, app_info->is_disabled) == 0);
+ if (node->value == nullptr || app_info->is_disabled == nullptr)
+ return false;
+
+ if (strcasecmp(node->value, app_info->is_disabled) != 0) {
+ if (strcasecmp(app_info->is_disabled, "true") == 0)
+ LOG(WARNING) << "The application [" << app_info->appid << "] is disabled";
+ return false;
+ }
+
+ return true;
}
} // namespace database
#include "pkgmgrinfo_basic.h"
#include "pkgmgrinfo_private.h"
+#include "utils/logging.hh"
+
namespace pkgmgr_server {
namespace database {
bool PkgDisableAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node,
application_x* app_info, package_x* pkg_info) {
- return (node->value != nullptr &&
- strcasecmp(node->value, pkg_info->is_disabled) == 0);
+ if (node->value == nullptr || pkg_info->is_disabled == nullptr)
+ return false;
+
+ if (strcasecmp(node->value, pkg_info->is_disabled) != 0) {
+ if (strcasecmp(pkg_info->is_disabled, "true") == 0)
+ LOG(WARNING) << "The pacakge [" << pkg_info->package
+ << "] to which the application ["
+ << app_info->appid << "] belongs is disabled";
+ return false;
+ }
+
+ return true;
}
} // namespace database
#include "disable_pkg_filter_checker.hh"
+#include "utils/logging.hh"
+
namespace pkgmgr_server {
namespace database {
bool DisablePkgFilterChecker::CheckFilter(pkgmgrinfo_node_x* node,
package_x* info) {
- return (node->value != nullptr && info->is_disabled != nullptr &&
- strcasecmp(node->value, info->is_disabled) == 0);
+ if (node->value == nullptr || info->is_disabled == nullptr)
+ return false;
+
+ if (strcasecmp(node->value, info->is_disabled) != 0) {
+ if (strcasecmp(info->is_disabled, "true") == 0)
+ LOG(WARNING) << "The package [" << info->package << "] is disabled";
+ return false;
+ }
+
+ return true;
}
} // namespace database