mirror of
https://github.com/friendica/friendica
synced 2024-12-23 00:00:21 +00:00
do not poll for abandoned accounts
This commit is contained in:
parent
c1221cc052
commit
097c1f8da7
6 changed files with 26 additions and 4 deletions
2
boot.php
2
boot.php
|
@ -10,7 +10,7 @@ require_once('include/nav.php');
|
||||||
define ( 'FRIENDIKA_PLATFORM', 'Free Friendika');
|
define ( 'FRIENDIKA_PLATFORM', 'Free Friendika');
|
||||||
define ( 'FRIENDIKA_VERSION', '2.3.1119' );
|
define ( 'FRIENDIKA_VERSION', '2.3.1119' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1092 );
|
define ( 'DB_UPDATE_VERSION', 1093 );
|
||||||
|
|
||||||
define ( 'EOL', "<br />\r\n" );
|
define ( 'EOL', "<br />\r\n" );
|
||||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||||
|
|
|
@ -424,7 +424,9 @@ CREATE TABLE IF NOT EXISTS `user` (
|
||||||
`deny_gid` mediumtext NOT NULL,
|
`deny_gid` mediumtext NOT NULL,
|
||||||
`openidserver` text NOT NULL,
|
`openidserver` text NOT NULL,
|
||||||
PRIMARY KEY (`uid`),
|
PRIMARY KEY (`uid`),
|
||||||
KEY `nickname` (`nickname`)
|
KEY `nickname` (`nickname`),
|
||||||
|
KEY `account_expired` (`account_expired`),
|
||||||
|
KEY `login_date` (`login_date`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,12 @@ function poller_run($argv, $argc){
|
||||||
AND `account_expires_on` != '0000-00-00 00:00:00'
|
AND `account_expires_on` != '0000-00-00 00:00:00'
|
||||||
AND `account_expires_on` < UTC_TIMESTAMP() ");
|
AND `account_expires_on` < UTC_TIMESTAMP() ");
|
||||||
|
|
||||||
|
$abandon_days = intval(get_config('system','account_abandon_days'));
|
||||||
|
if($abandon_days < 1)
|
||||||
|
$abandon_days = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// once daily run expire in background
|
// once daily run expire in background
|
||||||
|
|
||||||
$d1 = get_config('system','last_expire_day');
|
$d1 = get_config('system','last_expire_day');
|
||||||
|
@ -92,12 +98,17 @@ function poller_run($argv, $argc){
|
||||||
// and which have a polling address and ignore Diaspora since
|
// and which have a polling address and ignore Diaspora since
|
||||||
// we are unable to match those posts with a Diaspora GUID and prevent duplicates.
|
// we are unable to match those posts with a Diaspora GUID and prevent duplicates.
|
||||||
|
|
||||||
|
$abandon_sql = (($abandon_days)
|
||||||
|
? sprintf(" AND `user`.`login_date` > UTC_TIMESTAMP() - INTERVAL %d DAY ", intval($abandon_days))
|
||||||
|
: ''
|
||||||
|
);
|
||||||
|
|
||||||
$contacts = q("SELECT `contact`.`id` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
|
$contacts = q("SELECT `contact`.`id` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
|
||||||
WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != ''
|
WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != ''
|
||||||
AND `network` != '%s'
|
AND `network` != '%s'
|
||||||
$sql_extra
|
$sql_extra
|
||||||
AND `self` = 0 AND `contact`.`blocked` = 0 AND `contact`.`readonly` = 0
|
AND `self` = 0 AND `contact`.`blocked` = 0 AND `contact`.`readonly` = 0
|
||||||
AND `user`.`account_expired` = 0 ORDER BY RAND()",
|
AND `user`.`account_expired` = 0 $abandon_sql ORDER BY RAND()",
|
||||||
intval(CONTACT_IS_SHARING),
|
intval(CONTACT_IS_SHARING),
|
||||||
intval(CONTACT_IS_FRIEND),
|
intval(CONTACT_IS_FRIEND),
|
||||||
dbesc(NETWORK_DIASPORA)
|
dbesc(NETWORK_DIASPORA)
|
||||||
|
|
|
@ -177,6 +177,8 @@ function admin_page_site_post(&$a){
|
||||||
|
|
||||||
|
|
||||||
$register_policy = ((x($_POST,'register_policy')) ? intval(trim($_POST['register_policy'])) : 0);
|
$register_policy = ((x($_POST,'register_policy')) ? intval(trim($_POST['register_policy'])) : 0);
|
||||||
|
$abandon_days = ((x($_POST,'abandon_days')) ? intval(trim($_POST['abandon_days'])) : 0);
|
||||||
|
|
||||||
$register_text = ((x($_POST,'register_text')) ? notags(trim($_POST['register_text'])) : '');
|
$register_text = ((x($_POST,'register_text')) ? notags(trim($_POST['register_text'])) : '');
|
||||||
|
|
||||||
$allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
|
$allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : '');
|
||||||
|
@ -215,6 +217,7 @@ function admin_page_site_post(&$a){
|
||||||
set_config('system','maximagesize', $maximagesize);
|
set_config('system','maximagesize', $maximagesize);
|
||||||
|
|
||||||
set_config('config','register_policy', $register_policy);
|
set_config('config','register_policy', $register_policy);
|
||||||
|
set_config('system','account_abandon_days', $abandon_days);
|
||||||
set_config('config','register_text', $register_text);
|
set_config('config','register_text', $register_text);
|
||||||
set_config('system','allowed_sites', $allowed_sites);
|
set_config('system','allowed_sites', $allowed_sites);
|
||||||
set_config('system','allowed_email', $allowed_email);
|
set_config('system','allowed_email', $allowed_email);
|
||||||
|
@ -314,6 +317,7 @@ function admin_page_site(&$a) {
|
||||||
|
|
||||||
'$register_policy' => array('register_policy', t("Register policy"), $a->config['register_policy'], "", $register_choices),
|
'$register_policy' => array('register_policy', t("Register policy"), $a->config['register_policy'], "", $register_choices),
|
||||||
'$register_text' => array('register_text', t("Register text"), htmlentities($a->config['register_text'], ENT_QUOTES), "Will be displayed prominently on the registration page."),
|
'$register_text' => array('register_text', t("Register text"), htmlentities($a->config['register_text'], ENT_QUOTES), "Will be displayed prominently on the registration page."),
|
||||||
|
'$abandon_days' => array('abandon_days', t('Accounts abandoned after x days'), get_config('system','account_abandon_days'), t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')),
|
||||||
'$allowed_sites' => array('allowed_sites', t("Allowed friend domains"), get_config('system','allowed_sites'), "Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains"),
|
'$allowed_sites' => array('allowed_sites', t("Allowed friend domains"), get_config('system','allowed_sites'), "Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains"),
|
||||||
'$allowed_email' => array('allowed_email', t("Allowed email domains"), get_config('system','allowed_email'), "Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains"),
|
'$allowed_email' => array('allowed_email', t("Allowed email domains"), get_config('system','allowed_email'), "Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains"),
|
||||||
'$block_public' => array('block_public', t("Block public"), get_config('system','block_public'), "Check to block public access to all otherwise public personal pages on this site unless you are currently logged in."),
|
'$block_public' => array('block_public', t("Block public"), get_config('system','block_public'), "Check to block public access to all otherwise public personal pages on this site unless you are currently logged in."),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'UPDATE_VERSION' , 1092 );
|
define( 'UPDATE_VERSION' , 1093 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -770,3 +770,7 @@ function update_1091() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_1092() {
|
||||||
|
q("ALTER TABLE `user` ADD INDEX ( `login_date` ) ");
|
||||||
|
q("ALTER TABLE `user` ADD INDEX ( `account_expired` ) ");
|
||||||
|
}
|
|
@ -43,6 +43,7 @@
|
||||||
{{ inc field_input.tpl with $field=$proxy }}{{ endinc }}
|
{{ inc field_input.tpl with $field=$proxy }}{{ endinc }}
|
||||||
{{ inc field_input.tpl with $field=$proxyuser }}{{ endinc }}
|
{{ inc field_input.tpl with $field=$proxyuser }}{{ endinc }}
|
||||||
{{ inc field_input.tpl with $field=$timeout }}{{ endinc }}
|
{{ inc field_input.tpl with $field=$timeout }}{{ endinc }}
|
||||||
|
{{ inc field_input.tpl with $field=$abandon_days }}{{ endinc }}
|
||||||
|
|
||||||
<div class="submit"><input type="submit" name="page_site" value="$submit" /></div>
|
<div class="submit"><input type="submit" name="page_site" value="$submit" /></div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue