[geeklog-hg] geeklog: Patch for adding the feature for better error	messages ...
    geeklog-cvs at lists.geeklog.net 
    geeklog-cvs at lists.geeklog.net
       
    Sun Apr  7 14:25:58 EDT 2013
    
    
  
changeset 9039:2cce335c44e1
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/2cce335c44e1
user: gugu <rishabhr123 at gmail.com>
date: Sun Apr 07 23:17:15 2013 +0530
description:
Patch for adding the feature for better error messages with SELinux enabled
diffstat:
 public_html/admin/install/index.php            |  23 ++++++++++++++++++++---
 public_html/admin/install/language/english.php |   3 ++-
 2 files changed, 22 insertions(+), 4 deletions(-)
diffs (63 lines):
diff -r e79475e28a4a -r 2cce335c44e1 public_html/admin/install/index.php
--- a/public_html/admin/install/index.php	Sun Apr 07 23:20:11 2013 +0900
+++ b/public_html/admin/install/index.php	Sun Apr 07 23:17:15 2013 +0530
@@ -1133,7 +1133,8 @@
             if (!isset($_CONF['allow_mysqldump']) && $_DB_dbms == 'mysql') {
                 array_splice($file_list, 1, 0, $gl_path . 'backups/');
             }
-
+            $check_selinux = false;
+            $cmd_selinux = '';
             foreach ($file_list as $file) {
                 if (!is_writable($file)) {
                     if (is_file($file)) {
@@ -1142,6 +1143,15 @@
                         $perm_should_be = '777';
                     }
                     $permission = sprintf("%3o", @fileperms($file) & 0777);
+                    $check_perm = 0;
+                    for ($i=0; $i<strlen($permission); $i++) {
+                        if ($permission[$i] >= $perm_should_be[$i])
+                            $check_perm++;
+                    }
+                    if ($check_perm >= 3) {
+                        $check_selinux = true;
+                        $cmd_selinux .= $file . ' ';
+                    }
                     $display_permissions    .= '<p><label class="' . $perms_label_dir . '"><code>' . $file . '</code></label>' . LB
                                             . ' <span class="permissions-list">' . $LANG_INSTALL[12] . ' '. $perm_should_be .'</span> ('
                                             . $LANG_INSTALL[13] . ' ' . $permission . ')</p>' . LB ;
@@ -1151,11 +1161,18 @@
             }
 
             $display_step = 1;
-
             /**
              * Display permissions, etc
              */
-            if ($num_wrong) {
+            if ($check_selinux){
+                $display .= '<h1 class="heading">' . $LANG_INSTALL[101] . ' ' . $display_step . ' - ' . $LANG_INSTALL[97] . '</h1>' . LB;
+                $display .= $LANG_INSTALL[110];
+                $cmd = 'chcon -Rt httpd_user_rw_content_t '.$cmd_selinux;
+                $display .= '<p class="codeblock"><code>' . $cmd . LB 
+                    . '</code></p><br ' . XHTML . '>' . LB;
+                $display_step++;
+            }
+            else if ($num_wrong) {
                 // If any files have incorrect permissions.
 
                 $display .= '<h1 class="heading">' . $LANG_INSTALL[101] . ' ' . $display_step . ' - ' . $LANG_INSTALL[97] . '</h1>' . LB;
diff -r e79475e28a4a -r 2cce335c44e1 public_html/admin/install/language/english.php
--- a/public_html/admin/install/language/english.php	Sun Apr 07 23:20:11 2013 +0900
+++ b/public_html/admin/install/language/english.php	Sun Apr 07 23:17:15 2013 +0530
@@ -158,7 +158,8 @@
     106 => 'PostgreSQL',
     107 => 'Database Password is required for production environments.',
     108 => 'No Database Drivers found!',
-    109 => 'Emergency Rescue Tool'
+    109 => 'Emergency Rescue Tool',
+    110 => 'The permissions seem to be correct but the install script still cannot write to the Geeklog directory. If you happen to be on SELinux, make sure the httpd process has write permissions for the same, try this out:'
 );
 
 // +---------------------------------------------------------------------------+
    
    
More information about the geeklog-cvs
mailing list