Index: branches/new-installer/phase3/includes/installer/Installer.i18n.php |
— | — | @@ -126,11 +126,23 @@ |
127 | 127 | 'config-uri' => 'Script URI path: <code>$1</code>.', |
128 | 128 | 'config-no-uri' => "'''Error:''' Could not determine the current URI. |
129 | 129 | Installation aborted.", |
130 | | - 'config-dir-not-writable' => "'''Error:''' Cannot write config file. |
| 130 | + 'config-dir-not-writable-group' => "'''Error:''' Cannot write config file. |
131 | 131 | Installation aborted. |
132 | 132 | |
133 | | -To make the directory writable on a Unix/Linux system: |
| 133 | +We've determined the user your webserver is running as. Make the |
| 134 | +<code><nowiki>config</nowiki></code> directory writable by it to continue. On a Unix/Linux system: |
| 135 | + |
134 | 136 | <pre>cd $1 |
| 137 | +chgrp $2 config |
| 138 | +chmod g+w config</pre>", |
| 139 | + 'config-dir-not-writable-nogroup' => "'''Error:''' Cannot write config file. |
| 140 | +Installation aborted. |
| 141 | + |
| 142 | +We couldn't determine the user your webserver is running as. Make the |
| 143 | +<code><nowiki>config</nowiki></code> directory globally writable by it (and others!) to continue. On |
| 144 | +a Unix/Linux system do: |
| 145 | + |
| 146 | +<pre>cd $1 |
135 | 147 | chmod a+w config</pre>", |
136 | 148 | 'config-file-extension' => 'Installing MediaWiki with <code>$1</code> file extensions.', |
137 | 149 | 'config-shell-locale' => 'Detected shell locale "$1"', |
— | — | @@ -505,12 +517,6 @@ |
506 | 518 | 'config-uri' => 'Script URI-pad: <code>$1</code>.', |
507 | 519 | 'config-no-uri' => "'''Fout:''' de huidige URI kon niet vastgesteld worden. |
508 | 520 | De installatie is afgebroken.", |
509 | | - 'config-dir-not-writable' => "'''Fout:''' het bestand met instellingen kon niet weggeschreven worden. |
510 | | -De installatie is afgebroken. |
511 | | - |
512 | | -Om de map beschrijfbaar te maken op een Unix/Linux-systeem: |
513 | | -<pre>cd $1 |
514 | | -chmod a+w config</pre>", |
515 | 521 | 'config-file-extension' => 'MediaWiki wordt geinstalleerd met <code>$1</code> als bestandsextensie.', |
516 | 522 | 'config-shell-locale' => 'Als shelllocale is "$1" herkend', |
517 | 523 | 'config-uploads-safe' => 'De uploadmap is beveiligd tegen het arbitrair uitvoeren van scripts.', |
Index: branches/new-installer/phase3/includes/installer/Installer.php |
— | — | @@ -611,7 +611,12 @@ |
612 | 612 | $ipDir = $this->getVar( 'IP' ); |
613 | 613 | $configDir = $ipDir . '/config'; |
614 | 614 | if( !is_writeable( $configDir ) ) { |
615 | | - $this->showMessage( 'config-dir-not-writable', $ipDir ); |
| 615 | + $webserverGroup = self::maybeGetWebserverPrimaryGroup(); |
| 616 | + if ( $webserverGroup !== null ) { |
| 617 | + $this->showMessage( 'config-dir-not-writable-group', $ipDir, $webserverGroup ); |
| 618 | + } else { |
| 619 | + $this->showMessage( 'config-dir-not-writable-nogroup', $ipDir, $webserverGroup ); |
| 620 | + } |
616 | 621 | return false; |
617 | 622 | } |
618 | 623 | } |
— | — | @@ -889,4 +894,30 @@ |
890 | 895 | $localSettings = new LocalSettings( $this ); |
891 | 896 | return $localSettings->writeLocalSettings(); |
892 | 897 | } |
| 898 | + |
| 899 | + /* |
| 900 | + * On POSIX systems return the primary group of the webserver we're running under. |
| 901 | + * On other systems just returns null. |
| 902 | + * |
| 903 | + * This is used to advice the user that he should chgrp his config/data/images directory as the |
| 904 | + * webserver user before he can install. |
| 905 | + * |
| 906 | + * Public because SqliteInstaller needs it, and doesn't subclass Installer. |
| 907 | + * |
| 908 | + * @return string |
| 909 | + */ |
| 910 | + public static function maybeGetWebserverPrimaryGroup() { |
| 911 | + if ( ! function_exists('posix_getegid') || ! function_exists('posix_getpwuid') ) { |
| 912 | + # I don't know this, this isn't UNIX |
| 913 | + return null; |
| 914 | + } |
| 915 | + |
| 916 | + # posix_getegid() *not* getmygid() because we want the group of the webserver, |
| 917 | + # not whoever owns the current script |
| 918 | + $gid = posix_getegid(); |
| 919 | + $getpwuid = posix_getpwuid( $gid ); |
| 920 | + $group = $getpwuid["name"]; |
| 921 | + |
| 922 | + return $group; |
| 923 | + } |
893 | 924 | } |