]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #3874 from tobiasd/20171009-checkversion
authorHypolite Petovan <mrpetovan@gmail.com>
Mon, 6 Nov 2017 18:59:49 +0000 (13:59 -0500)
committerGitHub <noreply@github.com>
Mon, 6 Nov 2017 18:59:49 +0000 (13:59 -0500)
check upstream version

1  2 
include/cron.php
mod/admin.php

diff --combined include/cron.php
index 260b143c5b76fc9e785d890b853d340831d2e34d,8842d3bdfa6eabea99bf4a21cb2b1675d4cadad8..d4d19d8c86dc7e6f6a81418e2fd7f85e4a67826d
@@@ -1,7 -1,6 +1,7 @@@
  <?php
  
  use Friendica\Core\Config;
 +use Friendica\Core\Worker;
  
  function cron_run(&$argv, &$argc){
        global $a;
        logger('cron: start');
  
        // run queue delivery process in the background
 -      proc_run(PRIORITY_NEGLIGIBLE, "include/queue.php");
 +      Worker::add(PRIORITY_NEGLIGIBLE, "queue");
  
        // run the process to discover global contacts in the background
 -      proc_run(PRIORITY_LOW, "include/discover_poco.php");
 +      Worker::add(PRIORITY_LOW, "discover_poco");
  
        // run the process to update locally stored global contacts in the background
 -      proc_run(PRIORITY_LOW, "include/discover_poco.php", "checkcontact");
 +      Worker::add(PRIORITY_LOW, "discover_poco", "checkcontact");
  
        // Expire and remove user entries
 -      proc_run(PRIORITY_MEDIUM, "include/cronjobs.php", "expire_and_remove_users");
 +      Worker::add(PRIORITY_MEDIUM, "cronjobs", "expire_and_remove_users");
  
        // Call possible post update functions
 -      proc_run(PRIORITY_LOW, "include/cronjobs.php", "post_update");
 +      Worker::add(PRIORITY_LOW, "cronjobs", "post_update");
  
        // update nodeinfo data
 -      proc_run(PRIORITY_LOW, "include/cronjobs.php", "nodeinfo");
 +      Worker::add(PRIORITY_LOW, "cronjobs", "nodeinfo");
  
        // Clear cache entries
 -      proc_run(PRIORITY_LOW, "include/cronjobs.php", "clear_cache");
 +      Worker::add(PRIORITY_LOW, "cronjobs", "clear_cache");
  
        // Repair missing Diaspora values in contacts
 -      proc_run(PRIORITY_LOW, "include/cronjobs.php", "repair_diaspora");
 +      Worker::add(PRIORITY_LOW, "cronjobs", "repair_diaspora");
  
        // Repair entries in the database
 -      proc_run(PRIORITY_LOW, "include/cronjobs.php", "repair_database");
 +      Worker::add(PRIORITY_LOW, "cronjobs", "repair_database");
  
        // once daily run birthday_updates and then expire in background
        $d1 = get_config('system', 'last_expire_day');
  
        if ($d2 != intval($d1)) {
  
 -              proc_run(PRIORITY_LOW, "include/cronjobs.php", "update_contact_birthdays");
 +              Worker::add(PRIORITY_LOW, "cronjobs", "update_contact_birthdays");
  
 -              proc_run(PRIORITY_LOW, "include/discover_poco.php", "update_server");
 +              Worker::add(PRIORITY_LOW, "discover_poco", "update_server");
  
 -              proc_run(PRIORITY_LOW, "include/discover_poco.php", "suggestions");
 +              Worker::add(PRIORITY_LOW, "discover_poco", "suggestions");
  
                set_config('system', 'last_expire_day', $d2);
  
 -              proc_run(PRIORITY_LOW, 'include/expire.php');
 +              Worker::add(PRIORITY_LOW, 'expire');
  
 -              proc_run(PRIORITY_MEDIUM, 'include/dbclean.php');
 +              Worker::add(PRIORITY_MEDIUM, 'dbclean');
  
 -              proc_run(PRIORITY_LOW, "include/cronjobs.php", "update_photo_albums");
 +              Worker::add(PRIORITY_LOW, "cronjobs", "update_photo_albums");
  
                // Delete all done workerqueue entries
                dba::delete('workerqueue', array('`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 12 HOUR'));
+               // check upstream version?
+               Worker::add(PRIORITY_LOW, 'checkversion');
        }
  
        // Poll contacts
@@@ -248,7 -250,7 +251,7 @@@ function cron_poll_contacts($argc, $arg
                        } else {
                                $priority = PRIORITY_LOW;
                        }
 -                      proc_run(array('priority' => $priority, 'dont_fork' => true), 'include/onepoll.php', (int)$contact['id']);
 +                      Worker::add(array('priority' => $priority, 'dont_fork' => true), 'onepoll', (int)$contact['id']);
                }
        }
  }
diff --combined mod/admin.php
index 144539dcef5198d57eb06d36034e53dcd41502a2,e4f205e5c50896a39a1a77189999f8738b68473e..ae7118664d1c8bd9c918d5f0230037997a27e122
@@@ -9,7 -9,6 +9,7 @@@
  use Friendica\App;
  use Friendica\Core\System;
  use Friendica\Core\Config;
 +use Friendica\Core\Worker;
  
  require_once("include/enotify.php");
  require_once("include/text.php");
