Merge "No longer support installs where register_globals is enabled"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 9 Jul 2014 01:19:39 +0000 (01:19 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 9 Jul 2014 01:19:39 +0000 (01:19 +0000)
14 files changed:
RELEASE-NOTES-1.24
includes/Namespace.php
includes/OutputPage.php
includes/Preferences.php
includes/Title.php
includes/db/DatabaseMssql.php
includes/installer/Installer.php
includes/installer/MssqlInstaller.php
includes/installer/PostgresInstaller.php
includes/libs/HttpStatus.php
includes/specials/SpecialListfiles.php
languages/i18n/en.json
languages/i18n/qqq.json
maintenance/install.php

index bb003f1..f23e13a 100644 (file)
@@ -218,6 +218,11 @@ changes to languages because of Bugzilla reports.
   SpecialPageBeforeFormDisplay.
 * (bug 65781) Removed block warning on included {{Special:Contributions}}
 * Removed Skin::makeGlobalVariablesScript. (deprecated since 1.19)
+* Removed MWNamespace::isMain(). (deprecated since 1.19)
+* Removed Preferences::loadOldSearchNs(). (deprecated since 1.19)
+* Removed OutputPage::getStatusMessage(). (deprecated since 1.18)
+* Removed OutputPage::isUserJsAllowed(). (deprecated since 1.18)
+* Removed Title::updateTitleProtection(). (deprecated since 1.19)
 
 ==== Renamed classes ====
 * CLDRPluralRuleConverter_Expression to CLDRPluralRuleConverterExpression
index 4edddbc..392f558 100644 (file)
@@ -88,16 +88,6 @@ class MWNamespace {
                return !self::isTalk( $index );
        }
 
-       /**
-        * @see self::isSubject
-        * @deprecated since 1.19 Please use the more consistently named isSubject
-        * @return bool
-        */
-       public static function isMain( $index ) {
-               wfDeprecated( __METHOD__, '1.19' );
-               return self::isSubject( $index );
-       }
-
        /**
         * Is the given namespace a talk namespace?
         *
index 62f3c13..8967938 100644 (file)
@@ -1342,18 +1342,6 @@ class OutputPage extends ContextSource {
                );
        }
 
-       /**
-        * Return whether user JavaScript is allowed for this page
-        * @deprecated since 1.18 Load modules with ResourceLoader, and origin and
-        *     trustworthiness is identified and enforced automagically.
-        * @return bool
-        */
-       public function isUserJsAllowed() {
-               wfDeprecated( __METHOD__, '1.18' );
-               return $this->getAllowedModules( ResourceLoaderModule::TYPE_SCRIPTS ) >=
-                       ResourceLoaderModule::ORIGIN_USER_INDIVIDUAL;
-       }
-
        /**
         * Show what level of JavaScript / CSS untrustworthiness is allowed on this page
         * @see ResourceLoaderModule::$origin
@@ -2066,19 +2054,6 @@ class OutputPage extends ContextSource {
                }
        }
 
-       /**
-        * Get the message associated with the HTTP response code $code
-        *
-        * @param int $code Status code
-        * @return string|null Message or null if $code is not in the list of messages
-        *
-        * @deprecated since 1.18 Use HttpStatus::getMessage() instead.
-        */
-       public static function getStatusMessage( $code ) {
-               wfDeprecated( __METHOD__, '1.18' );
-               return HttpStatus::getMessage( $code );
-       }
-
        /**
         * Finally, all the text has been munged and accumulated into
         * the object, let's actually output it:
index 081315e..f884ec3 100644 (file)
@@ -1463,27 +1463,6 @@ class Preferences {
                        return array( $result, 'mailerror' );
                }
        }
-
-       /**
-        * @deprecated since 1.19
-        * @param User $user
-        * @return array
-        */
-       public static function loadOldSearchNs( $user ) {
-               wfDeprecated( __METHOD__, '1.19' );
-
-               $searchableNamespaces = SearchEngine::searchableNamespaces();
-               // Back compat with old format
-               $arr = array();
-
-               foreach ( $searchableNamespaces as $ns => $name ) {
-                       if ( $user->getOption( 'searchNs' . $ns ) ) {
-                               $arr[] = $ns;
-                       }
-               }
-
-               return $arr;
-       }
 }
 
 /** Some tweaks to allow js prefs to work */
index b8b0e30..3c5b80f 100644 (file)
@@ -2583,30 +2583,6 @@ class Title {
                return $this->mTitleProtection;
        }
 
