Per siebrand: typo
[lhc/web/wiklou.git] / maintenance / installExtension.php
index c5bb548..d5c4f4b 100644 (file)
@@ -17,8 +17,8 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  *
- * @package MediaWiki
- * @subpackage Maintenance
+ * @file
+ * @ingroup Maintenance
  */
 
 $optionsWithArgs = array( 'target', 'repository', 'repos' );
@@ -29,6 +29,9 @@ define('EXTINST_NOPATCH', 0);
 define('EXTINST_WRITEPATCH', 6);
 define('EXTINST_HOTPATCH', 10);
 
+/**
+ * @ingroup Maintenance
+ */
 class InstallerRepository {
        var $path;
        
@@ -44,7 +47,7 @@ class InstallerRepository {
                trigger_error( 'override InstallerRepository::getResource()', E_USER_ERROR );
        }        
        
-       /*static*/ function makeRepository( $path, $type = NULL ) {
+       static function makeRepository( $path, $type = NULL ) {
                if ( !$type ) {
                        $m = array();
                        preg_match( '!(([-+\w]+)://)?.*?(\.[-\w\d.]+)?$!', $path, $m );
@@ -65,6 +68,9 @@ class InstallerRepository {
        }
 }
 
+/**
+ * @ingroup Maintenance
+ */
 class LocalInstallerRepository extends InstallerRepository {
 
        function LocalInstallerRepository ( $path ) {
@@ -74,7 +80,7 @@ class LocalInstallerRepository extends InstallerRepository {
        function printListing( ) {
                $ff = glob( "{$this->path}/*" );
                if ( $ff === false || $ff === NULL ) {
-                       ExtensionInstaller::error( "listing directory $repos failed!" );
+                       ExtensionInstaller::error( "listing directory {$this->path} failed!" );
                        return false;
                }
                
@@ -102,6 +108,9 @@ class LocalInstallerRepository extends InstallerRepository {
        }        
 }
 
+/**
+ * @ingroup Maintenance
+ */
 class WebInstallerRepository extends InstallerRepository {
 
        function WebInstallerRepository ( $path ) {
@@ -145,6 +154,9 @@ class WebInstallerRepository extends InstallerRepository {
        }        
 }
 
+/**
+ * @ingroup Maintenance
+ */
 class SVNInstallerRepository extends InstallerRepository {
 
        function SVNInstallerRepository ( $path ) {
@@ -177,6 +189,9 @@ class SVNInstallerRepository extends InstallerRepository {
        }        
 }
 
+/**
+ * @ingroup Maintenance
+ */
 class InstallerResource {
        var $path;
        var $isdir;
@@ -244,6 +259,9 @@ class InstallerResource {
        }
 }
 
+/**
+ * @ingroup Maintenance
+ */
 class LocalInstallerResource extends InstallerResource {
        function LocalInstallerResource( $path ) {
                InstallerResource::InstallerResource( $path, is_dir( $path ), true );
@@ -256,6 +274,9 @@ class LocalInstallerResource extends InstallerResource {
         
 }
 
+/**
+ * @ingroup Maintenance
+ */
 class WebInstallerResource extends InstallerResource {
        function WebInstallerResource( $path ) {
                InstallerResource::InstallerResource( $path, false, false );
@@ -279,6 +300,9 @@ class WebInstallerResource extends InstallerResource {
        }        
 }
 
+/**
+ * @ingroup Maintenance
+ */
 class SVNInstallerResource extends InstallerResource {
        function SVNInstallerResource( $path ) {
                InstallerResource::InstallerResource( $path, true, false );
@@ -298,6 +322,9 @@ class SVNInstallerResource extends InstallerResource {
        }        
 }
 
+/**
+ * @ingroup Maintenance
+ */
 class ExtensionInstaller {
        var $source;
        var $target;
@@ -320,15 +347,15 @@ class ExtensionInstaller {
                #TODO: allow a config file different from "LocalSettings.php"
        }
 
-       function note( $msg ) {
+       static function note( $msg ) {
                print "$msg\n";
        }
 
-       function warn( $msg ) {
+       static function warn( $msg ) {
                print "WARNING: $msg\n";
        }
 
-       function error( $msg ) {
+       static function error( $msg ) {
                print "ERROR: $msg\n";
        }
 
@@ -471,18 +498,18 @@ class ExtensionInstaller {
                #TODO: allow custom installer scripts + sql patches
                
                if ( !file_exists( $f ) ) {
-                       $this->warn( "No install.settings file provided!" );
+                       self::warn( "No install.settings file provided!" );
                        $this->tasks[] = "Please read the instructions and edit LocalSettings.php manually to activate the extension.";
                        return '?';
                }
                else {
-                       $this->note( "applying settings patch..." );
+                       self::note( "applying settings patch..." );
                }
                
                $settings = file_get_contents( $f );
                                
                if ( !$settings ) {
-                       $this->error( "failed to read settings from $f!" );
+                       self::error( "failed to read settings from $f!" );
                        return false;
                }
                                
@@ -490,7 +517,7 @@ class ExtensionInstaller {
                
                if ( $mode == EXTINST_NOPATCH ) {
                        $this->tasks[] = "Please put the following into your LocalSettings.php:" . "\n$settings\n";
-                       $this->note( "Skipping patch phase, automatic patching is off." );
+                       self::note( "Skipping patch phase, automatic patching is off." );
                        return true;
                }
                
@@ -501,18 +528,18 @@ class ExtensionInstaller {
                        $ok = copy( $t, $bak );
                                        
                        if ( !$ok ) {
-                               $this->warn( "failed to create backup of LocalSettings.php!" );
+                               self::warn( "failed to create backup of LocalSettings.php!" );
                                return false;
                        }
                        else {
-                               $this->note( "created backup of LocalSettings.php at $bak" );
+                               self::note( "created backup of LocalSettings.php at $bak" );
                        }
                }
                                
                $localsettings = file_get_contents( $t );
                                
                if ( !$settings ) {
-                       $this->error( "failed to read $t for patching!" );
+                       self::error( "failed to read $t for patching!" );
                        return false;
                }
                                
@@ -535,14 +562,14 @@ class ExtensionInstaller {
                $ok = file_put_contents( $t, $localsettings );
                
                if ( !$ok ) {
-                       $this->error( "failed to patch $t!" );
+                       self::error( "failed to patch $t!" );
                        return false;
                }
                else if ( $mode == EXTINST_HOTPATCH ) {
-                       $this->note( "successfully patched $t" );
+                       self::note( "successfully patched $t" );
                }
                else  {
-                       $this->note( "created patched settings file $t" );
+                       self::note( "created patched settings file $t" );
                        $this->tasks[] = "Replace your current LocalSettings.php with ".basename($t);
                }
                
@@ -653,4 +680,4 @@ if ( $ok ) $ok = $installer->patchLocalSettings( $mode );
 if ( $ok ) $ok = $installer->printNotices();
 
 if ( $ok ) $installer->note( "$name extension installed." );
-?>
+