@@@ -616,6 -615,15 +616,15 @@@ function admin_page_summary(App $a) 
                $showwarning = true;
                $warningtext[] = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the command <tt>php include/dbstructure.php toinnodb</tt> of your Friendica installation for an automatic conversion.<br />'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
        }
+       // Check if github.com/friendica/master/VERSION is higher then
+       // the local version of Friendica. Check is opt-in, source may be master or devel branch
+       if (Config::get('system', 'check_new_version_url', 'none') != 'none' ) {
+               $gitversion = Config::get('system','git_friendica_version');
+               if (version_compare(FRIENDICA_VERSION, $gitversion) < 0) {
+                       $warningtext[] = t('There is a new version of Friendica available for download.');
+                       $showwarning = true;
+               }
+       }
  
        if (Config::get('system', 'dbupdate', DB_UPDATE_NOT_CHECKED) == DB_UPDATE_NOT_CHECKED) {
                require_once("include/dbstructure.php");
@@@ -695,7 -703,7 +704,7 @@@ function admin_page_site_post(App $a) 
        check_form_security_token_redirectOnErr('/admin/site', 'admin_site');
  
        if (!empty($_POST['republish_directory'])) {
 -              proc_run(PRIORITY_LOW, 'include/directory.php');
 +              Worker::add(PRIORITY_LOW, 'directory');
                return;
        }
  
                $users = q("SELECT `uid` FROM `user` WHERE `account_removed` = 0 AND `account_expired` = 0");
  
                foreach ($users as $user) {
 -                      proc_run(PRIORITY_HIGH, 'include/notifier.php', 'relocate', $user['uid']);
 +                      Worker::add(PRIORITY_HIGH, 'notifier', 'relocate', $user['uid']);
                }
  
                info("Relocation started. Could take a while to complete.");
        $proxy_disabled         =       ((x($_POST,'proxy_disabled'))           ? True                                          : False);
        $only_tag_search        =       ((x($_POST,'only_tag_search'))          ? True                                          : False);
        $rino                   =       ((x($_POST,'rino'))                     ? intval($_POST['rino'])                        : 0);
+       $check_new_version_url  =       ((x($_POST, 'check_new_version_url'))   ?       notags(trim($_POST['check_new_version_url']))   : 'none');
        $worker_queues          =       ((x($_POST,'worker_queues'))            ? intval($_POST['worker_queues'])               : 4);
        $worker_dont_fork       =       ((x($_POST,'worker_dont_fork'))         ? True                                          : False);
        $worker_fastlane        =       ((x($_POST,'worker_fastlane'))          ? True                                          : False);
        // Has the directory url changed? If yes, then resubmit the existing profiles there
        if ($global_directory != Config::get('system', 'directory') && ($global_directory != '')) {
                Config::set('system', 'directory', $global_directory);
 -              proc_run(PRIORITY_LOW, 'include/directory.php');
 +              Worker::add(PRIORITY_LOW, 'directory');
        }
  
        if ($a->get_path() != "") {
        set_config('system', 'enotify_no_content', $enotify_no_content);
        set_config('system', 'disable_embedded', $disable_embedded);
        set_config('system', 'allow_users_remote_self', $allow_users_remote_self);
+       set_config('system', 'check_new_version_url', $check_new_version_url);
  
        set_config('system', 'block_extended_register', $no_multi_reg);
        set_config('system', 'no_openid', $no_openid);
@@@ -1137,6 -1147,12 +1148,12 @@@ function admin_page_site(App $a) 
                SSL_POLICY_SELFSIGN => t("Self-signed certificate, use SSL for local links only (discouraged)")
        );
  
+       $check_git_version_choices = array(
+               "none" => t("Don't check"),
+               "master" => t("check the stable version"),
+               "develop" => t("check the development version")
+       );
        if ($a->config['hostname'] == "") {
                $a->config['hostname'] = $a->get_hostname();
        }
  
                '$nodeinfo'             => array('nodeinfo', t("Publish server information"), get_config('system','nodeinfo'), t("If enabled, general server and usage data will be published. The data contains the name and version of the server, number of users with public profiles, number of posts and the activated protocols and connectors. See <a href='http://the-federation.info/'>the-federation.info</a> for details.")),
  
+               '$check_new_version_url' => array('check_new_version_url', t("Check upstream version"), get_config('system', 'check_new_version_url'), t("Enables checking for new Friendica versions at github. If there is a new version, you will be informed in the admin panel overview."), $check_git_version_choices),
                '$suppress_tags'        => array('suppress_tags', t("Suppress Tags"), get_config('system','suppress_tags'), t("Suppress showing a list of hashtags at the end of the posting.")),
                '$itemcache'            => array('itemcache', t("Path to item cache"), get_config('system','itemcache'), t("The item caches buffers generated bbcode and external images.")),
                '$itemcache_duration'   => array('itemcache_duration', t("Cache duration in seconds"), get_config('system','itemcache_duration'), t("How long should the cache files be hold? Default value is 86400 seconds (One day). To disable the item cache, set the value to -1.")),