r60999 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60998‎ | r60999 | r61000 >
Date:04:58, 13 January 2010
Author:mah
Status:deferred (Comments)
Tags:
Comment:
add in session download script
Modified paths:
  • /trunk/phase3/maintenance/httpSessionDownload.php (added) (history)

Diff [purge]

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

Follow-up revisions

RevisionCommit summaryAuthorDate
r61036follow up r60999 - remove reference to $wgUseNormalUsermah00:57, 14 January 2010

Comments

#Comment by 😂 (talk | contribs)   18:28, 13 January 2010

Is there a compelling reason this script sets $wgUseNormalUser explicitly to true? getDbType() should already be returning Maintenance::DB_STD for normal DB access.

#Comment by MarkAHershberger (talk | contribs)   23:50, 13 January 2010

Only my ignorance and the fact that I was copying this from someone else.

Status & tagging log