]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use command -v to check for sendmail
authorJoas Schilling <nickvergessen@gmx.de>
Wed, 12 Mar 2014 10:47:21 +0000 (11:47 +0100)
committerJoas Schilling <nickvergessen@gmx.de>
Wed, 12 Mar 2014 10:47:21 +0000 (11:47 +0100)
Fix #7559

settings/admin.php

index 47028a701db66343ad591c7109a0c2b44f856e0c..80b038d2ef61c2c964d18e7cc4cafb118f7061c8 100755 (executable)
@@ -21,7 +21,7 @@ $entries=OC_Log_Owncloud::getEntries(3);
 $entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3;
 
 // Should we display sendmail as an option?
-if (ini_get('sendmail_path') || file_exists('/usr/sbin/sendmail') || file_exists('/var/qmail/bin/sendmail')) {
+if (findBinaryPath('sendmailsendmail')) {
        $tmpl->assign('sendmail_is_available', true);
 }
 
@@ -66,3 +66,17 @@ foreach($forms as $form) {
        $tmpl->append('forms', $form);
 }
 $tmpl->printPage();
+
+/**
+ * Try to find a programm
+ *
+ * @param string $program
+ * @return null|string
+ */
+function findBinaryPath($program) {
+       exec('command -v ' . escapeshellarg($program) . ' 2> /dev/null', $output, $returnCode);
+       if ($returnCode === 0 && count($output) > 0) {
+               return escapeshellcmd($output[0]);
+       }
+       return null;
+}