Fix message cache expiry semantics
[lhc/web/wiklou.git] / includes / installer / Installer.php
index c1af27c..daac558 100644 (file)
@@ -643,6 +643,8 @@ abstract class Installer {
 
                $allNames = array();
 
+               // Give grep a chance to find the usages:
+               // config-type-mysql, config-type-postgres, config-type-oracle, config-type-sqlite
                foreach ( self::getDBTypes() as $name ) {
                        $allNames[] = wfMessage( "config-type-$name" )->text();
                }
@@ -988,14 +990,14 @@ abstract class Installer {
                                continue;
                        }
 
-                       list( $all, $lang, $territory, $charset, $modifier ) = $m;
+                       list( , $lang, , , ) = $m;
 
                        $candidatesByLocale[$m[0]] = $m;
                        $candidatesByLang[$lang][] = $m;
                }
 
                # Try the current value of LANG.
-               if ( isset( $candidatesByLocale[ getenv( 'LANG' ) ] ) ) {
+               if ( isset( $candidatesByLocale[getenv( 'LANG' )] ) ) {
                        $this->setVar( 'wgShellLocale', getenv( 'LANG' ) );
                        return true;
                }
@@ -1172,8 +1174,8 @@ abstract class Installer {
         *
         * Used only by environment checks.
         *
-        * @param $path String: path to search
-        * @param $names Array of executable names
+        * @param string $path path to search
+        * @param array $names of executable names
         * @param $versionInfo Boolean false or array with two members:
         *               0 => Command to run for version check, with $1 for the full executable name
         *               1 => String to compare the output with
@@ -1277,7 +1279,7 @@ abstract class Installer {
        /**
         * Checks for presence of an Apache module. Works only if PHP is running as an Apache module, too.
         *
-        * @param $moduleName String: Name of module to check.
+        * @param string $moduleName Name of module to check.
         * @return bool
         */
        public static function apacheModulePresent( $moduleName ) {
@@ -1318,13 +1320,16 @@ abstract class Installer {
         */
        public function findExtensions() {
                if( $this->getVar( 'IP' ) === null ) {
-                       return false;
+                       return array();
                }
 
-               $exts = array();
                $extDir = $this->getVar( 'IP' ) . '/extensions';
-               $dh = opendir( $extDir );
+               if ( !is_readable( $extDir ) || !is_dir( $extDir ) ) {
+                       return array();
+               }
 
+               $dh = opendir( $extDir );
+               $exts = array();
                while ( ( $file = readdir( $dh ) ) !== false ) {
                        if( !is_dir( "$extDir/$file" ) ) {
                                continue;
@@ -1333,6 +1338,7 @@ abstract class Installer {
                                $exts[] = $file;
                        }
                }
+               closedir( $dh );
                natcasesort( $exts );
 
                return $exts;
@@ -1402,10 +1408,10 @@ abstract class Installer {
                // then adding any callbacks that wanted to attach after a given step
                foreach( $coreInstallSteps as $step ) {
                        $this->installSteps[] = $step;
-                       if( isset( $this->extraInstallSteps[ $step['name'] ] ) ) {
+                       if( isset( $this->extraInstallSteps[$step['name']] ) ) {
                                $this->installSteps = array_merge(
                                        $this->installSteps,
-                                       $this->extraInstallSteps[ $step['name'] ]
+                                       $this->extraInstallSteps[$step['name']]
                                );
                        }
                }
@@ -1434,8 +1440,8 @@ abstract class Installer {
        /**
         * Actually perform the installation.
         *
-        * @param $startCB Array A callback array for the beginning of each step
-        * @param $endCB Array A callback array for the end of each step
+        * @param array $startCB A callback array for the beginning of each step
+        * @param array $endCB A callback array for the end of each step
         *
         * @return Array of Status objects
         */
@@ -1592,7 +1598,7 @@ abstract class Installer {
                $status = Status::newGood();
                try {
                        $page = WikiPage::factory( Title::newMainPage() );
-                       $content = new WikitextContent (
+                       $content = new WikitextContent(
                                wfMessage( 'mainpagetext' )->inContentLanguage()->text() . "\n\n" .
                                wfMessage( 'mainpagedocfooter' )->inContentLanguage()->text()
                        );
@@ -1602,7 +1608,7 @@ abstract class Installer {
                                        EDIT_NEW,
                                        false,
                                        User::newFromName( 'MediaWiki default' ) );
-               } catch (MWException $e) {
+               } catch ( MWException $e ) {
                        //using raw, because $wgShowExceptionDetails can not be set yet
                        $status->fatal( 'config-install-mainpage-failed', $e->getMessage() );
                }
@@ -1642,9 +1648,9 @@ abstract class Installer {
        /**
         * Add an installation step following the given step.
         *
-        * @param $callback Array A valid installation callback array, in this form:
+        * @param array $callback A valid installation callback array, in this form:
         *    array( 'name' => 'some-unique-name', 'callback' => array( $obj, 'function' ) );
-        * @param $findStep String the step to find. Omit to put the step at the beginning
+        * @param string $findStep the step to find. Omit to put the step at the beginning
         */
        public function addInstallStep( $callback, $findStep = 'BEGINNING' ) {
                $this->extraInstallSteps[$findStep][] = $callback;