]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - maintenance/httpSessionDownload.php
MediaWiki 1.17.0
[autoinstalls/mediawiki.git] / maintenance / httpSessionDownload.php
1 <?php
2 /*
3  * Simple entry point to initiate a background download
4  *
5  * arguments:
6  *  --sid {$session_id} --usk {$upload_session_key} --wiki {wfWikiId()}
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  * http://www.gnu.org/copyleft/gpl.html
22  *
23  * @ingroup Maintenance
24  */
25
26 require_once( dirname( __FILE__ ) . '/Maintenance.php' );
27
28 class HttpSessionDownload extends Maintenance {
29         public function __construct() {
30                 parent::__construct();
31                 $this->mDescription = "Simple entry point to initiate a background download";
32                 $this->addOption( 'sid',  'Session ID', true, true );
33                 $this->addOption( 'usk',  'Upload session key', true, true );
34         }
35
36         public function execute() {
37                 wfProfileIn( __METHOD__ );
38
39                 // run the download:
40                 Http::doSessionIdDownload( $this->getOption( 'sid' ), $this->getOption( 'usk' ) );
41
42                 // close up shop:
43                 // Execute any deferred updates
44                 wfDoUpdates();
45
46                 // Log what the user did, for book-keeping purposes.
47                 wfLogProfilingData();
48
49                 // Shut down the database before exit
50                 wfGetLBFactory()->shutdown();
51
52                 wfProfileOut( __METHOD__ );
53         }
54 }
55
56 $maintClass = "HttpSessionDownload";
57 require_once( RUN_MAINTENANCE_IF_MAIN );