]> git.mxchange.org Git - friendica.git/blobdiff - mod/admin.php
Events: Now with guid.
[friendica.git] / mod / admin.php
index a98f464f813d30b36b446ddffae0fc1cca47501c..454d59bb07b006c4d915c6e1ad420de2b8f43297 100644 (file)
@@ -492,6 +492,10 @@ function admin_page_site_post(&$a) {
 
                $old_url = $a->get_baseurl(true);
 
+               // Generate host names for relocation the addresses in the format user@address.tld
+               $new_host = str_replace("http://", "@", normalise_link($new_url));
+               $old_host = str_replace("http://", "@", normalise_link($old_url));
+
                function update_table($table_name, $fields, $old_url, $new_url) {
                        global $db, $a;
 
@@ -516,11 +520,16 @@ function admin_page_site_post(&$a) {
                }
 
                // update tables
+               // update profile links in the format "http://server.tld"
                update_table("profile", array('photo', 'thumb'), $old_url, $new_url);
                update_table("term", array('url'), $old_url, $new_url);
-               update_table("contact", array('photo','thumb','micro','url','nurl','request','notify','poll','confirm','poco'), $old_url, $new_url);
-               update_table("gcontact", array('photo','url','nurl','server_url'), $old_url, $new_url);
-               update_table("item", array('owner-link','owner-avatar','author-name','author-link','author-avatar','body','plink','tag'), $old_url, $new_url);
+               update_table("contact", array('photo','thumb','micro','url','nurl','alias','request','notify','poll','confirm','poco', 'avatar'), $old_url, $new_url);
+               update_table("gcontact", array('url','nurl','photo','server_url','notify','alias'), $old_url, $new_url);
+               update_table("item", array('owner-link','owner-avatar','author-link','author-avatar','body','plink','tag'), $old_url, $new_url);
+
+               // update profile addresses in the format "user@server.tld"
+               update_table("contact", array('addr'), $old_host, $new_host);
+               update_table("gcontact", array('connect','addr'), $old_host, $new_host);
 
                // update config
                $a->set_baseurl($new_url);
@@ -598,6 +607,7 @@ function admin_page_site_post(&$a) {
        $dfrn_only              =       ((x($_POST,'dfrn_only'))                ? True                                          : False);
        $ostatus_disabled       =       !((x($_POST,'ostatus_disabled'))        ? True                                          : False);
        $ostatus_poll_interval  =       ((x($_POST,'ostatus_poll_interval'))    ? intval(trim($_POST['ostatus_poll_interval'])) :  0);
+       $ostatus_full_threads   =       ((x($_POST,'ostatus_full_threads'))     ? True                                          : False);
        $diaspora_enabled       =       ((x($_POST,'diaspora_enabled'))         ? True                                          : False);
        $ssl_policy             =       ((x($_POST,'ssl_policy'))               ? intval($_POST['ssl_policy'])                  : 0);
        $force_ssl              =       ((x($_POST,'force_ssl'))                ? True                                          : False);
@@ -618,6 +628,9 @@ function admin_page_site_post(&$a) {
        $only_tag_search        =       ((x($_POST,'only_tag_search'))          ? True                                          : False);
        $rino                   =       ((x($_POST,'rino'))                     ? intval($_POST['rino'])                        : 0);
        $embedly                =       ((x($_POST,'embedly'))                  ? notags(trim($_POST['embedly']))               : '');
+       $worker                 =       ((x($_POST,'worker'))                   ? True                                          : False);
+       $worker_queues          =       ((x($_POST,'worker_queues'))            ? intval($_POST['worker_queues'])               : 4);
+       $worker_dont_fork       =       ((x($_POST,'worker_dont_fork'))         ? True                                          : False);
 
        if($a->get_path() != "")
                $diaspora_enabled = false;
@@ -746,6 +759,7 @@ function admin_page_site_post(&$a) {
        set_config('system','dfrn_only', $dfrn_only);
        set_config('system','ostatus_disabled', $ostatus_disabled);
        set_config('system','ostatus_poll_interval', $ostatus_poll_interval);
+       set_config('system','ostatus_full_threads', $ostatus_full_threads);
        set_config('system','diaspora_enabled', $diaspora_enabled);
 
        set_config('config','private_addons', $private_addons);
@@ -763,7 +777,9 @@ function admin_page_site_post(&$a) {
        set_config('system','proxy_disabled', $proxy_disabled);
        set_config('system','old_pager', $old_pager);
        set_config('system','only_tag_search', $only_tag_search);
-
+       set_config('system','worker', $worker);
+       set_config('system','worker_queues', $worker_queues);
+       set_config('system','worker_dont_fork', $worker_dont_fork);
 
        if($rino==2 and !function_exists('mcrypt_create_iv')) {
                notice(t("RINO2 needs mcrypt php extension to work."));
@@ -902,6 +918,7 @@ function admin_page_site(&$a) {
                '$advanced' => t('Advanced'),
                '$portable_contacts' => t('Auto Discovered Contact Directory'),
                '$performance' => t('Performance'),
+               '$worker_title' => t('Worker'),
                '$relocate'=> t('Relocate - WARNING: advanced function. Could make this server unreachable.'),
                '$baseurl' => $a->get_baseurl(true),
                // name, label, value, help string, extra data...
@@ -947,6 +964,7 @@ function admin_page_site(&$a) {
                '$max_author_posts_community_page' => array('max_author_posts_community_page', t("Posts per user on community page"), get_config('system','max_author_posts_community_page'), t("The maximum number of posts per user on the community page. (Not valid for 'Global Community')")),
                '$ostatus_disabled'     => array('ostatus_disabled', t("Enable OStatus support"), !get_config('system','ostatus_disabled'), t("Provide built-in OStatus \x28StatusNet, GNU Social etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")),
                '$ostatus_poll_interval' => array('ostatus_poll_interval', t("OStatus conversation completion interval"), (string) intval(get_config('system','ostatus_poll_interval')), t("How often shall the poller check for new entries in OStatus conversations? This can be a very ressource task."), $ostatus_poll_choices),
+               '$ostatus_full_threads' => array('ostatus_full_threads', t("Only import OStatus threads from our contacts"), get_config('system','ostatus_full_threads'), t("Normally we import every content from our OStatus contacts. With this option we only store threads that are started by a contact that is known on our system.")),
                '$ostatus_not_able'     => t("OStatus support can only be enabled if threading is enabled."),
                '$diaspora_able'        => $diaspora_able,
                '$diaspora_not_able'    => t("Diaspora support can't be enabled because Friendica was installed into a sub directory."),
@@ -989,6 +1007,10 @@ function admin_page_site(&$a) {
                '$rino'                 => array('rino', t("RINO Encryption"), intval(get_config('system','rino_encrypt')), t("Encryption layer between nodes."), array("Disabled", "RINO1 (deprecated)", "RINO2")),
                '$embedly'              => array('embedly', t("Embedly API key"), get_config('system','embedly'), t("<a href='http://embed.ly'>Embedly</a> is used to fetch additional data for web pages. This is an optional parameter.")),
 
+               '$worker'               => array('worker', t("Enable 'worker' background processing"), get_config('system','worker'), t("The worker background processing limits the number of parallel background jobs to a maximum number and respects the system load.")),
+               '$worker_queues'        => array('worker_queues', t("Maximum number of parallel workers"), get_config('system','worker_queues'), t("On shared hosters set this to 2. On larger systems, values of 10 are great. Default value is 4.")),
+               '$worker_dont_fork'     => array('worker_dont_fork', t("Don't use 'proc_open' with the worker"), get_config('system','worker_dont_fork'), t("Enable this if your system doesn't allow the use of 'proc_open'. This can happen on shared hosters. If this is enabled you should increase the frequency of poller calls in your crontab.")),
+
                '$form_security_token'  => get_form_security_token("admin_site")
 
        ));
@@ -1239,6 +1261,36 @@ function admin_page_users(&$a){
                $a->set_pager_itemspage(100);
        }
 
+       /* ordering */
+       $valid_orders = array(
+               'contact.name', 
+               'user.email',
+               'user.register_date',
+               'user.login_date',
+               'lastitem.lastitem_date',
+               'user.page-flags'
+       );
+       
+       $order = "contact.name";
+       $order_direction = "+";
+       if (x($_GET,'o')){
+               $new_order = $_GET['o'];
+               if ($new_order[0]==="-") {
+                       $order_direction = "-";
+                       $new_order = substr($new_order,1);
+               }
+               
+               if (in_array($new_order, $valid_orders)){
+                       $order = $new_order;
+               }
+               if (x($_GET,'d')){
+                       $new_direction = $_GET['d'];
+                       
+               }
+       }
+       $sql_order = "`".str_replace('.','`.`',$order)."`";
+       $sql_order_direction = ($order_direction==="+")?"ASC":"DESC";
+       
        $users = q("SELECT `user`.* , `contact`.`name` , `contact`.`url` , `contact`.`micro`, `lastitem`.`lastitem_date`, `user`.`account_expired`
                                FROM
                                        (SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid`
@@ -1251,12 +1303,14 @@ function admin_page_users(&$a){
                                           `user`.`uid` = `contact`.`uid`
                                                AND `user`.`verified` =1
                                        AND `contact`.`self` =1
-                               ORDER BY `contact`.`name` LIMIT %d, %d
+                               ORDER BY $sql_order $sql_order_direction LIMIT %d, %d
                                ",
                                intval($a->pager['start']),
                                intval($a->pager['itemspage'])
                                );
-
+    
+       //echo "<pre>$users"; killme();
+                               
        $adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
        $_setup_users = function ($e) use ($adminlist){
                $accounts = array(
@@ -1303,6 +1357,11 @@ function admin_page_users(&$a){
                array_push($users, array_pop($tmp_users));
        }
 
+       $th_users = array_map(null,
+               array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'),  t('Account')),
+               $valid_orders
+       );
+       
        $t = get_markup_template("admin_users.tpl");
        $o = replace_macros($t, array(
                // strings //
@@ -1325,7 +1384,9 @@ function admin_page_users(&$a){
                '$h_users' => t('Users'),
                '$h_newuser' => t('New User'),
                '$th_deleted' => array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Deleted since')),
-               '$th_users' => array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'),  t('Account')),
+               '$th_users' => $th_users,
+               '$order_users' => $order,
+               '$order_direction_users' => $order_direction,
 
                '$confirm_delete_multi' => t('Selected users will be deleted!\n\nEverything these users had posted on this site will be permanently deleted!\n\nAre you sure?'),
                '$confirm_delete' => t('The user {0} will be deleted!\n\nEverything this user has posted on this site will be permanently deleted!\n\nAre you sure?'),