[public_server] Add addon config

- Update mentions of .htconfig.php
pull/633/head
Hypolite Petovan 2018-06-27 23:18:46 -04:00
parent e20f30888f
commit 05077bf127
3 changed files with 53 additions and 15 deletions

View File

@ -7,19 +7,20 @@ test bed with reduced data retention.
This is a modified version of the testdrive addon, DO NOT ACTIVATE AT THE SAME TIME AS THE TESTDRIVE ADDON. This is a modified version of the testdrive addon, DO NOT ACTIVATE AT THE SAME TIME AS THE TESTDRIVE ADDON.
//When an account is created on the site, it is given a hard expiration date of [public_server]
$a->config['public_server']['expiredays'] = 30; ; When an account is created on the site, it is given a hard expiration date of
//Set the default days for posts to expire here expiredays = 30
$a->config['public_server']['expireposts'] = 30; ; Set the default days for posts to expire here
//Remove users who have never logged in after nologin days expireposts = 30
$a->config['public_server']['nologin'] = 30; ; Remove users who have never logged in after nologin days
//Remove users who last logged in over flagusers days ago nologin = 30
$a->config['public_server']['flagusers'] = 146; ; Remove users who last logged in over flagusers days ago
//For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire flagusers = 146
$a->config['public_server']['flagposts'] = 90; ; For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire
$a->config['public_server']['flagpostsexpire'] = 146; flagposts = 90
flagpostsexpire = 146
Set these in your .htconfig.php file. By default nothing is defined in case the addon is activated accidentally. Set these in your config/local.ini.php file. By default nothing is defined in case the addon is activated accidentally.
They can be ommitted or set to 0 to disable each option. They can be ommitted or set to 0 to disable each option.
The default values are those used by friendica.eu, change these as desired. The default values are those used by friendica.eu, change these as desired.

View File

@ -0,0 +1,30 @@
<?php return <<<INI
; Warning: Don't change this file! It only holds the default config values for this addon.
; Instead overwrite these config values in config/local.ini.php in your Friendica directory
[public_server]
; expiredays (Integer)
; When an account is created on the site, it is given a hard expiration date of
expiredays =
; expireposts (Integer)
; Set the default days for posts to expire here
expireposts =
; nologin (Integer)
; Remove users who have never logged in after nologin days
nologin =
; flagusers (Integer)
; Remove users who last logged in over flagusers days ago
flagusers =
; flagposts (Integer)
; flagpostsexpire (Integer)
; For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire
flagposts =
flagpostsexpire =
INI;
//Keep this line

View File

@ -14,6 +14,7 @@ use Friendica\Util\DateTimeFormat;
function public_server_install() function public_server_install()
{ {
Addon::registerHook('load_config', 'addon/public_server/public_server.php', 'public_server_load_config');
Addon::registerHook('register_account', 'addon/public_server/public_server.php', 'public_server_register_account'); Addon::registerHook('register_account', 'addon/public_server/public_server.php', 'public_server_register_account');
Addon::registerHook('cron', 'addon/public_server/public_server.php', 'public_server_cron'); Addon::registerHook('cron', 'addon/public_server/public_server.php', 'public_server_cron');
Addon::registerHook('enotify', 'addon/public_server/public_server.php', 'public_server_enotify'); Addon::registerHook('enotify', 'addon/public_server/public_server.php', 'public_server_enotify');
@ -22,12 +23,18 @@ function public_server_install()
function public_server_uninstall() function public_server_uninstall()
{ {
Addon::unregisterHook('load_config', 'addon/public_server/public_server.php', 'public_server_load_config');
Addon::unregisterHook('register_account', 'addon/public_server/public_server.php', 'public_server_register_account'); Addon::unregisterHook('register_account', 'addon/public_server/public_server.php', 'public_server_register_account');
Addon::unregisterHook('cron', 'addon/public_server/public_server.php', 'public_server_cron'); Addon::unregisterHook('cron', 'addon/public_server/public_server.php', 'public_server_cron');
Addon::unregisterHook('enotify', 'addon/public_server/public_server.php', 'public_server_enotify'); Addon::unregisterHook('enotify', 'addon/public_server/public_server.php', 'public_server_enotify');
Addon::unregisterHook('logged_in', 'addon/public_server/public_server.php', 'public_server_login'); Addon::unregisterHook('logged_in', 'addon/public_server/public_server.php', 'public_server_login');
} }
function public_server_load_config(\Friendica\App $a)
{
$a->loadConfigFile(__DIR__. '/config/public_server.ini.php');
}
function public_server_register_account($a, $b) function public_server_register_account($a, $b)
{ {
$uid = $b; $uid = $b;