summaryrefslogtreecommitdiff
path: root/includes/installer/SqliteInstaller.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
commitca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch)
treeec04cc15b867bc21eedca904cea9af0254531a11 /includes/installer/SqliteInstaller.php
parenta22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff)
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing
Diffstat (limited to 'includes/installer/SqliteInstaller.php')
-rw-r--r--includes/installer/SqliteInstaller.php43
1 files changed, 39 insertions, 4 deletions
diff --git a/includes/installer/SqliteInstaller.php b/includes/installer/SqliteInstaller.php
index 2edb3d9b..144e710d 100644
--- a/includes/installer/SqliteInstaller.php
+++ b/includes/installer/SqliteInstaller.php
@@ -14,6 +14,11 @@
*/
class SqliteInstaller extends DatabaseInstaller {
+ /**
+ * @var DatabaseSqlite
+ */
+ public $db;
+
protected $globalNames = array(
'wgDBname',
'wgSQLiteDataDir',
@@ -45,8 +50,12 @@ class SqliteInstaller extends DatabaseInstaller {
$this->getTextBox( 'wgDBname', 'config-db-name', array(), $this->parent->getHelpBox( 'config-sqlite-name-help' ) );
}
- /*
+ /**
* Safe wrapper for PHP's realpath() that fails gracefully if it's unable to canonicalize the path.
+ *
+ * @param $path string
+ *
+ * @return string
*/
private static function realpath( $path ) {
$result = realpath( $path );
@@ -56,14 +65,16 @@ class SqliteInstaller extends DatabaseInstaller {
return $result;
}
+ /**
+ * @return Status
+ */
public function submitConnectForm() {
$this->setVarsFromRequest( array( 'wgSQLiteDataDir', 'wgDBname' ) );
# Try realpath() if the directory already exists
$dir = self::realpath( $this->getVar( 'wgSQLiteDataDir' ) );
$result = self::dataDirOKmaybeCreate( $dir, true /* create? */ );
- if ( $result->isOK() )
- {
+ if ( $result->isOK() ) {
# Try expanding again in case we've just created it
$dir = self::realpath( $dir );
$this->setVar( 'wgSQLiteDataDir', $dir );
@@ -71,6 +82,11 @@ class SqliteInstaller extends DatabaseInstaller {
return $result;
}
+ /**
+ * @param $dir
+ * @param $create bool
+ * @return Status
+ */
private static function dataDirOKmaybeCreate( $dir, $create = false ) {
if ( !is_dir( $dir ) ) {
if ( !is_writable( dirname( $dir ) ) ) {
@@ -103,6 +119,9 @@ class SqliteInstaller extends DatabaseInstaller {
return Status::newGood();
}
+ /**
+ * @return Status
+ */
public function openConnection() {
global $wgSQLiteDataDir;
@@ -110,7 +129,7 @@ class SqliteInstaller extends DatabaseInstaller {
$dir = $this->getVar( 'wgSQLiteDataDir' );
$dbName = $this->getVar( 'wgDBname' );
try {
- # FIXME: need more sensible constructor parameters, e.g. single associative array
+ # @todo FIXME: Need more sensible constructor parameters, e.g. single associative array
# Setting globals kind of sucks
$wgSQLiteDataDir = $dir;
$db = new DatabaseSqlite( false, false, false, $dbName );
@@ -121,6 +140,9 @@ class SqliteInstaller extends DatabaseInstaller {
return $status;
}
+ /**
+ * @return bool
+ */
public function needsUpgrade() {
$dir = $this->getVar( 'wgSQLiteDataDir' );
$dbName = $this->getVar( 'wgDBname' );
@@ -133,6 +155,9 @@ class SqliteInstaller extends DatabaseInstaller {
return parent::needsUpgrade();
}
+ /**
+ * @return Status
+ */
public function setupDatabase() {
$dir = $this->getVar( 'wgSQLiteDataDir' );
@@ -162,11 +187,18 @@ class SqliteInstaller extends DatabaseInstaller {
return $this->getConnection();
}
+ /**
+ * @return Staus
+ */
public function createTables() {
$status = parent::createTables();
return $this->setupSearchIndex( $status );
}
+ /**
+ * @param $status Status
+ * @return Status
+ */
public function setupSearchIndex( &$status ) {
global $IP;
@@ -181,6 +213,9 @@ class SqliteInstaller extends DatabaseInstaller {
return $status;
}
+ /**
+ * @return string
+ */
public function getLocalSettings() {
$dir = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgSQLiteDataDir' ) );
return