- ## 1.10 updater
- if ($version <= 1010) {
- $upgrade = <<<PGEND
-
--- Fix the archive rule ar_timestamp field
-CREATE OR REPLACE RULE archive_insert AS ON INSERT TO archive
-DO INSTEAD INSERT INTO archive2 VALUES (
- NEW.ar_namespace, NEW.ar_title, NEW.ar_text, NEW.ar_comment, NEW.ar_user, NEW.ar_user_text,
- TO_TIMESTAMP(NEW.ar_timestamp, 'YYYYMMDDHH24MISS'),
- NEW.ar_minor_edit, NEW.ar_flags, NEW.ar_rev_id, NEW.ar_text_id
-);
-
--- Note this upgrade
-INSERT INTO mediawiki_version (type,mw_version,notes)
-VALUES ('Upgrade','MWVERSION','Upgrade from older pre 1.10 version THISVERSION aka SVERSION');
-
-
-PGEND;
- } ## end version 1.10
-
- if ( !strlen($upgrade)) {
- print "No updates needed for this version ($oldversion)\n";
- return;
- }
-
- $upgrade = str_replace( 'MWVERSION', $wgVersion, $upgrade );
- $upgrade = str_replace( 'THISVERSION', $oldversion, $upgrade );
- $upgrade = str_replace( 'SVERSION', $version, $upgrade );
- $wgDatabase->query("BEGIN;\n\n $upgrade\n\nCOMMIT;\n");
+ $ai_def = pg_rule_def("archive", "archive_insert");
+ if (strstr($ai_def, "to_date") !== false) {
+ echo "... fix archive_insert rule\n";
+ dbsource(archive('patch-archive_insert.sql'));
+ } else
+ echo "... already have correct archive_insert rule\n";