r39072 - Code Review

From MediaWiki.org

Jump to: navigation, search
Repository:MediaWiki
Revision:r39071 | r39072 (on ViewVC) | r39073 >
Date:16:19, 10 August 2008
Author:demon
Status:ok
Tags:
Comment:Use wfMkdirParents() because it's cooler (and mkdir() would've failed on parent directory creation without the 'recursive' flag). Also removed an icky hardcoded directory mode. Sadly, this does not fix bug 15108 :p
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseSqlite.php
===================================================================
--- trunk/phase3/includes/db/DatabaseSqlite.php	(revision 39071)
+++ trunk/phase3/includes/db/DatabaseSqlite.php	(revision 39072)
@@ -20,9 +20,9 @@
 	 * Constructor
 	 */
 	function __construct($server = false, $user = false, $password = false, $dbName = false, $failFunction = false, $flags = 0) {
-		global $wgOut,$wgSQLiteDataDir;
+		global $wgOut,$wgSQLiteDataDir, $wgSQLiteDataDirMode;
 		if ("$wgSQLiteDataDir" == '') $wgSQLiteDataDir = dirname($_SERVER['DOCUMENT_ROOT']).'/data';
-		if (!is_dir($wgSQLiteDataDir)) mkdir($wgSQLiteDataDir,0700);
+		if (!is_dir($wgSQLiteDataDir)) wfMkdirParents( $wgSQLiteDataDir, $wgSQLiteDataDirMode );
 		if (!isset($wgOut)) $wgOut = NULL; # Can't get a reference if it hasn't been set yet
 		$this->mOut =& $wgOut;
 		$this->mFailFunction = $failFunction;
Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 39071)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 39072)
@@ -572,6 +572,12 @@
 /** To override default SQLite data directory ($docroot/../data) */
 $wgSQLiteDataDir    = '';
 
+/** Default directory mode for SQLite data directory on creation.
+ *  Note that this is different from the default directory mode used
+ *  elsewhere.
+ */
+$wgSQLiteDataDirMode = 0700;
+
 /**
  * Make all database connections secretly go to localhost. Fool the load balancer
  * thinking there is an arbitrarily large cluster of servers to connect to.
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 39071)
+++ trunk/phase3/RELEASE-NOTES	(revision 39072)
@@ -28,6 +28,9 @@
 * (bug 15080) $wgOverrideSiteFeed has been added. Setting either
   $wgSiteFeed['rss'] or 'atom' to a URL will override the default Recent Changes
   feed that appears on all pages.
+* $wgSQLiteDataDirMode has been introduced as the default directory mode for
+  SQLite data directories on creation. Note this setting is separate from
+  $wgDirectoryMode, which applies to all normal directories created by MediaWiki.
 
 === New features in 1.14 ===
 
Views
Toolbox