Add profile availability field
- Add available field to profile table - Make profile unavailable in directory until update suceeds
This commit is contained in:
parent
ef7551df81
commit
163d7d2b4b
3 changed files with 7 additions and 4 deletions
|
@ -31,6 +31,7 @@ function run_submit($url) {
|
|||
$profile_id = $r[0]['id'];
|
||||
|
||||
$r = q("UPDATE `profile` SET
|
||||
`available` = 0,
|
||||
`updated` = '%s'
|
||||
WHERE `id` = %d LIMIT 1",
|
||||
|
||||
|
@ -56,6 +57,7 @@ function run_submit($url) {
|
|||
|
||||
//Skip the scrape? :D
|
||||
$noscrape = $site_health && $site_health['no_scrape_url'];
|
||||
|
||||
if($noscrape){
|
||||
|
||||
//Find out who to look up.
|
||||
|
@ -128,6 +130,7 @@ function run_submit($url) {
|
|||
`nurl` = '%s',
|
||||
`comm` = %d,
|
||||
`tags` = '%s',
|
||||
`available` = 1,
|
||||
`updated` = '%s'
|
||||
WHERE `id` = %d LIMIT 1",
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ function directory_content(App $a)
|
|||
|
||||
$sql_extra = str_replace('%', '%%', $sql_extra);
|
||||
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `profile` WHERE `censored` = 0 $sql_extra ");
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `profile` WHERE `censored` = 0 AND `available` = 1 $sql_extra ");
|
||||
if (count($r)) {
|
||||
$total = $r[0]['total'];
|
||||
$a->set_pager_total($total);
|
||||
|
@ -58,7 +58,7 @@ function directory_content(App $a)
|
|||
$order = ' ORDER BY `updated` DESC, `id` DESC ';
|
||||
}
|
||||
|
||||
$r = q("SELECT * FROM `profile` WHERE `censored` = 0 $sql_extra $order LIMIT %d , %d ",
|
||||
$r = q("SELECT * FROM `profile` WHERE `censored` = 0 AND `available` = 1 $sql_extra $order LIMIT %d , %d ",
|
||||
intval($a->pager['start']),
|
||||
intval($a->pager['itemspage'])
|
||||
);
|
||||
|
|
|
@ -60,7 +60,7 @@ function search_content(App $a)
|
|||
$sql_extra = str_replace('%', '%%', $sql_extra);
|
||||
|
||||
$total = 0;
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `profile` WHERE `censored` = 0 $sql_extra ");
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `profile` WHERE `censored` = 0 AND `available` = 1 $sql_extra ");
|
||||
if (count($r)) {
|
||||
$total = $r[0]['total'];
|
||||
$a->set_pager_total($total);
|
||||
|
@ -72,7 +72,7 @@ function search_content(App $a)
|
|||
$order = ' ORDER BY `updated` DESC, `id` DESC ';
|
||||
}
|
||||
|
||||
$r = q("SELECT * FROM `profile` WHERE `censored` = 0 $sql_extra $order LIMIT %d , %d ",
|
||||
$r = q("SELECT * FROM `profile` WHERE `censored` = 0 AND `available` = 1 $sql_extra $order LIMIT %d , %d ",
|
||||
intval($a->pager['start']),
|
||||
intval($a->pager['itemspage'])
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue