]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - maintenance/patchSql.php
MediaWiki 1.14.0
[autoinstallsdev/mediawiki.git] / maintenance / patchSql.php
1 <?php
2 /**
3  * Manually run an SQL patch outside of the general updaters.
4  * This ensures that the DB options (charset, prefix, engine) are correctly set.
5  *
6  * @file
7  * @ingroup Maintenance
8  */
9
10 require_once 'commandLine.inc';
11 require_once "$IP/maintenance/updaters.inc";
12
13 if( $args ) {
14         foreach( $args as $arg ) {
15                 $files = array(
16                         $arg,
17                         archive( $arg ),
18                         archive( "patch-$arg.sql" ),
19                 );
20                 foreach( $files as $file ) {
21                         if( file_exists( $file ) ) {
22                                 echo "$file ...\n";
23                                 dbsource( $file );
24                                 continue 2;
25                         }
26                 }
27                 echo "Could not find $arg\n";
28         }
29         echo "done.\n";
30 } else {
31         echo "Run an SQL file into the DB, replacing prefix and charset vars.\n";
32         echo "Usage:\n";
33         echo "  php maintenance/patchSql.php file1.sql file2.sql ...\n";
34         echo "\n";
35         echo "Paths in maintenance/archive are automatically expanded if a local file isn't found.\n";
36 }