-       /**
-        * Update the title protection status
-        *
-        * @deprecated since 1.19; use WikiPage::doUpdateRestrictions() instead.
-        * @param string $create_perm Permission required for creation
-        * @param string $reason Reason for protection
-        * @param string $expiry Expiry timestamp
-        * @return bool
-        */
-       public function updateTitleProtection( $create_perm, $reason, $expiry ) {
-               wfDeprecated( __METHOD__, '1.19' );
-
-               global $wgUser;
-
-               $limit = array( 'create' => $create_perm );
-               $expiry = array( 'create' => $expiry );
-
-               $page = WikiPage::factory( $this );
-               $cascade = false;
-               $status = $page->doUpdateRestrictions( $limit, $expiry, $cascade, $reason, $wgUser );
-
-               return $status->isOK();
-       }
-
        /**
         * Remove any title protection due to page existing
         */
index a03dd75..be01f1a 100644 (file)
@@ -1004,6 +1004,11 @@ class DatabaseMssql extends DatabaseBase {
                        return false;
                }
 
+               if ( $schema === false ) {
+                       global $wgDBmwschema;
+                       $schema = $wgDBmwschema;
+               }
+
                $res = $this->query( "SELECT 1 FROM INFORMATION_SCHEMA.TABLES
                        WHERE TABLE_TYPE = 'BASE TABLE'
                        AND TABLE_SCHEMA = '$schema' AND TABLE_NAME = '$table'" );
@@ -1341,7 +1346,7 @@ class DatabaseMssql extends DatabaseBase {
                        // Used internally, we want the schema split off from the table name and returned
                        // as a list with 3 elements (database, schema, table)
                        $table = explode( '.', $table );
-                       if ( count( $table ) == 2 ) {
+                       while ( count( $table ) < 3 ) {
                                array_unshift( $table, false );
                        }
                }
index c84128c..f014032 100644 (file)
@@ -380,26 +380,15 @@ abstract class Installer {
                        $this->settings[$var] = $GLOBALS[$var];
                }
 
-               $compiledDBs = array();
+               $this->compiledDBs = array();
                foreach ( self::getDBTypes() as $type ) {
                        $installer = $this->getDBInstaller( $type );
 
                        if ( !$installer->isCompiled() ) {
                                continue;
                        }
-                       $compiledDBs[] = $type;
-
-                       $defaults = $installer->getGlobalDefaults();
-
-                       foreach ( $installer->getGlobalNames() as $var ) {
-                               if ( isset( $defaults[$var] ) ) {
-                                       $this->settings[$var] = $defaults[$var];
-                               } else {
-                                       $this->settings[$var] = $GLOBALS[$var];
-                               }
-                       }
+                       $this->compiledDBs[] = $type;
                }
-               $this->compiledDBs = $compiledDBs;
 
                $this->parserTitle = Title::newFromText( 'Installer' );
                $this->parserOptions = new ParserOptions; // language will be wrong :(
index 51db148..83681b6 100644 (file)
@@ -218,6 +218,7 @@ class MssqlInstaller extends DatabaseInstaller {
                                'password' => $password,
                                'dbname' => false,
                                'flags' => 0,
+                               'schema' => $this->getVar( 'wgDBmwschema' ),
                                'tablePrefix' => $this->getVar( 'wgDBprefix' ) ) );
                        $db->prepareStatements( false );
                        $db->scrollableCursor( false );
@@ -648,6 +649,14 @@ class MssqlInstaller extends DatabaseInstaller {
                return $status;
        }
 
+       public function getGlobalDefaults() {
+               // The default $wgDBmwschema is null, which breaks Postgres and other DBMSes that require
+               // the use of a schema, so we need to set it here
+               return array(
+                       'wgDBmwschema' => 'mediawiki',
+               );
+       }
+
        /**
         * Try to see if the login exists
         * @param string $user Username to check
index 9e25f47..89a6978 100644 (file)
@@ -152,17 +152,18 @@ class PostgresInstaller extends DatabaseInstaller {
         * @param string $user User name
         * @param string $password Password
         * @param string $dbName Database name
+        * @param string $schema Database schema
         * @return Status
         */
-       protected function openConnectionWithParams( $user, $password, $dbName ) {
+       protected function openConnectionWithParams( $user, $password, $dbName, $schema ) {
                $status = Status::newGood();
                try {
-                       $db = new DatabasePostgres(
-                               $this->getVar( 'wgDBserver' ),
-                               $user,
-                               $password,
-                               $dbName
-                       );
+                       $db = Database::factory( 'postgres', array(
+                               'host' => $this->getVar( 'wgDBserver' ),
+                               'user' => $user,
+                               'password' => $password,
+                               'dbname' => $dbName,
+                               'schema' => $schema ) );
                        $status->value = $db;
                } catch ( DBConnectionError $e ) {
                        $status->fatal( 'config-connection-error', $e->getMessage() );
@@ -230,7 +231,8 @@ class PostgresInstaller extends DatabaseInstaller {
                                return $this->openConnectionWithParams(
                                        $this->getVar( '_InstallUser' ),
                                        $this->getVar( '_InstallPassword' ),
-                                       $this->getVar( 'wgDBname' ) );
+                                       $this->getVar( 'wgDBname' ),
+                                       $this->getVar( 'wgDBmwschema' ) );
                        case 'create-tables':
                                $status = $this->openPgConnection( 'create-schema' );
                                if ( $status->isOK() ) {
@@ -260,11 +262,11 @@ class PostgresInstaller extends DatabaseInstaller {
                $status = Status::newGood();
                foreach ( $dbs as $db ) {
                        try {
-                               $conn = new DatabasePostgres(
-                                       $this->getVar( 'wgDBserver' ),
+                               $conn = $this->openConnectionWithParams(
                                        $user,
                                        $password,
-                                       $db );
+                                       $db,
+                                       $this->getVar( 'wgDBmwschema' ) );
                        } catch ( DBConnectionError $error ) {
                                $conn = false;
                                $status->fatal( 'config-pg-test-error', $db,
@@ -622,6 +624,14 @@ class PostgresInstaller extends DatabaseInstaller {
                return $status;
        }
 
+       public function getGlobalDefaults() {
+               // The default $wgDBmwschema is null, which breaks Postgres and other DBMSes that require
+               // the use of a schema, so we need to set it here
+               return array(
+                       'wgDBmwschema' => 'mediawiki',
+               );
+       }
+
        public function setupPLpgSQL() {
                // Connect as the install user, since it owns the database and so is
                // the user that needs to run "CREATE LANGAUGE"
index d72ffca..809bfdf 100644 (file)
@@ -28,8 +28,6 @@ class HttpStatus {
        /**
         * Get the message associated with HTTP response code $code
         *
-        * Replace OutputPage::getStatusMessage( $code )
-        *
         * @param $code Integer: status code
         * @return String or null: message or null if $code is not in the list of
         *         messages
index 3715b8b..1faa013 100644 (file)
@@ -460,6 +460,19 @@ class ImageListPager extends TablePager {
                                        );
                                        $download = $this->msg( 'parentheses' )->rawParams( $download )->escaped();
 
+                                       // Add delete links if allowed
+                                       // From https://github.com/Wikia/app/pull/3859
+                                       if ( $filePage->userCan( 'delete', $this->getUser() ) ) {
+                                               $deleteMsg = $this->msg( 'listfiles-delete' )->escaped();
+
+                                               $delete = Linker::linkKnown(
+                                                       $filePage, $deleteMsg, array(), array( 'action' => 'delete' )
+                                               );
+                                               $delete = $this->msg( 'parentheses' )->rawParams( $delete )->escaped();
+
+                                               return "$link $download $delete";
+                                       }
+
                                        return "$link $download";
                                } else {
                                        return htmlspecialchars( $value );
index 1be50b4..d0e7ad3 100644 (file)
        "license-nopreview": "(Preview not available)",
        "upload_source_url": "(a valid, publicly accessible URL)",
        "upload_source_file": "(a file on your computer)",
+       "listfiles-delete": "delete",
        "listfiles-summary": "This special page shows all uploaded files.",
        "listfiles_search_for": "Search for media name:",
        "imgfile": "file",
index a10ad5a..78dd1fd 100644 (file)
        "license-nopreview": "Error message when a certain license does not exist",
        "upload_source_url": "Used in [[Special:Upload]].\n\nSee also:\n* {{msg-mw|Sourcefilename|label}}\n* {{msg-mw|Sourceurl|label}}\n* {{msg-mw|Upload source file}}\n* {{msg-mw|Upload-maxfilesize}}",
        "upload_source_file": "Used in [[Special:Upload]].\n\nSee also:\n* {{msg-mw|Sourcefilename|label}}\n* {{msg-mw|Sourceurl|label}}\n* {{msg-mw|Upload source url}}\n* {{msg-mw|Upload-maxfilesize}}",
+       "listfiles-delete": "Text of the delete links next to the entries on [[Special:ListFiles]], surrounded by parentheses.",
        "listfiles-summary": "This message is displayed at the top of [[Special:ImageList]] to explain how to use that special page.",
        "listfiles_search_for": "Input label for the form displayed on [[Special:ListFiles]].",
        "imgfile": "{{Identical|File}}",
index 5a3e00c..fbc5d98 100644 (file)
@@ -85,8 +85,8 @@ class CommandLineInstaller extends Maintenance {
                        true
                );
                $this->addOption( 'confpath', "Path to write LocalSettings.php to ($IP)", false, true );
+               $this->addOption( 'dbschema', 'The schema for the MediaWiki DB in PostgreSQL/Microsoft SQL Server (mediawiki)', false, true );
                /*
-               $this->addOption( 'dbschema', 'The schema for the MediaWiki DB in pg (mediawiki)', false, true );
                $this->addOption( 'namespace', 'The project namespace (same as the "name" argument)', false, true );
                */
                $this->addOption( 'env-checks', "Run environment checks only, don't change anything" );