]> source.dussan.org Git - nextcloud-server.git/commitdiff
add a check and a warning if the ownClodu server is not able to establish http connec...
authorFrank Karlitschek <frank@owncloud.org>
Thu, 8 Nov 2012 17:08:44 +0000 (18:08 +0100)
committerFrank Karlitschek <frank@owncloud.org>
Thu, 8 Nov 2012 17:08:44 +0000 (18:08 +0100)
lib/util.php
settings/admin.php
settings/css/settings.css
settings/templates/admin.php

index 40b44bf9d6eb2d6d760c114785813362f074531c..8574ec31d83a2076c793750975055678c8b52b89 100755 (executable)
@@ -584,6 +584,33 @@ class OC_Util {
                }
        }
 
+
+        /**
+         * Check if the ownCloud server can connect to the internet
+         */
+        public static function isinternetconnectionworking() {
+
+               // try to connect to owncloud.org to see if http connections to the internet are possible.
+               $connected = @fsockopen("www.owncloud.org", 80); 
+               if ($connected){
+                       fclose($connected);
+                       return true; 
+               }else{
+
+                       // second try in case one server is down
+                       $connected = @fsockopen("apps.owncloud.com", 80); 
+                       if ($connected){
+                               fclose($connected);
+                               return true; 
+                       }else{
+                               return false; 
+                       }
+
+               }
+
+       }
+
+
        /**
        * @brief Generates a cryptographical secure pseudorandom string
        * @param Int with the length of the random string
index c704704ed33dc362510b8c5246ba4820e8dbc5a6..0cf449ef2ba2f688749a0fe419c29fb0e5405f2c 100755 (executable)
@@ -29,6 +29,7 @@ $tmpl->assign('loglevel', OC_Config::getValue( "loglevel", 2 ));
 $tmpl->assign('entries', $entries);
 $tmpl->assign('entriesremain', $entriesremain);
 $tmpl->assign('htaccessworking', $htaccessworking);
+$tmpl->assign('internetconnectionworking', OC_Util::isinternetconnectionworking());
 $tmpl->assign('backgroundjobs_mode', OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax'));
 $tmpl->assign('shareAPIEnabled', OC_Appconfig::getValue('core', 'shareapi_enabled', 'yes'));
 $tmpl->assign('allowLinks', OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes'));
index f5ee2124f0f11e59c864bc3bcebf81c85caf9c25..560862fa12f23c0c1ec86f20d09540699452105a 100644 (file)
@@ -65,5 +65,6 @@ span.version { margin-left:1em; margin-right:1em; color:#555; }
 
 /* ADMIN */
 span.securitywarning {color:#C33; font-weight:bold; }
+span.connectionwarning {color:#933; font-weight:bold; }
 input[type=radio] { width:1em; }
 table.shareAPI td { padding-bottom: 0.8em; }
index 300d6093d6faa91feaeaf697a90be1400263892c..9c4ee0bf6806895efcfc84dc3f895570b6678df4 100644 (file)
@@ -22,6 +22,20 @@ if(!$_['htaccessworking']) {
 }
 ?>
 
+<?php
+if(!$_['internetconnectionworking']) {
+?>
+<fieldset class="personalblock">
+        <legend><strong><?php echo $l->t('Internet connection not working');?></strong></legend>
+
+        <span class="connectionwarning">
+        <?php echo $l->t('This ownCloud server has no working internet connection. This means that some of the features like mounting of external storage, notifications about updates or installation of 3rd party apps donĀ“t work. Accessing files from remote and sending of notification emails might also not work. We suggest to enable internet connection for this server if you want to have all features of ownCloud.'); ?>
+    </span>
+
+</fieldset>
+<?php
+}
+?>
 
 <?php foreach($_['forms'] as $form) {
        echo $form;