Mage_Downloader - Version 1.6.1.0

Version Notes

1.6.1.0

Download this release

Release Info

Developer Magento Core Team
Extension Mage_Downloader
Version 1.6.1.0
Comparing to
See all releases


Version 1.6.1.0

Files changed (136) hide show
  1. .htaccess +186 -0
  2. downloader/.htaccess +11 -0
  3. downloader/Maged/Connect.php +467 -0
  4. downloader/Maged/Connect/Frontend.php +149 -0
  5. downloader/Maged/Controller.php +977 -0
  6. downloader/Maged/Exception.php +37 -0
  7. downloader/Maged/Model.php +99 -0
  8. downloader/Maged/Model/Config.php +84 -0
  9. downloader/Maged/Model/Config/Abstract.php +134 -0
  10. downloader/Maged/Model/Config/Community.php +112 -0
  11. downloader/Maged/Model/Config/Interface.php +90 -0
  12. downloader/Maged/Model/Connect.php +491 -0
  13. downloader/Maged/Model/Connect/Request.php +43 -0
  14. downloader/Maged/Model/Dowloader.php +30 -0
  15. downloader/Maged/Model/Session.php +224 -0
  16. downloader/Maged/View.php +155 -0
  17. downloader/config.ini +1 -0
  18. downloader/index.php +36 -0
  19. downloader/js/prototype.js +3277 -0
  20. downloader/lib/Mage/Archive.php +222 -0
  21. downloader/lib/Mage/Archive/Abstract.php +84 -0
  22. downloader/lib/Mage/Archive/Bz.php +79 -0
  23. downloader/lib/Mage/Archive/Gz.php +77 -0
  24. downloader/lib/Mage/Archive/Interface.php +53 -0
  25. downloader/lib/Mage/Archive/Tar.php +372 -0
  26. downloader/lib/Mage/Autoload/Simple.php +52 -0
  27. downloader/lib/Mage/Connect/Channel/Generator.php +63 -0
  28. downloader/lib/Mage/Connect/Channel/Parser.php +25 -0
  29. downloader/lib/Mage/Connect/Channel/VO.php +113 -0
  30. downloader/lib/Mage/Connect/Command.php +390 -0
  31. downloader/lib/Mage/Connect/Command/Channels.php +189 -0
  32. downloader/lib/Mage/Connect/Command/Channels_Header.php +104 -0
  33. downloader/lib/Mage/Connect/Command/Config.php +213 -0
  34. downloader/lib/Mage/Connect/Command/Config_Header.php +100 -0
  35. downloader/lib/Mage/Connect/Command/Install.php +567 -0
  36. downloader/lib/Mage/Connect/Command/Install_Header.php +237 -0
  37. downloader/lib/Mage/Connect/Command/Package.php +204 -0
  38. downloader/lib/Mage/Connect/Command/Package_Header.php +76 -0
  39. downloader/lib/Mage/Connect/Command/Registry.php +364 -0
  40. downloader/lib/Mage/Connect/Command/Registry_Header.php +84 -0
  41. downloader/lib/Mage/Connect/Command/Remote.php +231 -0
  42. downloader/lib/Mage/Connect/Command/Remote_Header.php +88 -0
  43. downloader/lib/Mage/Connect/Config.php +464 -0
  44. downloader/lib/Mage/Connect/Converter.php +336 -0
  45. downloader/lib/Mage/Connect/Frontend.php +251 -0
  46. downloader/lib/Mage/Connect/Frontend/CLI.php +456 -0
  47. downloader/lib/Mage/Connect/Ftp.php +523 -0
  48. downloader/lib/Mage/Connect/Loader.php +51 -0
  49. downloader/lib/Mage/Connect/Loader/Ftp.php +155 -0
  50. downloader/lib/Mage/Connect/Package.php +1499 -0
  51. downloader/lib/Mage/Connect/Package/Extension.php +1 -0
  52. downloader/lib/Mage/Connect/Package/Hotfix.php +137 -0
  53. downloader/lib/Mage/Connect/Package/Maintainer.php +1 -0
  54. downloader/lib/Mage/Connect/Package/Reader.php +150 -0
  55. downloader/lib/Mage/Connect/Package/Target.php +126 -0
  56. downloader/lib/Mage/Connect/Package/VO.php +96 -0
  57. downloader/lib/Mage/Connect/Package/Writer.php +177 -0
  58. downloader/lib/Mage/Connect/Packager.php +909 -0
  59. downloader/lib/Mage/Connect/Repository.php +1 -0
  60. downloader/lib/Mage/Connect/Repository/Abstract.php +1 -0
  61. downloader/lib/Mage/Connect/Repository/Channel.php +1 -0
  62. downloader/lib/Mage/Connect/Repository/Channel/Abstract.php +1 -0
  63. downloader/lib/Mage/Connect/Repository/Channel/Commercial.php +1 -0
  64. downloader/lib/Mage/Connect/Repository/Channel/Community.php +1 -0
  65. downloader/lib/Mage/Connect/Repository/Channel/Core.php +1 -0
  66. downloader/lib/Mage/Connect/Repository/Local.php +1 -0
  67. downloader/lib/Mage/Connect/Rest.php +366 -0
  68. downloader/lib/Mage/Connect/Singleconfig.php +934 -0
  69. downloader/lib/Mage/Connect/Structures/Graph.php +248 -0
  70. downloader/lib/Mage/Connect/Structures/Node.php +257 -0
  71. downloader/lib/Mage/Connect/Validator.php +440 -0
  72. downloader/lib/Mage/DB/Exception.php +36 -0
  73. downloader/lib/Mage/DB/Mysqli.php +532 -0
  74. downloader/lib/Mage/Exception.php +35 -0
  75. downloader/lib/Mage/HTTP/Client.php +84 -0
  76. downloader/lib/Mage/HTTP/Client/Curl.php +556 -0
  77. downloader/lib/Mage/HTTP/Client/Socket.php +537 -0
  78. downloader/lib/Mage/HTTP/IClient.php +145 -0
  79. downloader/lib/Mage/System/Args.php +102 -0
  80. downloader/lib/Mage/System/Dirs.php +104 -0
  81. downloader/lib/Mage/Xml/Generator.php +114 -0
  82. downloader/lib/Mage/Xml/Parser.php +115 -0
  83. downloader/mage.php +156 -0
  84. downloader/skin/boxes.css +217 -0
  85. downloader/skin/ie7boxes.css +27 -0
  86. downloader/skin/ieboxes.css +29 -0
  87. downloader/skin/images/Magento_Connect.jpg +0 -0
  88. downloader/skin/images/ajax-loader-tr.gif +0 -0
  89. downloader/skin/images/btn_bg.gif +0 -0
  90. downloader/skin/images/header_bg.gif +0 -0
  91. downloader/skin/images/logo.gif +0 -0
  92. downloader/skin/images/nav_bg.gif +0 -0
  93. downloader/skin/images/nav_separator.gif +0 -0
  94. downloader/skin/install/boxes.css +414 -0
  95. downloader/skin/install/clears.css +70 -0
  96. downloader/skin/install/ie7minus.css +40 -0
  97. downloader/skin/install/iestyles.css +78 -0
  98. downloader/skin/install/images/error_msg_icon.gif +0 -0
  99. downloader/skin/install/images/footer_bg.gif +0 -0
  100. downloader/skin/install/images/footer_container_bg.gif +0 -0
  101. downloader/skin/install/images/footer_info_separator.gif +0 -0
  102. downloader/skin/install/images/footer_informational_bg.gif +0 -0
  103. downloader/skin/install/images/footer_left.gif +0 -0
  104. downloader/skin/install/images/footer_legality_bg.gif +0 -0
  105. downloader/skin/install/images/footer_right.gif +0 -0
  106. downloader/skin/install/images/header_bg.gif +0 -0
  107. downloader/skin/install/images/header_nav_bg.gif +0 -0
  108. downloader/skin/install/images/header_top_bg.jpg +0 -0
  109. downloader/skin/install/images/header_top_container_bg.jpg +0 -0
  110. downloader/skin/install/images/logo.gif +0 -0
  111. downloader/skin/install/images/main_bg.gif +0 -0
  112. downloader/skin/install/images/main_container_bg.gif +0 -0
  113. downloader/skin/install/images/note_msg_icon.gif +0 -0
  114. downloader/skin/install/images/success_msg_icon.gif +0 -0
  115. downloader/skin/install/images/validation_advice_bg.gif +0 -0
  116. downloader/skin/install/reset.css +83 -0
  117. downloader/template/.htaccess +2 -0
  118. downloader/template/connect/iframe.phtml +121 -0
  119. downloader/template/connect/packages.phtml +221 -0
  120. downloader/template/connect/packages_prepare.phtml +78 -0
  121. downloader/template/exception.phtml +36 -0
  122. downloader/template/footer.phtml +40 -0
  123. downloader/template/header.phtml +73 -0
  124. downloader/template/index.phtml +36 -0
  125. downloader/template/install/download.phtml +184 -0
  126. downloader/template/install/footer.phtml +49 -0
  127. downloader/template/install/header.phtml +99 -0
  128. downloader/template/install/writable.phtml +40 -0
  129. downloader/template/login.phtml +43 -0
  130. downloader/template/messages.phtml +39 -0
  131. downloader/template/noroute.phtml +31 -0
  132. downloader/template/settings.phtml +166 -0
  133. downloader/template/writable.phtml +35 -0
  134. index.php +80 -0
  135. mage +54 -0
  136. package.xml +18 -0
