added blog filter
This commit is contained in:
@@ -34,6 +34,7 @@ long ScheduleTransferJobs(CVars in, CVars &out);
|
||||
long TestNotificationsJobs(CVars in, CVars &out);
|
||||
long ProcessExpiredOffers(CVars in, CVars &out);
|
||||
long ScheduleHolidayJobs(CVars in, CVars &out);
|
||||
long RefreshBlogs(CVars in, CVars &out);
|
||||
|
||||
/*
|
||||
CREATE TABLE cron_jobs (
|
||||
@@ -163,6 +164,14 @@ long sitecrons_calls(CVars in, CVars &out) {
|
||||
CronTracker(ct, co);
|
||||
return CronSendMail(in, out);
|
||||
break;
|
||||
|
||||
case WRB_CRONJOB_REFRESHBLOG:
|
||||
ct["job_type"]="WRB_CRONJOB_REFRESHBLOG"; ct["job_type"].set_valid( true );
|
||||
ct["description"]="Refresh Blog"; ct["description"].set_valid( true );
|
||||
CronTracker(ct, co);
|
||||
return RefreshBlogs(in, out);
|
||||
break;
|
||||
|
||||
// define('WRB_CRONJOB_APPEMAILS', 782);
|
||||
}
|
||||
|
||||
@@ -170,6 +179,40 @@ long sitecrons_calls(CVars in, CVars &out) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
long RefreshBlogs(CVars in, CVars &out){
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
CVars xx;
|
||||
try {
|
||||
long blog_id = REQ_LONG(in, "blog_id", 1, -1);
|
||||
REQ_STRING (in, "banner", 5, 149, "(.*)");
|
||||
REQ_STRING (in, "title", 5, 149, "(.*)");
|
||||
const PGresult *res;
|
||||
res = pgsql_query("SELECT * FROM blog_selections WHERE blog_id = %lu", blog_id);
|
||||
|
||||
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
map<const char*, const char*>f = pgsql_fetch_assoc(res, 0);
|
||||
CVars rec;
|
||||
map_to_cvars(f, rec);
|
||||
xx["title"] = in["title"]; xx["title"].set_valid( true );
|
||||
xx["banner"] = in["banner"]; xx["banner"].set_valid( true );
|
||||
update_db_record(DBS_VALID, "members_detail", xx, blog_id);
|
||||
}
|
||||
else{
|
||||
xx["blog_id"] = in["blog_id"]; xx["blog_id"].set_valid( true );
|
||||
xx["title"] = in["title"]; xx["title"].set_valid( true );
|
||||
xx["banner"] = in["banner"]; xx["banner"].set_valid( true );
|
||||
blog_id = insert_db_record(DBS_VALID, "blog_selections", "blog_selections_id_seq", xx);
|
||||
}
|
||||
ret = PHP_API_OK;
|
||||
out["status"] = "OK";
|
||||
} catch (bad_parameter) {
|
||||
logfmt(logINFO, "ERROR CALL long RefreshBlogs(CVars in, CVars &out)");
|
||||
}
|
||||
logfmt(logINFO, "/RefreshBlogs()");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
long ScheduleHolidayJobs(CVars in, CVars &out){
|
||||
char vname[30];
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
|
||||
Reference in New Issue
Block a user