diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2012-01-12 13:42:29 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2012-01-12 13:42:29 +0100 |
commit | ba0fc4fa20067528effd4802e53ceeb959640825 (patch) | |
tree | 4f62217349d3afa39dbba3f7e19dac0aecb344f6 /maintenance | |
parent | ca32f08966f1b51fcb19460f0996bb0c4048e6fe (diff) |
Update to MediaWiki 1.18.1
Diffstat (limited to 'maintenance')
-rw-r--r-- | maintenance/Maintenance.php | 27 | ||||
-rw-r--r-- | maintenance/cleanupUploadStash.php | 2 | ||||
-rw-r--r-- | maintenance/eval.php | 2 | ||||
-rw-r--r-- | maintenance/importDump.php | 2 | ||||
-rw-r--r-- | maintenance/oracle/archives/patch_recentchanges_fk2_cascade.sql | 5 | ||||
-rw-r--r-- | maintenance/oracle/tables.sql | 2 | ||||
-rw-r--r-- | maintenance/postgres/archives/patch-uploadstash.sql | 24 | ||||
-rw-r--r-- | maintenance/postgres/archives/patch-uploadstash_sequence.sql | 2 | ||||
-rw-r--r-- | maintenance/postgres/tables.sql | 25 | ||||
-rw-r--r-- | maintenance/update.php | 6 |
10 files changed, 80 insertions, 17 deletions
diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 9ea57f4e..3618515a 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -32,15 +32,6 @@ if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.2 wfPHPVersionError( 'cli' ); } -// Wrapper for posix_isatty() -if ( !function_exists( 'posix_isatty' ) ) { - # We default as considering stdin a tty (for nice readline methods) - # but treating stout as not a tty to avoid color codes - function posix_isatty( $fd ) { - return !$fd; - } -} - /** * Abstract maintenance class for quickly writing and churning out * maintenance scripts with minimal effort. All that _must_ be defined @@ -1204,6 +1195,22 @@ abstract class Maintenance { } /** + * Wrapper for posix_isatty() + * We default as considering stdin a tty (for nice readline methods) + * but treating stout as not a tty to avoid color codes + * + * @param $fd int File descriptor + * @return bool + */ + public static function posix_isatty( $fd ) { + if ( !MWInit::functionExists( 'posix_isatty' ) ) { + return !$fd; + } else { + return posix_isatty( $fd ); + } +} + + /** * Prompt the console for input * @param $prompt String what to begin the line with, like '> ' * @return String response @@ -1211,7 +1218,7 @@ abstract class Maintenance { public static function readconsole( $prompt = '> ' ) { static $isatty = null; if ( is_null( $isatty ) ) { - $isatty = posix_isatty( 0 /*STDIN*/ ); + $isatty = self::posix_isatty( 0 /*STDIN*/ ); } if ( $isatty && function_exists( 'readline' ) ) { diff --git a/maintenance/cleanupUploadStash.php b/maintenance/cleanupUploadStash.php index 4b47f397..1926c05a 100644 --- a/maintenance/cleanupUploadStash.php +++ b/maintenance/cleanupUploadStash.php @@ -43,7 +43,7 @@ class UploadStashCleanup extends Maintenance { $res = $dbr->select( 'uploadstash', 'us_key', - 'us_timestamp < ' . $dbr->timestamp( time() - UploadStash::REPO_AGE * 3600 ), + 'us_timestamp < ' . $dbr->addQuotes( $dbr->timestamp( time() - UploadStash::REPO_AGE * 3600 ) ), __METHOD__ ); diff --git a/maintenance/eval.php b/maintenance/eval.php index 33c9a5d7..1502ad3e 100644 --- a/maintenance/eval.php +++ b/maintenance/eval.php @@ -58,7 +58,7 @@ if ( isset( $options['d'] ) ) { } if ( function_exists( 'readline_add_history' ) - && posix_isatty( 0 /*STDIN*/ ) ) + && Maintenance::posix_isatty( 0 /*STDIN*/ ) ) { $useReadline = true; } else { diff --git a/maintenance/importDump.php b/maintenance/importDump.php index c160b036..099b7895 100644 --- a/maintenance/importDump.php +++ b/maintenance/importDump.php @@ -228,7 +228,7 @@ TEXT; function importFromStdin() { $file = fopen( 'php://stdin', 'rt' ); - if( posix_isatty( $file ) ) { + if( self::posix_isatty( $file ) ) { $this->maybeHelp( true ); } return $this->importFromHandle( $file ); diff --git a/maintenance/oracle/archives/patch_recentchanges_fk2_cascade.sql b/maintenance/oracle/archives/patch_recentchanges_fk2_cascade.sql new file mode 100644 index 00000000..45509518 --- /dev/null +++ b/maintenance/oracle/archives/patch_recentchanges_fk2_cascade.sql @@ -0,0 +1,5 @@ +define mw_prefix='{$wgDBprefix}'; + +ALTER TABLE &mw_prefix.recentchanges DROP CONSTRAINT &mw_prefix.recentchanges_fk2; +ALTER TABLE &mw_prefix.recentchanges ADD CONSTRAINT &mw_prefix.recentchanges_fk2 FOREIGN KEY (rc_cur_id) REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; + diff --git a/maintenance/oracle/tables.sql b/maintenance/oracle/tables.sql index 2fd62ef7..c6162753 100644 --- a/maintenance/oracle/tables.sql +++ b/maintenance/oracle/tables.sql @@ -386,7 +386,7 @@ CREATE TABLE &mw_prefix.recentchanges ( ); ALTER TABLE &mw_prefix.recentchanges ADD CONSTRAINT &mw_prefix.recentchanges_pk PRIMARY KEY (rc_id); ALTER TABLE &mw_prefix.recentchanges ADD CONSTRAINT &mw_prefix.recentchanges_fk1 FOREIGN KEY (rc_user) REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; -ALTER TABLE &mw_prefix.recentchanges ADD CONSTRAINT &mw_prefix.recentchanges_fk2 FOREIGN KEY (rc_cur_id) REFERENCES &mw_prefix.page(page_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; +ALTER TABLE &mw_prefix.recentchanges ADD CONSTRAINT &mw_prefix.recentchanges_fk2 FOREIGN KEY (rc_cur_id) REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; CREATE INDEX &mw_prefix.recentchanges_i01 ON &mw_prefix.recentchanges (rc_timestamp); CREATE INDEX &mw_prefix.recentchanges_i02 ON &mw_prefix.recentchanges (rc_namespace, rc_title); CREATE INDEX &mw_prefix.recentchanges_i03 ON &mw_prefix.recentchanges (rc_cur_id); diff --git a/maintenance/postgres/archives/patch-uploadstash.sql b/maintenance/postgres/archives/patch-uploadstash.sql new file mode 100644 index 00000000..8fd9fb99 --- /dev/null +++ b/maintenance/postgres/archives/patch-uploadstash.sql @@ -0,0 +1,24 @@ +CREATE SEQUENCE uploadstash_us_id_seq; +CREATE TYPE media_type AS ENUM ('UNKNOWN','BITMAP','DRAWING','AUDIO','VIDEO','MULTIMEDIA','OFFICE','TEXT','EXECUTABLE','ARCHIVE'); + +CREATE TABLE uploadstash ( + us_id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('uploadstash_us_id_seq'), + us_user INTEGER, + us_key TEXT, + us_orig_path TEXT, + us_path TEXT, + us_source_type TEXT, + us_timestamp TIMESTAMPTZ, + us_status TEXT, + us_size INTEGER, + us_sha1 TEXT, + us_mime TEXT, + us_media_type media_type DEFAULT NULL, + us_image_width INTEGER, + us_image_height INTEGER, + us_image_bits INTEGER +); + +CREATE INDEX us_user_idx ON uploadstash (us_user); +CREATE UNIQUE INDEX us_key_idx ON uploadstash (us_key); +CREATE INDEX us_timestamp_idx ON uploadstash (us_timestamp); diff --git a/maintenance/postgres/archives/patch-uploadstash_sequence.sql b/maintenance/postgres/archives/patch-uploadstash_sequence.sql new file mode 100644 index 00000000..550b794e --- /dev/null +++ b/maintenance/postgres/archives/patch-uploadstash_sequence.sql @@ -0,0 +1,2 @@ +ALTER TABLE uploadstash RENAME us_id_seq TO uploadstash_us_id_seq; +ALTER TABLE uploadstash ALTER COLUMN us_id SET DEFAULT NEXTVAL('uploadstash_us_id_seq'); diff --git a/maintenance/postgres/tables.sql b/maintenance/postgres/tables.sql index ac0258ff..9f6b8049 100644 --- a/maintenance/postgres/tables.sql +++ b/maintenance/postgres/tables.sql @@ -358,6 +358,31 @@ CREATE INDEX fa_dupe ON filearchive (fa_storage_group, fa_storage_key); CREATE INDEX fa_notime ON filearchive (fa_deleted_timestamp); CREATE INDEX fa_nouser ON filearchive (fa_deleted_user); +CREATE SEQUENCE us_id_seq; +CREATE TYPE media_type AS ENUM ('UNKNOWN','BITMAP','DRAWING','AUDIO','VIDEO','MULTIMEDIA','OFFICE','TEXT','EXECUTABLE','ARCHIVE'); + +CREATE TABLE uploadstash ( + us_id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('us_id_seq'), + us_user INTEGER, + us_key TEXT, + us_orig_path TEXT, + us_path TEXT, + us_source_type TEXT, + us_timestamp TIMESTAMPTZ, + us_status TEXT, + us_size INTEGER, + us_sha1 TEXT, + us_mime TEXT, + us_media_type media_type DEFAULT NULL, + us_image_width INTEGER, + us_image_height INTEGER, + us_image_bits INTEGER +); + +CREATE INDEX us_user_idx ON uploadstash (us_user); +CREATE UNIQUE INDEX us_key_idx ON uploadstash (us_key); +CREATE INDEX us_timestamp_idx ON uploadstash (us_timestamp); + CREATE SEQUENCE recentchanges_rc_id_seq; CREATE TABLE recentchanges ( diff --git a/maintenance/update.php b/maintenance/update.php index e4a594f6..6173befd 100644 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -43,7 +43,7 @@ class UpdateMediaWiki extends Maintenance { $this->addOption( 'quick', 'Skip 5 second countdown before starting' ); $this->addOption( 'doshared', 'Also update shared tables' ); $this->addOption( 'nopurge', 'Do not purge the objectcache table after updates' ); - $this->addOption( 'force', 'Override when $wgMiserMode disables this script' ); + $this->addOption( 'force', 'Override when $wgAllowSchemaUpdates disables this script' ); } function getDbType() { @@ -76,9 +76,9 @@ class UpdateMediaWiki extends Maintenance { } function execute() { - global $wgVersion, $wgTitle, $wgLang, $wgMiserMode; + global $wgVersion, $wgTitle, $wgLang, $wgAllowSchemaUpdates; - if( $wgMiserMode && !$this->hasOption( 'force' ) ) { + if( !$wgAllowSchemaUpdates && !$this->hasOption( 'force' ) ) { $this->error( "Do not run update.php on this wiki. If you're seeing this you should\n" . "probably ask for some help in performing your schema updates.\n\n" . "If you know what you are doing, you can continue with --force", true ); |