.htaccess ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ############################################
2
+ ## uncomment these lines for CGI mode
3
+ ## make sure to specify the correct cgi php binary file name
4
+ ## it might be /cgi-bin/php-cgi
5
+
6
+ # Action php5-cgi /cgi-bin/php5-cgi
7
+ # AddHandler php5-cgi .php
8
+
9
+ ############################################
10
+ ## GoDaddy specific options
11
+
12
+ # Options -MultiViews
13
+
14
+ ## you might also need to add this line to php.ini
15
+ ## cgi.fix_pathinfo = 1
16
+ ## if it still doesn't work, rename php.ini to php5.ini
17
+
18
+ ############################################
19
+ ## this line is specific for 1and1 hosting
20
+
21
+ #AddType x-mapp-php5 .php
22
+ #AddHandler x-mapp-php5 .php
23
+
24
+ ############################################
25
+ ## default index file
26
+
27
+ DirectoryIndex index.php
28
+
29
+ <IfModule mod_php5.c>
30
+
31
+ ############################################
32
+ ## adjust memory limit
33
+
34
+ # php_value memory_limit 64M
35
+ php_value memory_limit 256M
36
+ php_value max_execution_time 18000
37
+
38
+ ############################################
39
+ ## disable magic quotes for php request vars
40
+
41
+ php_flag magic_quotes_gpc off
42
+
43
+ ############################################
44
+ ## disable automatic session start
45
+ ## before autoload was initialized
46
+
47
+ php_flag session.auto_start off
48
+
49
+ ############################################
50
+ ## enable resulting html compression
51
+
52
+ #php_flag zlib.output_compression on
53
+
54
+ ###########################################
55
+ # disable user agent verification to not break multiple image upload
56
+
57
+ php_flag suhosin.session.cryptua off
58
+
59
+ ###########################################
60
+ # turn off compatibility with PHP4 when dealing with objects
61
+
62
+ php_flag zend.ze1_compatibility_mode Off
63
+
64
+ </IfModule>
65
+
66
+ <IfModule mod_security.c>
67
+ ###########################################
68
+ # disable POST processing to not break multiple image upload
69
+
70
+ SecFilterEngine Off
71
+ SecFilterScanPOST Off
72
+ </IfModule>
73
+
74
+ <IfModule mod_deflate.c>
75
+
76
+ ############################################
77
+ ## enable apache served files compression
78
+ ## http://developer.yahoo.com/performance/rules.html#gzip
79
+
80
+ # Insert filter on all content
81
+ ###SetOutputFilter DEFLATE
82
+ # Insert filter on selected content types only
83
+ #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
84
+
85
+ # Netscape 4.x has some problems...
86
+ #BrowserMatch ^Mozilla/4 gzip-only-text/html
87
+
88
+ # Netscape 4.06-4.08 have some more problems
89
+ #BrowserMatch ^Mozilla/4\.0[678] no-gzip
90
+
91
+ # MSIE masquerades as Netscape, but it is fine
92
+ #BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
93
+
94
+ # Don't compress images
95
+ #SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
96
+
97
+ # Make sure proxies don't deliver the wrong content
98
+ #Header append Vary User-Agent env=!dont-vary
99
+
100
+ </IfModule>
101
+
102
+ <IfModule mod_ssl.c>
103
+
104
+ ############################################
105
+ ## make HTTPS env vars available for CGI mode
106
+
107
+ SSLOptions StdEnvVars
108
+
109
+ </IfModule>
110
+
111
+ <IfModule mod_rewrite.c>
112
+
113
+ ############################################
114
+ ## enable rewrites
115
+
116
+ Options +FollowSymLinks
117
+ RewriteEngine on
118
+
119
+ ############################################
120
+ ## you can put here your magento root folder
121
+ ## path relative to web root
122
+
123
+ #RewriteBase /magento/
124
+
125
+ ############################################
126
+ ## workaround for HTTP authorization
127
+ ## in CGI environment
128
+
129
+ RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
130
+
131
+ ############################################
132
+ ## always send 404 on missing files in these folders
133
+
134
+ RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
135
+
136
+ ############################################
137
+ ## never rewrite for existing files, directories and links
138
+
139
+ RewriteCond %{REQUEST_FILENAME} !-f
140
+ RewriteCond %{REQUEST_FILENAME} !-d
141
+ RewriteCond %{REQUEST_FILENAME} !-l
142
+
143
+ ############################################
144
+ ## rewrite everything else to index.php
145
+
146
+ RewriteRule .* index.php [L]
147
+
148
+ </IfModule>
149
+
150
+
151
+ ############################################
152
+ ## Prevent character encoding issues from server overrides
153
+ ## If you still have problems, use the second line instead
154
+
155
+ AddDefaultCharset Off
156
+ #AddDefaultCharset UTF-8
157
+
158
+ <IfModule mod_expires.c>
159
+
160
+ ############################################
161
+ ## Add default Expires header
162
+ ## http://developer.yahoo.com/performance/rules.html#expires
163
+
164
+ ExpiresDefault "access plus 1 year"
165
+
166
+ </IfModule>
167
+
168
+ ############################################
169
+ ## By default allow all access
170
+
171
+ Order allow,deny
172
+ Allow from all
173
+
174
+ ###########################################
175
+ ## Deny access to release notes to prevent disclosure of the installed Magento version
176
+
177
+ <Files RELEASE_NOTES.txt>
178
+ order allow,deny
179
+ deny from all
180
+ </Files>
181
+
182
+ ############################################
183
+ ## If running in cluster environment, uncomment this
184
+ ## http://developer.yahoo.com/performance/rules.html#etags
185
+
186
+ #FileETag none
downloader/.htaccess ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <IfModule mod_deflate.c>
2
+
3
+ RemoveOutputFilter DEFLATE
4
+ RemoveOutputFilter GZIP
5
+
6
+ </IfModule>
7
+
8
+ <Files ~ "\.(cfg|ini|xml)$">
9
+ order allow,deny
10
+ deny from all
11
+ </Files>
downloader/Maged/Connect.php ADDED
@@ -0,0 +1,467 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Connect
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ error_reporting(E_ALL & ~E_NOTICE);
28
+
29
+ // just a shortcut
30
+ if (!defined('DS')) {
31
+ define('DS', DIRECTORY_SEPARATOR);
32
+ }
33
+
34
+ // add Mage lib in include_path if needed
35
+ $_includePath = get_include_path();
36
+ $_libDir = dirname(dirname(__FILE__)) . DS . 'lib';
37
+ if (strpos($_includePath, $_libDir) === false) {
38
+ if (substr($_includePath, 0, 2) === '.' . PATH_SEPARATOR) {
39
+ $_includePath = '.' . PATH_SEPARATOR . $_libDir . PATH_SEPARATOR . substr($_includePath, 2);
40
+ } else {
41
+ $_includePath = $_libDir . PATH_SEPARATOR . $_includePath;
42
+ }
43
+ set_include_path($_includePath);
44
+ }
45
+
46
+ /**
47
+ * Class for connect
48
+ *
49
+ * @category Mage
50
+ * @package Mage_Connect
51
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
52
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
53
+ */
54
+ class Maged_Connect
55
+ {
56
+
57
+ /**
58
+ * Object of config
59
+ *
60
+ * @var Mage_Connect_Config
61
+ */
62
+ protected $_config;
63
+
64
+ /**
65
+ * Object of single config
66
+ *
67
+ * @var Mage_Connect_Singleconfig
68
+ */
69
+ protected $_sconfig;
70
+
71
+ /**
72
+ * Object of frontend
73
+ *
74
+ * @var Mage_Connect_Frontend
75
+ */
76
+ protected $_frontend;
77
+
78
+ /**
79
+ * Internal cache for command objects
80
+ *
81
+ * @var array
82
+ */
83
+ protected $_cmdCache = array();
84
+
85
+ /**
86
+ * Instance of class
87
+ *
88
+ * @var Maged_Connect
89
+ */
90
+ static protected $_instance;
91
+
92
+ /**
93
+ * Constructor
94
+ */
95
+ public function __construct()
96
+ {
97
+ $this->getConfig();
98
+ $this->getSingleConfig();
99
+ $this->getFrontend();
100
+ }
101
+
102
+ /**
103
+ * Initialize instance
104
+ *
105
+ * @return Maged_Connect
106
+ */
107
+ public static function getInstance()
108
+ {
109
+ if (!self::$_instance) {
110
+ self::$_instance = new self;
111
+ }
112
+ return self::$_instance;
113
+ }
114
+
115
+ /**
116
+ * Retrieve object of config and set it to Mage_Connect_Command
117
+ *
118
+ * @return Mage_Connect_Config
119
+ */
120
+ public function getConfig()
121
+ {
122
+ if (!$this->_config) {
123
+ $this->_config = new Mage_Connect_Config();
124
+ $ftp=$this->_config->__get('remote_config');
125
+ if(!empty($ftp)){
126
+ $packager = new Mage_Connect_Packager();
127
+ list($cache, $config, $ftpObj) = $packager->getRemoteConf($ftp);
128
+ $this->_config=$config;
129
+ $this->_sconfig=$cache;
130
+ }
131
+ $this->_config->magento_root = dirname(dirname(__FILE__)).DS.'..';
132
+ Mage_Connect_Command::setConfigObject($this->_config);
133
+ }
134
+ return $this->_config;
135
+ }
136
+
137
+ /**
138
+ * Retrieve object of single config and set it to Mage_Connect_Command
139
+ *
140
+ * @param bool $reload
141
+ * @return Mage_Connect_Singleconfig
142
+ */
143
+ public function getSingleConfig($reload = false)
144
+ {
145
+ if(!$this->_sconfig || $reload) {
146
+ $this->_sconfig = new Mage_Connect_Singleconfig($this->getConfig()->magento_root . DIRECTORY_SEPARATOR . $this->getConfig()->downloader_path . DIRECTORY_SEPARATOR . Mage_Connect_Singleconfig::DEFAULT_SCONFIG_FILENAME);
147
+ }
148
+ Mage_Connect_Command::setSconfig($this->_sconfig);
149
+ return $this->_sconfig;
150
+
151
+ }
152
+
153
+ /**
154
+ * Retrieve object of frontend and set it to Mage_Connect_Command
155
+ *
156
+ * @return Maged_Connect_Frontend
157
+ */
158
+ public function getFrontend()
159
+ {
160
+ if (!$this->_frontend) {
161
+ $this->_frontend = new Maged_Connect_Frontend();
162
+ Mage_Connect_Command::setFrontendObject($this->_frontend);
163
+ }
164
+ return $this->_frontend;
165
+ }
166
+
167
+ /**
168
+ * Retrieve lof from frontend
169
+ *
170
+ * @return array
171
+ */
172
+ public function getLog()
173
+ {
174
+ return $this->getFrontend()->getLog();
175
+ }
176
+
177
+ /**
178
+ * Retrieve output from frontend
179
+ *
180
+ * @return array
181
+ */
182
+ public function getOutput()
183
+ {
184
+ return $this->getFrontend()->getOutput();
185
+ }
186
+
187
+ /**
188
+ * Clean registry
189
+ *
190
+ * @return Maged_Connect
191
+ */
192
+ public function cleanSconfig()
193
+ {
194
+ $this->getSingleConfig()->clear();
195
+ return $this;
196
+ }
197
+
198
+ /**
199
+ * Delete directory recursively
200
+ *
201
+ * @param string $path
202
+ * @return Maged_Connect
203
+ */
204
+ public function delTree($path) {
205
+ if (@is_dir($path)) {
206
+ $entries = @scandir($path);
207
+ foreach ($entries as $entry) {
208
+ if ($entry != '.' && $entry != '..') {
209
+ $this->delTree($path.DS.$entry);
210
+ }
211
+ }
212
+ @rmdir($path);
213
+ } else {
214
+ @unlink($path);
215
+ }
216
+ return $this;
217
+ }
218
+
219
+ /**
220
+ * Run commands from Mage_Connect_Command
221
+ *
222
+ * @param string $command
223
+ * @param array $options
224
+ * @param array $params
225
+ * @return
226
+ */
227
+ public function run($command, $options=array(), $params=array())
228
+ {
229
+ @set_time_limit(0);
230
+ @ini_set('memory_limit', '256M');
231
+
232
+ if (empty($this->_cmdCache[$command])) {
233
+ Mage_Connect_Command::getCommands();
234
+ /**
235
+ * @var $cmd Mage_Connect_Command
236
+ */
237
+ $cmd = Mage_Connect_Command::getInstance($command);
238
+ if ($cmd instanceof Mage_Connect_Error) {
239
+ return $cmd;
240
+ }
241
+ $this->_cmdCache[$command] = $cmd;
242
+ } else {
243
+ /**
244
+ * @var $cmd Mage_Connect_Command
245
+ */
246
+ $cmd = $this->_cmdCache[$command];
247
+ }
248
+ $ftp=$this->getConfig()->remote_config;
249
+ if(strlen($ftp)>0){
250
+ $options=array_merge($options, array('ftp'=>$ftp));
251
+ }
252
+ $cmd->run($command, $options, $params);
253
+ if ($cmd->ui()->hasErrors()) {
254
+ return false;
255
+ } else {
256
+ return true;
257
+ }
258
+ }
259
+
260
+ public function setRemoteConfig($uri) #$host, $user, $password, $path='', $port=null)
261
+ {
262
+ #$uri = 'ftp://' . $user . ':' . $password . '@' . $host . (is_numeric($port) ? ':' . $port : '') . '/' . trim($path, '/') . '/';
263
+ //$this->run('config-set', array(), array('remote_config', $uri));
264
+ //$this->run('config-set', array('ftp'=>$uri), array('remote_config', $uri));
265
+ $this->getConfig()->remote_config=$uri;
266
+ return $this;
267
+ }
268
+
269
+ /**
270
+ *
271
+ * @param array $errors Error messages
272
+ * @return Maged_Connect
273
+ */
274
+ public function showConnectErrors($errors)
275
+ {
276
+ echo '<script type="text/javascript">';
277
+ $run = new Maged_Model_Connect_Request();
278
+ if ($callback = $run->get('failure_callback')) {
279
+ if (is_array($callback)) {
280
+ call_user_func_array($callback, array($result));
281
+ } else {
282
+ echo $callback;
283
+ }
284
+ }
285
+ echo '</script>';
286
+
287
+ return $this;
288
+ }
289
+
290
+ /**
291
+ * Run Mage_Connect_Command with html output console style
292
+ *
293
+ * @param array|Maged_Model $runParams command, options, params,
294
+ * comment, success_callback, failure_callback
295
+ */
296
+ public function runHtmlConsole($runParams)
297
+ {
298
+ if (function_exists('apache_setenv')) {
299
+ apache_setenv('no-gzip', '1');
300
+ }
301
+ @ini_set('zlib.output_compression', 0);
302
+ @ini_set('implicit_flush', 1);
303
+ for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
304
+ ob_implicit_flush();
305
+
306
+ $fe = $this->getFrontend();
307
+ $oldLogStream = $fe->getLogStream();
308
+ $fe->setLogStream('stdout');
309
+
310
+ if ($runParams instanceof Maged_Model) {
311
+ $run = $runParams;
312
+ } elseif (is_array($runParams)) {
313
+ $run = new Maged_Model_Connect_Request($runParams);
314
+ } elseif (is_string($runParams)) {
315
+ $run = new Maged_Model_Connect_Request(array('comment'=>$runParams));
316
+ } else {
317
+ throw Maged_Exception("Invalid run parameters");
318
+ }
319
+
320
+ if (!$run->get('no-header')) {
321
+ ?>
322
+ <html><head><style type="text/css">
323
+ body { margin:0px;
324
+ padding:3px;
325
+ background:black;
326
+ color:#2EC029;
327
+ font:normal 11px Lucida Console, Courier New, serif;
328
+ }
329
+ </style></head><body>
330
+ <script type="text/javascript">
331
+ if (parent && parent.disableInputs) {
332
+ parent.disableInputs(true);
333
+ }
334
+ if (typeof auto_scroll=='undefined') {
335
+ var auto_scroll = window.setInterval(console_scroll, 10);
336
+ }
337
+ function console_scroll()
338
+ {
339
+ if (typeof top.$ != 'function') {
340
+ return;
341
+ }
342
+ if (top.$('connect_iframe_scroll').checked) {
343
+ document.body.scrollTop+=3;
344
+ }
345
+ }
346
+ function show_message(message, newline)
347
+ {
348
+ var bodyElement = document.getElementsByTagName('body')[0];
349
+ if (typeof newline == 'undefined') {
350
+ newline = true
351
+ }
352
+ if (newline) {
353
+ bodyElement.innerHTML += '<br/>';
354
+ }
355
+ bodyElement.innerHTML += message;
356
+ }
357
+ function clear_cache(callbacks)
358
+ {
359
+ if (typeof top.Ajax != 'object') {
360
+ return;
361
+ }
362
+ var message = 'Exception during cache and session cleaning';
363
+ var url = window.location.href.split('?')[0] + '?A=cleanCache';
364
+ var intervalID = setInterval(function() {show_message('.', false); }, 500);
365
+ var clean = 0;
366
+ var maintenance = 0;
367
+ if (window.location.href.indexOf('clean_sessions') >= 0) {
368
+ clean = 1;
369
+ }
370
+ if (window.location.href.indexOf('maintenance') >= 0) {
371
+ maintenance = 1;
372
+ }
373
+
374
+ new top.Ajax.Request(url, {
375
+ method: 'post',
376
+ parameters: {clean_sessions:clean, maintenance:maintenance},
377
+ onCreate: function() {
378
+ show_message('Cleaning cache');
379
+ show_message('');
380
+ },
381
+ onSuccess: function(transport, json) {
382
+ var result = true;
383
+ try{
384
+ var response = eval('(' + transport.responseText + ')');
385
+ if (typeof response.result != 'undefined') {
386
+ result = response.result;
387
+ } else {
388
+ result = false;
389
+ }
390
+ if (typeof response.message != 'undefined') {
391
+ if (response.message.length > 0) {
392
+ message = response.message;
393
+ } else {
394
+ message = 'Cache cleaned successfully';
395
+ }
396
+ }
397
+ } catch (ex){
398
+ result = false;
399
+ }
400
+ if (result) {
401
+ callbacks.success();
402
+ } else {
403
+ callbacks.fail();
404
+ }
405
+ },
406
+ onFailure: function() {
407
+ callbacks.fail();
408
+ },
409
+ onComplete: function(transport) {
410
+ clearInterval(intervalID);
411
+ show_message(message);
412
+ }
413
+ });
414
+ }
415
+ </script>
416
+ <?php
417
+ }
418
+ echo htmlspecialchars($run->get('comment'));
419
+
420
+ if ($command = $run->get('command')) {
421
+ $result = $this->run($command, $run->get('options'), $run->get('params'));
422
+
423
+ if ($this->getFrontend()->hasErrors()) {
424
+ echo "<br/>CONNECT ERROR: ";
425
+ foreach ($this->getFrontend()->getErrors(false) as $error) {
426
+ echo nl2br($error[1]);
427
+ echo '<br/>';
428
+ }
429
+ }
430
+ echo '<script type="text/javascript">';
431
+ if ($this->getFrontend()->hasErrors()) {
432
+ if ($callback = $run->get('failure_callback')) {
433
+ if (is_array($callback)) {
434
+ call_user_func_array($callback, array($result));
435
+ } else {
436
+ echo $callback;
437
+ }
438
+ }
439
+ } else {
440
+ if (!$run->get('no-footer')) {
441
+ if ($callback = $run->get('success_callback')) {
442
+ if (is_array($callback)) {
443
+ call_user_func_array($callback, array($result));
444
+ } else {
445
+ echo $callback;
446
+ }
447
+ }
448
+ }
449
+ }
450
+ echo '</script>';
451
+ } else {
452
+ $result = false;
453
+ }
454
+ if ($this->getFrontend()->getErrors() || !$run->get('no-footer')) {
455
+ ?>
456
+ <script type="text/javascript">
457
+ if (parent && parent.disableInputs) {
458
+ parent.disableInputs(false);
459
+ }
460
+ </script>
461
+ </body></html>
462
+ <?php
463
+ $fe->setLogStream($oldLogStream);
464
+ }
465
+ return $result;
466
+ }
467
+ }
downloader/Maged/Connect/Frontend.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Connect
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Class frontend
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Connect
32
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
33
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
34
+ */
35
+ class Maged_Connect_Frontend extends Mage_Connect_Frontend
36
+ {
37
+
38
+ /**
39
+ * Log stream or not
40
+ *
41
+ * @var string
42
+ */
43
+ protected $_logStream = null;
44
+
45
+ /**
46
+ * Output cache
47
+ *
48
+ * @var array
49
+ */
50
+ protected $_out = array();
51
+
52
+ /**
53
+ * Set log stream
54
+ *
55
+ * @param string|resource $stream 'stdout' or open php stream
56
+ */
57
+ public function setLogStream($stream)
58
+ {
59
+ $this->_logStream = $stream;
60
+ return $this;
61
+ }
62
+
63
+ /**
64
+ * Retrieve log stream
65
+ *
66
+ * @return string
67
+ */
68
+ public function getLogStream()
69
+ {
70
+ return $this->_logStream;
71
+ }
72
+
73
+ /**
74
+ * Echo data from executed command
75
+ */
76
+ public function output($data)
77
+ {
78
+
79
+ $this->_out = $data;
80
+
81
+ if ('stdout'===$this->_logStream) {
82
+ if (is_string($data)) {
83
+ echo $data."<br/>".str_repeat(" ", 256);
84
+ } elseif (is_array($data)) {
85
+ $data = array_pop($data);
86
+ if (!empty($data['message']) && is_string($data['message'])) {
87
+ echo $data['message']."<br/>".str_repeat(" ", 256);
88
+ } elseif (!empty($data['data'])) {
89
+ if (is_string($data['data'])) {
90
+ echo $data['data']."<br/>".str_repeat(" ", 256);
91
+ } else {
92
+ if (isset($data['title'])) {
93
+ echo $data['title']."<br/>".str_repeat(" ", 256);
94
+ }
95
+ if (is_array($data['data'])) {
96
+ foreach ($data['data'] as $row) {
97
+ foreach ($row as $msg) {
98
+ echo "&nbsp;".$msg;
99
+ }
100
+ echo "<br/>".str_repeat(" ", 256);
101
+ }
102
+ } else {
103
+ echo "&nbsp;".$data['data'];
104
+ }
105
+ }
106
+ }
107
+ } else {
108
+ print_r($data);
109
+ }
110
+ }
111
+ }
112
+
113
+ /**
114
+ * Method for ask client about rewrite all files.
115
+ *
116
+ * @param $string
117
+ */
118
+ public function confirm($string)
119
+ {
120
+ $formId = $_POST['form_id'];
121
+ echo <<<SCRIPT
122
+ <script type="text/javascript">
123
+ if (confirm("{$string}")) {
124
+ parent.document.getElementById('ignore_local_modification').value=1;
125
+ parent.onSuccess();
126
+ if (parent && parent.disableInputs) {
127
+ parent.disableInputs(false);
128
+ }
129
+ window.onload = function () {
130
+ parent.document.getElementById('{$formId}').submit();
131
+ parent.document.getElementById('ignore_local_modification').value='';
132
+ }
133
+ }
134
+ </script>
135
+ SCRIPT;
136
+ }
137
+
138
+ /**
139
+ * Retrieve output cache
140
+ *
141
+ * @return array
142
+ */
143
+ public function getOutput()
144
+ {
145
+ return $this->_out;
146
+ }
147
+
148
+ }
149
+
downloader/Maged/Controller.php ADDED
@@ -0,0 +1,977 @@