here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
<?php
|
2010-02-26 13:18:56 +00:00
|
|
|
/**
|
2010-12-22 20:52:06 +00:00
|
|
|
*
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
*
|
2010-08-07 19:59:42 +00:00
|
|
|
* Created on Aug 21, 2008
|
|
|
|
|
*
|
2010-02-26 13:18:56 +00:00
|
|
|
* Copyright © 2008 - 2010 Bryan Tong Minh <Bryan.TongMinh@Gmail.com>
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
2010-06-21 13:13:32 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
2010-08-07 19:59:42 +00:00
|
|
|
*
|
|
|
|
|
* @file
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup API
|
|
|
|
|
*/
|
|
|
|
|
class ApiUpload extends ApiBase {
|
2011-02-19 00:30:18 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var UploadBase
|
|
|
|
|
*/
|
2009-08-26 19:38:38 +00:00
|
|
|
protected $mUpload = null;
|
2011-02-19 00:30:18 +00:00
|
|
|
|
2009-08-26 19:38:38 +00:00
|
|
|
protected $mParams;
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
|
|
|
|
|
public function execute() {
|
2013-02-13 21:25:37 +00:00
|
|
|
global $wgEnableAsyncUploads;
|
|
|
|
|
|
2010-02-10 10:36:11 +00:00
|
|
|
// Check whether upload is enabled
|
2010-02-26 13:18:56 +00:00
|
|
|
if ( !UploadBase::isEnabled() ) {
|
2011-05-19 17:51:16 +00:00
|
|
|
$this->dieUsageMsg( 'uploaddisabled' );
|
2010-02-26 13:18:56 +00:00
|
|
|
}
|
2010-02-10 10:36:11 +00:00
|
|
|
|
2011-10-26 23:27:01 +00:00
|
|
|
$user = $this->getUser();
|
|
|
|
|
|
2010-07-28 17:31:32 +00:00
|
|
|
// Parameter handling
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
$this->mParams = $this->extractRequestParams();
|
|
|
|
|
$request = $this->getMain()->getRequest();
|
2013-02-13 21:25:37 +00:00
|
|
|
// Check if async mode is actually supported (jobs done in cli mode)
|
|
|
|
|
$this->mParams['async'] = ( $this->mParams['async'] && $wgEnableAsyncUploads );
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
// Add the uploaded file to the params array
|
|
|
|
|
$this->mParams['file'] = $request->getFileName( 'file' );
|
2011-08-02 10:13:56 +00:00
|
|
|
$this->mParams['chunk'] = $request->getFileName( 'chunk' );
|
2011-07-17 16:38:24 +00:00
|
|
|
|
2011-07-12 21:11:43 +00:00
|
|
|
// Copy the session key to the file key, for backward compatibility.
|
|
|
|
|
if( !$this->mParams['filekey'] && $this->mParams['sessionkey'] ) {
|
|
|
|
|
$this->mParams['filekey'] = $this->mParams['sessionkey'];
|
|
|
|
|
}
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
|
2010-07-28 17:31:32 +00:00
|
|
|
// Select an upload module
|
2010-09-06 10:18:53 +00:00
|
|
|
if ( !$this->selectUploadModule() ) {
|
2012-12-04 02:18:48 +00:00
|
|
|
return; // not a true upload, but a status request or similar
|
|
|
|
|
} elseif ( !isset( $this->mUpload ) ) {
|
2010-07-28 17:31:32 +00:00
|
|
|
$this->dieUsage( 'No upload module set', 'nomodule' );
|
|
|
|
|
}
|
2010-08-05 07:02:09 +00:00
|
|
|
|
2010-07-28 17:31:32 +00:00
|
|
|
// First check permission to upload
|
2011-10-26 23:27:01 +00:00
|
|
|
$this->checkPermissions( $user );
|
2010-08-05 07:02:09 +00:00
|
|
|
|
2012-12-04 02:18:48 +00:00
|
|
|
// Fetch the file (usually a no-op)
|
2013-03-11 03:45:51 +00:00
|
|
|
/** @var $status Status */
|
2010-07-28 17:31:32 +00:00
|
|
|
$status = $this->mUpload->fetchFile();
|
|
|
|
|
if ( !$status->isGood() ) {
|
|
|
|
|
$errors = $status->getErrorsArray();
|
|
|
|
|
$error = array_shift( $errors[0] );
|
|
|
|
|
$this->dieUsage( 'Error fetching file from remote source', $error, 0, $errors[0] );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if the uploaded file is sane
|
2011-08-02 10:13:56 +00:00
|
|
|
if ( $this->mParams['chunk'] ) {
|
2013-03-17 15:13:22 +00:00
|
|
|
$maxSize = $this->mUpload->getMaxUploadSize();
|
2011-08-02 10:13:56 +00:00
|
|
|
if( $this->mParams['filesize'] > $maxSize ) {
|
|
|
|
|
$this->dieUsage( 'The file you submitted was too large', 'file-too-large' );
|
|
|
|
|
}
|
2012-10-10 23:15:29 +00:00
|
|
|
if ( !$this->mUpload->getTitle() ) {
|
|
|
|
|
$this->dieUsage( 'Invalid file title supplied', 'internal-error' );
|
|
|
|
|
}
|
2012-12-04 02:18:48 +00:00
|
|
|
} elseif ( $this->mParams['async'] ) {
|
|
|
|
|
// defer verification to background process
|
2011-08-02 11:01:01 +00:00
|
|
|
} else {
|
2011-08-02 10:13:56 +00:00
|
|
|
$this->verifyUpload();
|
2011-08-02 11:01:01 +00:00
|
|
|
}
|
2012-10-10 23:15:29 +00:00
|
|
|
|
2011-03-25 20:42:05 +00:00
|
|
|
// Check if the user has the rights to modify or overwrite the requested title
|
|
|
|
|
// (This check is irrelevant if stashing is already requested, since the errors
|
|
|
|
|
// can always be fixed by changing the title)
|
2012-12-04 02:18:48 +00:00
|
|
|
if ( !$this->mParams['stash'] ) {
|
2011-10-26 23:27:01 +00:00
|
|
|
$permErrors = $this->mUpload->verifyTitlePermissions( $user );
|
2011-03-25 20:42:05 +00:00
|
|
|
if ( $permErrors !== true ) {
|
2011-03-25 21:22:02 +00:00
|
|
|
$this->dieRecoverableError( $permErrors[0], 'filename' );
|
2011-03-25 20:42:05 +00:00
|
|
|
}
|
2010-07-29 13:53:51 +00:00
|
|
|
}
|
2012-12-04 02:18:48 +00:00
|
|
|
|
2012-10-10 23:15:29 +00:00
|
|
|
// Get the result based on the current upload context:
|
2011-11-30 14:56:40 +00:00
|
|
|
$result = $this->getContextResult();
|
|
|
|
|
if ( $result['result'] === 'Success' ) {
|
|
|
|
|
$result['imageinfo'] = $this->mUpload->getImageInfo( $this->getResult() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->getResult()->addValue( null, $this->getModuleName(), $result );
|
2010-12-30 17:06:09 +00:00
|
|
|
|
2011-11-30 14:56:40 +00:00
|
|
|
// Cleanup any temporary mess
|
|
|
|
|
$this->mUpload->cleanupTempFile();
|
|
|
|
|
}
|
2012-11-19 08:07:50 +00:00
|
|
|
|
2011-11-30 14:56:40 +00:00
|
|
|
/**
|
2013-03-11 03:45:51 +00:00
|
|
|
* Get an upload result based on upload context
|
2012-02-09 21:33:27 +00:00
|
|
|
* @return array
|
2011-11-30 14:56:40 +00:00
|
|
|
*/
|
2013-01-26 21:11:09 +00:00
|
|
|
private function getContextResult() {
|
2010-11-03 04:32:41 +00:00
|
|
|
$warnings = $this->getApiWarnings();
|
2012-05-26 00:05:04 +00:00
|
|
|
if ( $warnings && !$this->mParams['ignorewarnings'] ) {
|
2013-03-11 03:45:51 +00:00
|
|
|
// Get warnings formatted in result array format
|
2011-11-30 14:56:40 +00:00
|
|
|
return $this->getWarningsResult( $warnings );
|
2011-11-30 13:54:35 +00:00
|
|
|
} elseif ( $this->mParams['chunk'] ) {
|
2011-11-30 14:56:40 +00:00
|
|
|
// Add chunk, and get result
|
2012-05-26 00:05:04 +00:00
|
|
|
return $this->getChunkResult( $warnings );
|
2011-11-30 14:56:40 +00:00
|
|
|
} elseif ( $this->mParams['stash'] ) {
|
|
|
|
|
// Stash the file and get stash result
|
2012-05-26 00:05:04 +00:00
|
|
|
return $this->getStashResult( $warnings );
|
2011-11-30 14:56:40 +00:00
|
|
|
}
|
|
|
|
|
// This is the most common case -- a normal upload with no warnings
|
|
|
|
|
// performUpload will return a formatted properly for the API with status
|
2012-05-26 00:05:04 +00:00
|
|
|
return $this->performUpload( $warnings );
|
2011-11-30 14:56:40 +00:00
|
|
|
}
|
2012-12-04 02:18:48 +00:00
|
|
|
|
2011-11-30 14:56:40 +00:00
|
|
|
/**
|
2013-03-11 03:45:51 +00:00
|
|
|
* Get Stash Result, throws an exception if the file could not be stashed.
|
2013-03-11 17:15:01 +00:00
|
|
|
* @param array $warnings Array of Api upload warnings
|
2012-02-09 21:33:27 +00:00
|
|
|
* @return array
|
2011-11-30 14:56:40 +00:00
|
|
|
*/
|
2013-01-26 21:11:09 +00:00
|
|
|
private function getStashResult( $warnings ) {
|
2011-11-30 14:56:40 +00:00
|
|
|
$result = array ();
|
|
|
|
|
// Some uploads can request they be stashed, so as not to publish them immediately.
|
|
|
|
|
// In this case, a failure to stash ought to be fatal
|
|
|
|
|
try {
|
|
|
|
|
$result['result'] = 'Success';
|
|
|
|
|
$result['filekey'] = $this->performStash();
|
|
|
|
|
$result['sessionkey'] = $result['filekey']; // backwards compatibility
|
2012-05-26 00:05:04 +00:00
|
|
|
if ( $warnings && count( $warnings ) > 0 ) {
|
|
|
|
|
$result['warnings'] = $warnings;
|
|
|
|
|
}
|
2011-11-30 14:56:40 +00:00
|
|
|
} catch ( MWException $e ) {
|
|
|
|
|
$this->dieUsage( $e->getMessage(), 'stashfailed' );
|
|
|
|
|
}
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
2012-12-04 02:18:48 +00:00
|
|
|
|
2011-11-30 14:56:40 +00:00
|
|
|
/**
|
|
|
|
|
* Get Warnings Result
|
2013-03-11 17:15:01 +00:00
|
|
|
* @param array $warnings Array of Api upload warnings
|
2012-02-09 21:33:27 +00:00
|
|
|
* @return array
|
2011-11-30 14:56:40 +00:00
|
|
|
*/
|
2013-01-26 21:11:09 +00:00
|
|
|
private function getWarningsResult( $warnings ) {
|
2011-11-30 14:56:40 +00:00
|
|
|
$result = array();
|
|
|
|
|
$result['result'] = 'Warning';
|
|
|
|
|
$result['warnings'] = $warnings;
|
|
|
|
|
// in case the warnings can be fixed with some further user action, let's stash this upload
|
|
|
|
|
// and return a key they can use to restart it
|
|
|
|
|
try {
|
|
|
|
|
$result['filekey'] = $this->performStash();
|
|
|
|
|
$result['sessionkey'] = $result['filekey']; // backwards compatibility
|
|
|
|
|
} catch ( MWException $e ) {
|
|
|
|
|
$result['warnings']['stashfailed'] = $e->getMessage();
|
|
|
|
|
}
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
2012-12-04 02:18:48 +00:00
|
|
|
|
2011-11-30 14:56:40 +00:00
|
|
|
/**
|
2012-02-09 21:33:27 +00:00
|
|
|
* Get the result of a chunk upload.
|
2013-03-11 17:15:01 +00:00
|
|
|
* @param array $warnings Array of Api upload warnings
|
2012-02-09 21:33:27 +00:00
|
|
|
* @return array
|
2011-11-30 14:56:40 +00:00
|
|
|
*/
|
2012-11-19 08:07:50 +00:00
|
|
|
private function getChunkResult( $warnings ) {
|
2011-11-30 14:56:40 +00:00
|
|
|
$result = array();
|
2012-04-27 15:40:14 +00:00
|
|
|
|
2011-11-30 14:56:40 +00:00
|
|
|
$result['result'] = 'Continue';
|
2012-05-26 00:05:04 +00:00
|
|
|
if ( $warnings && count( $warnings ) > 0 ) {
|
|
|
|
|
$result['warnings'] = $warnings;
|
|
|
|
|
}
|
2011-11-30 14:56:40 +00:00
|
|
|
$request = $this->getMain()->getRequest();
|
|
|
|
|
$chunkPath = $request->getFileTempname( 'chunk' );
|
|
|
|
|
$chunkSize = $request->getUpload( 'chunk' )->getSize();
|
2013-02-03 18:47:42 +00:00
|
|
|
if ( $this->mParams['offset'] == 0 ) {
|
2013-02-26 23:19:52 +00:00
|
|
|
$filekey = $this->performStash();
|
2011-11-30 14:56:40 +00:00
|
|
|
} else {
|
2013-02-26 23:19:52 +00:00
|
|
|
$filekey = $this->mParams['filekey'];
|
2013-03-11 03:45:51 +00:00
|
|
|
/** @var $status Status */
|
2012-11-19 08:07:50 +00:00
|
|
|
$status = $this->mUpload->addChunk(
|
|
|
|
|
$chunkPath, $chunkSize, $this->mParams['offset'] );
|
2011-11-30 14:56:40 +00:00
|
|
|
if ( !$status->isGood() ) {
|
|
|
|
|
$this->dieUsage( $status->getWikiText(), 'stashfailed' );
|
2012-04-27 15:40:14 +00:00
|
|
|
return array();
|
2011-11-30 14:56:40 +00:00
|
|
|
}
|
2013-02-26 23:19:52 +00:00
|
|
|
}
|
2012-04-08 11:27:32 +00:00
|
|
|
|
2013-02-26 23:19:52 +00:00
|
|
|
// Check we added the last chunk:
|
|
|
|
|
if ( $this->mParams['offset'] + $chunkSize == $this->mParams['filesize'] ) {
|
|
|
|
|
if ( $this->mParams['async'] ) {
|
|
|
|
|
$progress = UploadBase::getSessionStatus( $this->mParams['filekey'] );
|
|
|
|
|
if ( $progress && $progress['result'] === 'Poll' ) {
|
|
|
|
|
$this->dieUsage( "Chunk assembly already in progress.", 'stashfailed' );
|
|
|
|
|
}
|
|
|
|
|
UploadBase::setSessionStatus(
|
|
|
|
|
$this->mParams['filekey'],
|
|
|
|
|
array( 'result' => 'Poll',
|
|
|
|
|
'stage' => 'queued', 'status' => Status::newGood() )
|
|
|
|
|
);
|
|
|
|
|
$ok = JobQueueGroup::singleton()->push( new AssembleUploadChunksJob(
|
|
|
|
|
Title::makeTitle( NS_FILE, $this->mParams['filekey'] ),
|
|
|
|
|
array(
|
|
|
|
|
'filename' => $this->mParams['filename'],
|
|
|
|
|
'filekey' => $this->mParams['filekey'],
|
2013-03-14 22:43:42 +00:00
|
|
|
'session' => $this->getContext()->exportSession()
|
2013-02-26 23:19:52 +00:00
|
|
|
)
|
|
|
|
|
) );
|
|
|
|
|
if ( $ok ) {
|
|
|
|
|
$result['result'] = 'Poll';
|
2012-11-19 08:07:50 +00:00
|
|
|
} else {
|
2013-02-26 23:19:52 +00:00
|
|
|
UploadBase::setSessionStatus( $this->mParams['filekey'], false );
|
|
|
|
|
$this->dieUsage(
|
|
|
|
|
"Failed to start AssembleUploadChunks.php", 'stashfailed' );
|
2012-11-19 08:07:50 +00:00
|
|
|
}
|
2012-04-08 11:27:32 +00:00
|
|
|
} else {
|
2013-02-26 23:19:52 +00:00
|
|
|
$status = $this->mUpload->concatenateChunks();
|
|
|
|
|
if ( !$status->isGood() ) {
|
|
|
|
|
$this->dieUsage( $status->getWikiText(), 'stashfailed' );
|
|
|
|
|
return array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The fully concatenated file has a new filekey. So remove
|
|
|
|
|
// the old filekey and fetch the new one.
|
|
|
|
|
$this->mUpload->stash->removeFile( $filekey );
|
|
|
|
|
$filekey = $this->mUpload->getLocalFile()->getFileKey();
|
|
|
|
|
|
|
|
|
|
$result['result'] = 'Success';
|
2010-11-03 04:32:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
2013-02-26 23:19:52 +00:00
|
|
|
$result['filekey'] = $filekey;
|
2011-11-30 14:56:40 +00:00
|
|
|
$result['offset'] = $this->mParams['offset'] + $chunkSize;
|
|
|
|
|
return $result;
|
2010-07-28 17:31:32 +00:00
|
|
|
}
|
2012-10-10 23:15:29 +00:00
|
|
|
|
2010-11-03 04:32:41 +00:00
|
|
|
/**
|
2011-07-12 21:11:43 +00:00
|
|
|
* Stash the file and return the file key
|
2010-11-03 04:32:41 +00:00
|
|
|
* Also re-raises exceptions with slightly more informative message strings (useful for API)
|
|
|
|
|
* @throws MWException
|
2011-07-12 21:11:43 +00:00
|
|
|
* @return String file key
|
2010-11-03 04:32:41 +00:00
|
|
|
*/
|
2012-12-04 02:18:48 +00:00
|
|
|
private function performStash() {
|
2010-11-03 04:32:41 +00:00
|
|
|
try {
|
2011-10-05 13:47:02 +00:00
|
|
|
$stashFile = $this->mUpload->stashFile();
|
|
|
|
|
|
|
|
|
|
if ( !$stashFile ) {
|
|
|
|
|
throw new MWException( 'Invalid stashed file' );
|
|
|
|
|
}
|
|
|
|
|
$fileKey = $stashFile->getFileKey();
|
2010-11-03 04:32:41 +00:00
|
|
|
} catch ( MWException $e ) {
|
2011-07-12 21:11:43 +00:00
|
|
|
$message = 'Stashing temporary file failed: ' . get_class( $e ) . ' ' . $e->getMessage();
|
2013-02-09 22:03:53 +00:00
|
|
|
wfDebug( __METHOD__ . ' ' . $message . "\n" );
|
2011-07-12 21:11:43 +00:00
|
|
|
throw new MWException( $message );
|
2010-11-03 04:32:41 +00:00
|
|
|
}
|
2011-07-12 21:11:43 +00:00
|
|
|
return $fileKey;
|
2010-11-03 04:32:41 +00:00
|
|
|
}
|
2011-06-29 23:46:39 +00:00
|
|
|
|
2011-03-25 21:22:02 +00:00
|
|
|
/**
|
2011-06-29 23:46:39 +00:00
|
|
|
* Throw an error that the user can recover from by providing a better
|
2011-03-25 21:22:02 +00:00
|
|
|
* value for $parameter
|
2011-06-29 23:46:39 +00:00
|
|
|
*
|
2013-03-11 17:15:01 +00:00
|
|
|
* @param array $error Error array suitable for passing to dieUsageMsg()
|
|
|
|
|
* @param string $parameter Parameter that needs revising
|
|
|
|
|
* @param array $data Optional extra data to pass to the user
|
2011-03-25 21:22:02 +00:00
|
|
|
* @throws UsageException
|
|
|
|
|
*/
|
2012-12-04 02:18:48 +00:00
|
|
|
private function dieRecoverableError( $error, $parameter, $data = array() ) {
|
2011-03-25 21:22:02 +00:00
|
|
|
try {
|
2011-07-12 21:11:43 +00:00
|
|
|
$data['filekey'] = $this->performStash();
|
|
|
|
|
$data['sessionkey'] = $data['filekey'];
|
2011-03-25 21:22:02 +00:00
|
|
|
} catch ( MWException $e ) {
|
|
|
|
|
$data['stashfailed'] = $e->getMessage();
|
|
|
|
|
}
|
|
|
|
|
$data['invalidparameter'] = $parameter;
|
2011-06-29 23:46:39 +00:00
|
|
|
|
2011-03-25 21:22:02 +00:00
|
|
|
$parsed = $this->parseMsg( $error );
|
|
|
|
|
$this->dieUsage( $parsed['info'], $parsed['code'], 0, $data );
|
|
|
|
|
}
|
2010-11-03 04:32:41 +00:00
|
|
|
|
2010-07-28 17:31:32 +00:00
|
|
|
/**
|
2010-09-06 10:18:53 +00:00
|
|
|
* Select an upload module and set it to mUpload. Dies on failure. If the
|
2010-12-30 17:06:09 +00:00
|
|
|
* request was a status request and not a true upload, returns false;
|
2010-09-06 10:18:53 +00:00
|
|
|
* otherwise true
|
2010-12-30 17:06:09 +00:00
|
|
|
*
|
2010-09-06 10:18:53 +00:00
|
|
|
* @return bool
|
2010-07-28 17:31:32 +00:00
|
|
|
*/
|
|
|
|
|
protected function selectUploadModule() {
|
|
|
|
|
$request = $this->getMain()->getRequest();
|
2010-08-05 07:02:09 +00:00
|
|
|
|
2011-08-02 10:13:56 +00:00
|
|
|
// chunk or one and only one of the following parameters is needed
|
2012-11-19 08:07:50 +00:00
|
|
|
if ( !$this->mParams['chunk'] ) {
|
2011-08-02 10:13:56 +00:00
|
|
|
$this->requireOnlyOneParameter( $this->mParams,
|
2011-11-10 20:50:21 +00:00
|
|
|
'filekey', 'file', 'url', 'statuskey' );
|
|
|
|
|
}
|
2010-07-27 21:53:52 +00:00
|
|
|
|
2012-12-04 02:18:48 +00:00
|
|
|
// Status report for "upload to stash"/"upload from stash"
|
2012-11-19 08:07:50 +00:00
|
|
|
if ( $this->mParams['filekey'] && $this->mParams['checkstatus'] ) {
|
|
|
|
|
$progress = UploadBase::getSessionStatus( $this->mParams['filekey'] );
|
|
|
|
|
if ( !$progress ) {
|
|
|
|
|
$this->dieUsage( 'No result in status data', 'missingresult' );
|
|
|
|
|
} elseif ( !$progress['status']->isGood() ) {
|
|
|
|
|
$this->dieUsage( $progress['status']->getWikiText(), 'stashfailed' );
|
|
|
|
|
}
|
2012-12-04 02:18:48 +00:00
|
|
|
if ( isset( $progress['status']->value['verification'] ) ) {
|
|
|
|
|
$this->checkVerification( $progress['status']->value['verification'] );
|
|
|
|
|
}
|
2012-11-19 08:07:50 +00:00
|
|
|
unset( $progress['status'] ); // remove Status object
|
|
|
|
|
$this->getResult()->addValue( null, $this->getModuleName(), $progress );
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-10 18:24:19 +00:00
|
|
|
if ( $this->mParams['statuskey'] ) {
|
|
|
|
|
$this->checkAsyncDownloadEnabled();
|
2011-06-29 23:46:39 +00:00
|
|
|
|
2010-09-06 10:18:53 +00:00
|
|
|
// Status request for an async upload
|
|
|
|
|
$sessionData = UploadFromUrlJob::getSessionData( $this->mParams['statuskey'] );
|
|
|
|
|
if ( !isset( $sessionData['result'] ) ) {
|
2010-12-30 17:06:09 +00:00
|
|
|
$this->dieUsage( 'No result in session data', 'missingresult' );
|
2010-09-06 10:18:53 +00:00
|
|
|
}
|
|
|
|
|
if ( $sessionData['result'] == 'Warning' ) {
|
|
|
|
|
$sessionData['warnings'] = $this->transformWarnings( $sessionData['warnings'] );
|
|
|
|
|
$sessionData['sessionkey'] = $this->mParams['statuskey'];
|
|
|
|
|
}
|
|
|
|
|
$this->getResult()->addValue( null, $this->getModuleName(), $sessionData );
|
|
|
|
|
return false;
|
2010-12-30 17:06:09 +00:00
|
|
|
}
|
2010-11-03 04:32:41 +00:00
|
|
|
|
2010-09-06 10:18:53 +00:00
|
|
|
// The following modules all require the filename parameter to be set
|
|
|
|
|
if ( is_null( $this->mParams['filename'] ) ) {
|
|
|
|
|
$this->dieUsageMsg( array( 'missingparam', 'filename' ) );
|
|
|
|
|
}
|
2010-12-30 17:06:09 +00:00
|
|
|
|
2011-11-30 14:56:40 +00:00
|
|
|
if ( $this->mParams['chunk'] ) {
|
|
|
|
|
// Chunk upload
|
|
|
|
|
$this->mUpload = new UploadFromChunks();
|
2013-01-26 21:11:09 +00:00
|
|
|
if( isset( $this->mParams['filekey'] ) ) {
|
2011-11-30 14:56:40 +00:00
|
|
|
// handle new chunk
|
|
|
|
|
$this->mUpload->continueChunks(
|
|
|
|
|
$this->mParams['filename'],
|
|
|
|
|
$this->mParams['filekey'],
|
|
|
|
|
$request->getUpload( 'chunk' )
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
// handle first chunk
|
|
|
|
|
$this->mUpload->initialize(
|
|
|
|
|
$this->mParams['filename'],
|
|
|
|
|
$request->getUpload( 'chunk' )
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} elseif ( isset( $this->mParams['filekey'] ) ) {
|
2010-07-27 21:53:52 +00:00
|
|
|
// Upload stashed in a previous request
|
2011-07-12 21:11:43 +00:00
|
|
|
if ( !UploadFromStash::isValidKey( $this->mParams['filekey'] ) ) {
|
|
|
|
|
$this->dieUsageMsg( 'invalid-file-key' );
|
2010-02-26 13:18:56 +00:00
|
|
|
}
|
2010-01-22 04:37:23 +00:00
|
|
|
|
2011-10-26 23:27:01 +00:00
|
|
|
$this->mUpload = new UploadFromStash( $this->getUser() );
|
2012-12-04 02:18:48 +00:00
|
|
|
// This will not download the temp file in initialize() in async mode.
|
|
|
|
|
// We still have enough information to call checkWarnings() and such.
|
|
|
|
|
$this->mUpload->initialize(
|
|
|
|
|
$this->mParams['filekey'], $this->mParams['filename'], !$this->mParams['async']
|
|
|
|
|
);
|
2010-07-27 21:53:52 +00:00
|
|
|
} elseif ( isset( $this->mParams['file'] ) ) {
|
|
|
|
|
$this->mUpload = new UploadFromFile();
|
|
|
|
|
$this->mUpload->initialize(
|
|
|
|
|
$this->mParams['filename'],
|
|
|
|
|
$request->getUpload( 'file' )
|
2010-08-05 07:02:09 +00:00
|
|
|
);
|
2010-07-27 21:53:52 +00:00
|
|
|
} elseif ( isset( $this->mParams['url'] ) ) {
|
|
|
|
|
// Make sure upload by URL is enabled:
|
2010-07-28 17:14:51 +00:00
|
|
|
if ( !UploadFromUrl::isEnabled() ) {
|
2011-05-19 17:51:16 +00:00
|
|
|
$this->dieUsageMsg( 'copyuploaddisabled' );
|
2010-07-27 21:53:52 +00:00
|
|
|
}
|
2010-08-05 07:02:09 +00:00
|
|
|
|
2012-02-09 23:22:38 +00:00
|
|
|
if ( !UploadFromUrl::isAllowedHost( $this->mParams['url'] ) ) {
|
|
|
|
|
$this->dieUsageMsg( 'copyuploadbaddomain' );
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-28 17:14:51 +00:00
|
|
|
$async = false;
|
|
|
|
|
if ( $this->mParams['asyncdownload'] ) {
|
2011-02-10 18:24:19 +00:00
|
|
|
$this->checkAsyncDownloadEnabled();
|
2011-06-29 23:46:39 +00:00
|
|
|
|
2010-09-06 10:18:53 +00:00
|
|
|
if ( $this->mParams['leavemessage'] && !$this->mParams['ignorewarnings'] ) {
|
|
|
|
|
$this->dieUsage( 'Using leavemessage without ignorewarnings is not supported',
|
|
|
|
|
'missing-ignorewarnings' );
|
|
|
|
|
}
|
2010-12-30 17:06:09 +00:00
|
|
|
|
2010-07-28 17:14:51 +00:00
|
|
|
if ( $this->mParams['leavemessage'] ) {
|
|
|
|
|
$async = 'async-leavemessage';
|
|
|
|
|
} else {
|
|
|
|
|
$async = 'async';
|
|
|
|
|
}
|
2010-07-27 21:53:52 +00:00
|
|
|
}
|
2010-07-28 17:14:51 +00:00
|
|
|
$this->mUpload = new UploadFromUrl;
|
|
|
|
|
$this->mUpload->initialize( $this->mParams['filename'],
|
|
|
|
|
$this->mParams['url'], $async );
|
2010-02-26 13:18:56 +00:00
|
|
|
}
|
2010-12-30 17:06:09 +00:00
|
|
|
|
2010-09-06 10:18:53 +00:00
|
|
|
return true;
|
2010-06-12 03:58:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks that the user has permissions to perform this upload.
|
|
|
|
|
* Dies with usage message on inadequate permissions.
|
|
|
|
|
* @param $user User The user to check.
|
|
|
|
|
*/
|
|
|
|
|
protected function checkPermissions( $user ) {
|
2009-07-15 00:55:58 +00:00
|
|
|
// Check whether the user has the appropriate permissions to upload anyway
|
2010-06-12 03:58:31 +00:00
|
|
|
$permission = $this->mUpload->isAllowed( $user );
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
if ( $permission !== true ) {
|
2010-06-12 03:58:31 +00:00
|
|
|
if ( !$user->isLoggedIn() ) {
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
$this->dieUsageMsg( array( 'mustbeloggedin', 'upload' ) );
|
2010-02-26 13:18:56 +00:00
|
|
|
} else {
|
2011-05-19 17:51:16 +00:00
|
|
|
$this->dieUsageMsg( 'badaccess-groups' );
|
2010-02-26 13:18:56 +00:00
|
|
|
}
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
}
|
|
|
|
|
}
|
2009-07-15 00:55:58 +00:00
|
|
|
|
2010-03-30 19:10:10 +00:00
|
|
|
/**
|
|
|
|
|
* Performs file verification, dies on error.
|
|
|
|
|
*/
|
2013-03-17 15:13:22 +00:00
|
|
|
protected function verifyUpload() {
|
|
|
|
|
$verification = $this->mUpload->verifyUpload();
|
2010-03-30 19:10:10 +00:00
|
|
|
if ( $verification['status'] === UploadBase::OK ) {
|
2010-08-05 07:02:09 +00:00
|
|
|
return;
|
2012-12-04 02:18:48 +00:00
|
|
|
} else {
|
|
|
|
|
return $this->checkVerification( $verification );
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
}
|
2012-12-04 02:18:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Performs file verification, dies on error.
|
|
|
|
|
*/
|
|
|
|
|
protected function checkVerification( array $verification ) {
|
|
|
|
|
global $wgFileExtensions;
|
2009-10-15 00:14:05 +00:00
|
|
|
|
2009-08-26 19:38:38 +00:00
|
|
|
// TODO: Move them to ApiBase's message map
|
2010-03-30 19:10:10 +00:00
|
|
|
switch( $verification['status'] ) {
|
2011-03-25 21:22:02 +00:00
|
|
|
// Recoverable errors
|
|
|
|
|
case UploadBase::MIN_LENGTH_PARTNAME:
|
|
|
|
|
$this->dieRecoverableError( 'filename-tooshort', 'filename' );
|
2011-06-29 23:46:39 +00:00
|
|
|
break;
|
2011-03-25 21:22:02 +00:00
|
|
|
case UploadBase::ILLEGAL_FILENAME:
|
|
|
|
|
$this->dieRecoverableError( 'illegal-filename', 'filename',
|
|
|
|
|
array( 'filename' => $verification['filtered'] ) );
|
|
|
|
|
break;
|
2011-10-07 18:20:55 +00:00
|
|
|
case UploadBase::FILENAME_TOO_LONG:
|
|
|
|
|
$this->dieRecoverableError( 'filename-toolong', 'filename' );
|
|
|
|
|
break;
|
2011-03-25 21:22:02 +00:00
|
|
|
case UploadBase::FILETYPE_MISSING:
|
|
|
|
|
$this->dieRecoverableError( 'filetype-missing', 'filename' );
|
|
|
|
|
break;
|
2011-05-15 12:35:50 +00:00
|
|
|
case UploadBase::WINDOWS_NONASCII_FILENAME:
|
|
|
|
|
$this->dieRecoverableError( 'windows-nonascii-filename', 'filename' );
|
|
|
|
|
break;
|
2011-06-29 23:46:39 +00:00
|
|
|
|
2011-03-25 21:22:02 +00:00
|
|
|
// Unrecoverable errors
|
2010-03-30 19:10:10 +00:00
|
|
|
case UploadBase::EMPTY_FILE:
|
|
|
|
|
$this->dieUsage( 'The file you submitted was empty', 'empty-file' );
|
|
|
|
|
break;
|
2010-04-15 09:28:33 +00:00
|
|
|
case UploadBase::FILE_TOO_LARGE:
|
|
|
|
|
$this->dieUsage( 'The file you submitted was too large', 'file-too-large' );
|
|
|
|
|
break;
|
2011-03-25 21:22:02 +00:00
|
|
|
|
2010-03-30 19:10:10 +00:00
|
|
|
case UploadBase::FILETYPE_BADTYPE:
|
2012-07-19 16:54:05 +00:00
|
|
|
$extradata = array(
|
|
|
|
|
'filetype' => $verification['finalExt'],
|
|
|
|
|
'allowed' => $wgFileExtensions
|
|
|
|
|
);
|
|
|
|
|
$this->getResult()->setIndexedTagName( $extradata['allowed'], 'ext' );
|
|
|
|
|
|
|
|
|
|
$msg = "Filetype not permitted: ";
|
|
|
|
|
if ( isset( $verification['blacklistedExt'] ) ) {
|
|
|
|
|
$msg .= join( ', ', $verification['blacklistedExt'] );
|
|
|
|
|
$extradata['blacklisted'] = array_values( $verification['blacklistedExt'] );
|
|
|
|
|
$this->getResult()->setIndexedTagName( $extradata['blacklisted'], 'ext' );
|
|
|
|
|
} else {
|
|
|
|
|
$msg .= $verification['finalExt'];
|
|
|
|
|
}
|
|
|
|
|
$this->dieUsage( $msg, 'filetype-banned', 0, $extradata );
|
2010-03-30 19:10:10 +00:00
|
|
|
break;
|
|
|
|
|
case UploadBase::VERIFICATION_ERROR:
|
|
|
|
|
$this->getResult()->setIndexedTagName( $verification['details'], 'detail' );
|
|
|
|
|
$this->dieUsage( 'This file did not pass file verification', 'verification-error',
|
|
|
|
|
0, array( 'details' => $verification['details'] ) );
|
|
|
|
|
break;
|
|
|
|
|
case UploadBase::HOOK_ABORTED:
|
|
|
|
|
$this->dieUsage( "The modification you tried to make was aborted by an extension hook",
|
|
|
|
|
'hookaborted', 0, array( 'error' => $verification['error'] ) );
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
$this->dieUsage( 'An unknown error occurred', 'unknown-error',
|
2013-02-03 18:47:42 +00:00
|
|
|
0, array( 'code' => $verification['status'] ) );
|
2010-03-30 19:10:10 +00:00
|
|
|
break;
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
}
|
2010-03-30 19:10:10 +00:00
|
|
|
}
|
|
|
|
|
|
2010-07-28 17:31:32 +00:00
|
|
|
/**
|
2012-05-26 00:05:04 +00:00
|
|
|
* Check warnings.
|
2010-11-03 04:32:41 +00:00
|
|
|
* Returns a suitable array for inclusion into API results if there were warnings
|
|
|
|
|
* Returns the empty array if there were no warnings
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
2010-07-28 17:31:32 +00:00
|
|
|
*/
|
2010-11-03 04:32:41 +00:00
|
|
|
protected function getApiWarnings() {
|
2012-05-26 00:05:04 +00:00
|
|
|
$warnings = $this->mUpload->checkWarnings();
|
|
|
|
|
|
2011-05-15 14:46:13 +00:00
|
|
|
return $this->transformWarnings( $warnings );
|
|
|
|
|
}
|
2011-06-29 23:46:39 +00:00
|
|
|
|
2011-05-15 14:46:13 +00:00
|
|
|
protected function transformWarnings( $warnings ) {
|
|
|
|
|
if ( $warnings ) {
|
|
|
|
|
// Add indices
|
2011-06-29 23:46:39 +00:00
|
|
|
$result = $this->getResult();
|
|
|
|
|
$result->setIndexedTagName( $warnings, 'warning' );
|
2009-10-15 00:14:05 +00:00
|
|
|
|
2011-05-15 14:46:13 +00:00
|
|
|
if ( isset( $warnings['duplicate'] ) ) {
|
|
|
|
|
$dupes = array();
|
|
|
|
|
foreach ( $warnings['duplicate'] as $dupe ) {
|
|
|
|
|
$dupes[] = $dupe->getName();
|
2010-11-03 04:32:41 +00:00
|
|
|
}
|
2011-06-29 23:46:39 +00:00
|
|
|
$result->setIndexedTagName( $dupes, 'duplicate' );
|
2011-05-15 14:46:13 +00:00
|
|
|
$warnings['duplicate'] = $dupes;
|
2010-09-06 10:18:53 +00:00
|
|
|
}
|
|
|
|
|
|
2011-05-15 14:46:13 +00:00
|
|
|
if ( isset( $warnings['exists'] ) ) {
|
|
|
|
|
$warning = $warnings['exists'];
|
|
|
|
|
unset( $warnings['exists'] );
|
|
|
|
|
$warnings[$warning['warning']] = $warning['file']->getName();
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-11-03 04:32:41 +00:00
|
|
|
return $warnings;
|
2010-09-06 10:18:53 +00:00
|
|
|
}
|
2010-03-30 19:10:10 +00:00
|
|
|
|
2010-07-28 17:31:32 +00:00
|
|
|
/**
|
|
|
|
|
* Perform the actual upload. Returns a suitable result array on success;
|
|
|
|
|
* dies on failure.
|
2011-09-21 16:36:43 +00:00
|
|
|
*
|
2013-03-11 17:15:01 +00:00
|
|
|
* @param array $warnings Array of Api upload warnings
|
2011-09-21 16:36:43 +00:00
|
|
|
* @return array
|
2010-07-28 17:31:32 +00:00
|
|
|
*/
|
2012-05-26 00:05:04 +00:00
|
|
|
protected function performUpload( $warnings ) {
|
2009-11-22 15:14:19 +00:00
|
|
|
// Use comment as initial page text by default
|
2010-02-26 13:18:56 +00:00
|
|
|
if ( is_null( $this->mParams['text'] ) ) {
|
2009-11-22 15:14:19 +00:00
|
|
|
$this->mParams['text'] = $this->mParams['comment'];
|
2010-02-26 13:18:56 +00:00
|
|
|
}
|
2010-03-30 19:10:10 +00:00
|
|
|
|
2013-03-11 03:45:51 +00:00
|
|
|
/** @var $file File */
|
2010-03-30 19:10:10 +00:00
|
|
|
$file = $this->mUpload->getLocalFile();
|
2010-04-14 04:57:27 +00:00
|
|
|
$watch = $this->getWatchlistValue( $this->mParams['watchlist'], $file->getTitle() );
|
2010-03-30 19:10:10 +00:00
|
|
|
|
2010-03-25 22:15:08 +00:00
|
|
|
// Deprecated parameters
|
|
|
|
|
if ( $this->mParams['watch'] ) {
|
|
|
|
|
$watch = true;
|
|
|
|
|
}
|
2010-03-30 19:10:10 +00:00
|
|
|
|
2009-08-26 19:38:38 +00:00
|
|
|
// No errors, no warnings: do the upload
|
2012-12-04 02:18:48 +00:00
|
|
|
if ( $this->mParams['async'] ) {
|
|
|
|
|
$progress = UploadBase::getSessionStatus( $this->mParams['filekey'] );
|
|
|
|
|
if ( $progress && $progress['result'] === 'Poll' ) {
|
|
|
|
|
$this->dieUsage( "Upload from stash already in progress.", 'publishfailed' );
|
|
|
|
|
}
|
|
|
|
|
UploadBase::setSessionStatus(
|
|
|
|
|
$this->mParams['filekey'],
|
|
|
|
|
array( 'result' => 'Poll', 'stage' => 'queued', 'status' => Status::newGood() )
|
|
|
|
|
);
|
2013-02-13 21:25:37 +00:00
|
|
|
$ok = JobQueueGroup::singleton()->push( new PublishStashedFileJob(
|
|
|
|
|
Title::makeTitle( NS_FILE, $this->mParams['filename'] ),
|
2012-12-04 02:18:48 +00:00
|
|
|
array(
|
2013-02-13 21:25:37 +00:00
|
|
|
'filename' => $this->mParams['filename'],
|
|
|
|
|
'filekey' => $this->mParams['filekey'],
|
|
|
|
|
'comment' => $this->mParams['comment'],
|
|
|
|
|
'text' => $this->mParams['text'],
|
|
|
|
|
'watch' => $watch,
|
2013-03-14 22:43:42 +00:00
|
|
|
'session' => $this->getContext()->exportSession()
|
2012-12-04 02:18:48 +00:00
|
|
|
)
|
2013-02-13 21:25:37 +00:00
|
|
|
) );
|
|
|
|
|
if ( $ok ) {
|
2012-12-04 02:18:48 +00:00
|
|
|
$result['result'] = 'Poll';
|
2010-07-29 13:53:51 +00:00
|
|
|
} else {
|
2012-12-04 02:18:48 +00:00
|
|
|
UploadBase::setSessionStatus( $this->mParams['filekey'], false );
|
|
|
|
|
$this->dieUsage(
|
|
|
|
|
"Failed to start PublishStashedFile.php", 'publishfailed' );
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2013-03-11 03:45:51 +00:00
|
|
|
/** @var $status Status */
|
2012-12-04 02:18:48 +00:00
|
|
|
$status = $this->mUpload->performUpload( $this->mParams['comment'],
|
|
|
|
|
$this->mParams['text'], $watch, $this->getUser() );
|
|
|
|
|
|
|
|
|
|
if ( !$status->isGood() ) {
|
|
|
|
|
$error = $status->getErrorsArray();
|
|
|
|
|
|
|
|
|
|
if ( count( $error ) == 1 && $error[0][0] == 'async' ) {
|
|
|
|
|
// The upload can not be performed right now, because the user
|
|
|
|
|
// requested so
|
|
|
|
|
return array(
|
|
|
|
|
'result' => 'Queued',
|
|
|
|
|
'statuskey' => $error[0][1],
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
$this->getResult()->setIndexedTagName( $error, 'error' );
|
2009-10-15 00:14:05 +00:00
|
|
|
|
2012-12-04 02:18:48 +00:00
|
|
|
$this->dieUsage( 'An internal error occurred', 'internal-error', 0, $error );
|
|
|
|
|
}
|
2010-07-29 13:53:51 +00:00
|
|
|
}
|
2012-12-04 02:18:48 +00:00
|
|
|
$result['result'] = 'Success';
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
}
|
2010-03-30 19:10:10 +00:00
|
|
|
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
$result['filename'] = $file->getName();
|
2012-05-26 00:05:04 +00:00
|
|
|
if ( $warnings && count( $warnings ) > 0 ) {
|
|
|
|
|
$result['warnings'] = $warnings;
|
|
|
|
|
}
|
2010-11-03 04:32:41 +00:00
|
|
|
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
return $result;
|
|
|
|
|
}
|
2011-06-29 23:46:39 +00:00
|
|
|
|
2011-02-10 18:24:19 +00:00
|
|
|
/**
|
|
|
|
|
* Checks if asynchronous copy uploads are enabled and throws an error if they are not.
|
|
|
|
|
*/
|
|
|
|
|
protected function checkAsyncDownloadEnabled() {
|
|
|
|
|
global $wgAllowAsyncCopyUploads;
|
|
|
|
|
if ( !$wgAllowAsyncCopyUploads ) {
|
2013-02-09 22:03:53 +00:00
|
|
|
$this->dieUsage( 'Asynchronous copy uploads disabled', 'asynccopyuploaddisabled' );
|
2011-02-10 18:24:19 +00:00
|
|
|
}
|
|
|
|
|
}
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
|
|
|
|
|
public function mustBePosted() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-25 00:07:35 +00:00
|
|
|
public function isWriteMode() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
public function getAllowedParams() {
|
2009-08-27 14:46:54 +00:00
|
|
|
$params = array(
|
2010-08-04 14:15:33 +00:00
|
|
|
'filename' => array(
|
|
|
|
|
ApiBase::PARAM_TYPE => 'string',
|
|
|
|
|
),
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
'comment' => array(
|
2009-07-15 00:55:58 +00:00
|
|
|
ApiBase::PARAM_DFLT => ''
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
),
|
2009-11-22 15:14:19 +00:00
|
|
|
'text' => null,
|
2012-07-18 17:24:38 +00:00
|
|
|
'token' => array(
|
|
|
|
|
ApiBase::PARAM_TYPE => 'string',
|
|
|
|
|
ApiBase::PARAM_REQUIRED => true
|
|
|
|
|
),
|
2010-03-25 22:15:08 +00:00
|
|
|
'watch' => array(
|
|
|
|
|
ApiBase::PARAM_DFLT => false,
|
|
|
|
|
ApiBase::PARAM_DEPRECATED => true,
|
|
|
|
|
),
|
|
|
|
|
'watchlist' => array(
|
|
|
|
|
ApiBase::PARAM_DFLT => 'preferences',
|
|
|
|
|
ApiBase::PARAM_TYPE => array(
|
|
|
|
|
'watch',
|
|
|
|
|
'preferences',
|
|
|
|
|
'nochange'
|
|
|
|
|
),
|
|
|
|
|
),
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
'ignorewarnings' => false,
|
2013-02-26 21:45:37 +00:00
|
|
|
'file' => array(
|
|
|
|
|
ApiBase::PARAM_TYPE => 'upload',
|
|
|
|
|
),
|
2009-07-28 17:52:09 +00:00
|
|
|
'url' => null,
|
2011-07-12 21:11:43 +00:00
|
|
|
'filekey' => null,
|
|
|
|
|
'sessionkey' => array(
|
|
|
|
|
ApiBase::PARAM_DFLT => null,
|
|
|
|
|
ApiBase::PARAM_DEPRECATED => true,
|
|
|
|
|
),
|
2010-11-03 04:32:41 +00:00
|
|
|
'stash' => false,
|
2011-02-10 18:24:19 +00:00
|
|
|
|
2011-08-02 10:13:56 +00:00
|
|
|
'filesize' => null,
|
|
|
|
|
'offset' => null,
|
2013-02-26 21:45:37 +00:00
|
|
|
'chunk' => array(
|
|
|
|
|
ApiBase::PARAM_TYPE => 'upload',
|
|
|
|
|
),
|
2011-08-02 10:13:56 +00:00
|
|
|
|
2012-11-19 08:07:50 +00:00
|
|
|
'async' => false,
|
2011-02-10 18:24:19 +00:00
|
|
|
'asyncdownload' => false,
|
|
|
|
|
'leavemessage' => false,
|
|
|
|
|
'statuskey' => null,
|
2012-11-19 08:07:50 +00:00
|
|
|
'checkstatus' => false,
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
);
|
2010-08-05 07:02:09 +00:00
|
|
|
|
2009-08-27 14:46:54 +00:00
|
|
|
return $params;
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getParamDescription() {
|
2010-07-29 13:53:51 +00:00
|
|
|
$params = array(
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
'filename' => 'Target filename',
|
2009-07-28 17:52:09 +00:00
|
|
|
'token' => 'Edit token. You can get one of these through prop=info',
|
2009-11-22 15:14:19 +00:00
|
|
|
'comment' => 'Upload comment. Also used as the initial page text for new files if "text" is not specified',
|
|
|
|
|
'text' => 'Initial page text for new files',
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
'watch' => 'Watch the page',
|
2010-03-25 22:15:08 +00:00
|
|
|
'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch',
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
'ignorewarnings' => 'Ignore any warnings',
|
2009-07-28 17:52:09 +00:00
|
|
|
'file' => 'File contents',
|
2011-12-12 17:22:20 +00:00
|
|
|
'url' => 'URL to fetch the file from',
|
2011-07-12 21:11:43 +00:00
|
|
|
'filekey' => 'Key that identifies a previous upload that was stashed temporarily.',
|
|
|
|
|
'sessionkey' => 'Same as filekey, maintained for backward compatibility.',
|
2011-02-10 18:24:19 +00:00
|
|
|
'stash' => 'If set, the server will not add the file to the repository and stash it temporarily.',
|
2010-07-29 13:53:51 +00:00
|
|
|
|
2011-08-02 10:13:56 +00:00
|
|
|
'chunk' => 'Chunk contents',
|
|
|
|
|
'offset' => 'Offset of chunk in bytes',
|
|
|
|
|
'filesize' => 'Filesize of entire upload',
|
|
|
|
|
|
2012-12-18 19:38:04 +00:00
|
|
|
'async' => 'Make potentially large file operations asynchronous when possible',
|
2011-02-10 18:24:19 +00:00
|
|
|
'asyncdownload' => 'Make fetching a URL asynchronous',
|
|
|
|
|
'leavemessage' => 'If asyncdownload is used, leave a message on the user talk page if finished',
|
2012-11-19 08:07:50 +00:00
|
|
|
'statuskey' => 'Fetch the upload status for this file key (upload by URL)',
|
|
|
|
|
'checkstatus' => 'Only fetch the upload status for the given file key',
|
2011-02-10 18:24:19 +00:00
|
|
|
);
|
2010-08-05 07:02:09 +00:00
|
|
|
|
2010-07-29 13:53:51 +00:00
|
|
|
return $params;
|
2010-08-05 07:02:09 +00:00
|
|
|
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
Added result properties to action=paraminfo
Added information about the properties of the results of API calls
to action=paraminfo, including information about "property groups":
what should the prop parameter be set to to get that property.
Uses the same format for types as parameters already do.
The output format of some modules doesn't fit this, so the result
properties for them weren't added, or only partially.
Partially implemented modules:
* expandtemplates:
parsetree is in its own tag
* protect, allusers, backlinks, deletedrevs, info, imageinfo,
logevents, querypage, recentchanges, revisions, searchinfo,
usercontribs, userinfo, users, watchlist, upload:
response with partially complex structure
Not implemented modules:
* feedcontributions, feedwatchlist, opensearch, rds:
non-standard reponse
* help:
error is normal response; not very useful for automated tools anyway
* paraminfo, parse, pageprops, siteinfo, userrights:
response with complex structure
Change-Id: Iff2a9bef79f994e73eef3062b4dd5461bff968ab
2012-05-02 15:00:30 +00:00
|
|
|
public function getResultProperties() {
|
|
|
|
|
return array(
|
|
|
|
|
'' => array(
|
|
|
|
|
'result' => array(
|
|
|
|
|
ApiBase::PROP_TYPE => array(
|
|
|
|
|
'Success',
|
|
|
|
|
'Warning',
|
|
|
|
|
'Continue',
|
|
|
|
|
'Queued'
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
'filekey' => array(
|
|
|
|
|
ApiBase::PROP_TYPE => 'string',
|
|
|
|
|
ApiBase::PROP_NULLABLE => true
|
|
|
|
|
),
|
|
|
|
|
'sessionkey' => array(
|
|
|
|
|
ApiBase::PROP_TYPE => 'string',
|
|
|
|
|
ApiBase::PROP_NULLABLE => true
|
|
|
|
|
),
|
|
|
|
|
'offset' => array(
|
|
|
|
|
ApiBase::PROP_TYPE => 'integer',
|
|
|
|
|
ApiBase::PROP_NULLABLE => true
|
|
|
|
|
),
|
|
|
|
|
'statuskey' => array(
|
|
|
|
|
ApiBase::PROP_TYPE => 'string',
|
|
|
|
|
ApiBase::PROP_NULLABLE => true
|
|
|
|
|
),
|
|
|
|
|
'filename' => array(
|
|
|
|
|
ApiBase::PROP_TYPE => 'string',
|
|
|
|
|
ApiBase::PROP_NULLABLE => true
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
public function getDescription() {
|
|
|
|
|
return array(
|
2009-07-28 17:52:09 +00:00
|
|
|
'Upload a file, or get the status of pending uploads. Several methods are available:',
|
|
|
|
|
' * Upload file contents directly, using the "file" parameter',
|
2010-01-22 04:37:23 +00:00
|
|
|
' * Have the MediaWiki server fetch a file from a URL, using the "url" parameter',
|
2011-07-12 21:11:43 +00:00
|
|
|
' * Complete an earlier upload that failed due to warnings, using the "filekey" parameter',
|
2009-07-28 17:52:09 +00:00
|
|
|
'Note that the HTTP POST must be done as a file upload (i.e. using multipart/form-data) when',
|
2013-02-03 18:47:42 +00:00
|
|
|
'sending the "file". Also you must get and send an edit token before doing any upload stuff'
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
);
|
|
|
|
|
}
|
2010-02-26 13:18:56 +00:00
|
|
|
|
|
|
|
|
public function getPossibleErrors() {
|
2011-02-25 19:09:39 +00:00
|
|
|
return array_merge( parent::getPossibleErrors(),
|
2011-07-12 21:11:43 +00:00
|
|
|
$this->getRequireOnlyOneParameterErrorMessages( array( 'filekey', 'file', 'url', 'statuskey' ) ),
|
2011-02-25 19:09:39 +00:00
|
|
|
array(
|
|
|
|
|
array( 'uploaddisabled' ),
|
2011-07-12 21:11:43 +00:00
|
|
|
array( 'invalid-file-key' ),
|
2011-02-25 19:09:39 +00:00
|
|
|
array( 'uploaddisabled' ),
|
|
|
|
|
array( 'mustbeloggedin', 'upload' ),
|
|
|
|
|
array( 'badaccess-groups' ),
|
|
|
|
|
array( 'code' => 'fetchfileerror', 'info' => '' ),
|
|
|
|
|
array( 'code' => 'nomodule', 'info' => 'No upload module set' ),
|
|
|
|
|
array( 'code' => 'empty-file', 'info' => 'The file you submitted was empty' ),
|
|
|
|
|
array( 'code' => 'filetype-missing', 'info' => 'The file is missing an extension' ),
|
|
|
|
|
array( 'code' => 'filename-tooshort', 'info' => 'The filename is too short' ),
|
|
|
|
|
array( 'code' => 'overwrite', 'info' => 'Overwriting an existing file is not allowed' ),
|
|
|
|
|
array( 'code' => 'stashfailed', 'info' => 'Stashing temporary file failed' ),
|
2012-12-04 02:18:48 +00:00
|
|
|
array( 'code' => 'publishfailed', 'info' => 'Publishing of stashed file failed' ),
|
2011-02-25 19:09:39 +00:00
|
|
|
array( 'code' => 'internal-error', 'info' => 'An internal error occurred' ),
|
|
|
|
|
array( 'code' => 'asynccopyuploaddisabled', 'info' => 'Asynchronous copy uploads disabled' ),
|
2012-06-17 20:31:08 +00:00
|
|
|
array( 'fileexists-forbidden' ),
|
|
|
|
|
array( 'fileexists-shared-forbidden' ),
|
2011-02-25 19:09:39 +00:00
|
|
|
)
|
|
|
|
|
);
|
2010-02-13 00:09:05 +00:00
|
|
|
}
|
2010-02-26 13:18:56 +00:00
|
|
|
|
2010-10-01 20:12:50 +00:00
|
|
|
public function needsToken() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-15 23:53:43 +00:00
|
|
|
public function getTokenSalt() {
|
2010-02-16 21:59:16 +00:00
|
|
|
return '';
|
2010-02-14 22:20:27 +00:00
|
|
|
}
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
|
2011-08-17 22:24:21 +00:00
|
|
|
public function getExamples() {
|
2009-07-15 00:55:58 +00:00
|
|
|
return array(
|
2011-12-27 16:22:35 +00:00
|
|
|
'api.php?action=upload&filename=Wiki.png&url=http%3A//upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png'
|
|
|
|
|
=> 'Upload from a URL',
|
|
|
|
|
'api.php?action=upload&filename=Wiki.png&filekey=filekey&ignorewarnings=1'
|
|
|
|
|
=> 'Complete an upload that failed due to warnings',
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-17 16:38:24 +00:00
|
|
|
public function getHelpUrls() {
|
2011-11-28 15:43:11 +00:00
|
|
|
return 'https://www.mediawiki.org/wiki/API:Upload';
|
2011-07-17 16:38:24 +00:00
|
|
|
}
|
here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview
= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions
== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php
* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)
== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.
= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader
* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.
= js2 system / mwEmbed=
$wgEnableJS2system = false
* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)
* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.
= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)
== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.
== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
|
|
|
}
|