Changeset 6181 for extensions/autoupdate/trunk/include
- Timestamp:
- May 15, 2010, 2:03:52 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/autoupdate/trunk/include/functions.inc.php
r6167 r6181 181 181 } 182 182 183 function upgrade_to($upgrade_to, &$step) 183 function autoupdate_save_template_dir() 184 { 185 global $page, $conf; 186 187 $path = $conf['local_data_dir'].'/autoupdate'; 188 189 if (@mkgetdir($path) 190 and ($zip = tempnam($path, 'zip')) 191 and ($archive = new pclZip($zip)) 192 and ($v_list = $archive->add(PHPWG_ROOT_PATH.'template', PCLZIP_OPT_REMOVE_PATH, PHPWG_ROOT_PATH)) 193 and is_array($v_list) 194 and !empty($v_list)) 195 { 196 $http_headers = array( 197 'Content-Length: '.@filesize($zip), 198 'Content-Type: application/zip', 199 'Content-Disposition: attachment; filename="template.zip";', 200 'Content-Transfer-Encoding: binary', 201 ); 202 203 foreach ($http_headers as $header) { 204 header($header); 205 } 206 207 @readfile($zip); 208 autoupdate_deltree($conf['local_data_dir'].'/autoupdate'); 209 exit(); 210 } 211 else 212 { 213 array_push($page['errors'], l10n('Unable to send template directory.')); 214 } 215 } 216 217 function autoupdate_dump_database() 218 { 219 global $page, $conf, $cfgBase; 220 221 if (version_compare(PHPWG_VERSION, '2.1', '<')) 222 { 223 $conf['db_base'] = $cfgBase; 224 } 225 226 include(AUTOUPDATE_PATH.'include/mysqldump.php'); 227 228 $path = $conf['local_data_dir'].'/autoupdate'; 229 230 if (@mkgetdir($path) 231 and ($backupFile = tempnam($path, 'sql')) 232 and ($dumper = new MySQLDump($conf['db_base'],$backupFile,false,false))) 233 { 234 foreach (get_defined_constants() as $constant => $value) 235 { 236 if (preg_match('/_TABLE$/', $constant)) 237 { 238 $dumper->getTableStructure($value); 239 240 if ($constant == 'HISTORY_TABLE' and !isset($_POST['includeHistory'])) 241 { 242 continue; 243 } 244 245 $dumper->getTableData($value); 246 } 247 } 248 } 249 250 if (@filesize($backupFile)) 251 { 252 $http_headers = array( 253 'Content-Length: '.@filesize($backupFile), 254 'Content-Type: text/x-sql', 255 'Content-Disposition: attachment; filename="database.sql";', 256 'Content-Transfer-Encoding: binary', 257 ); 258 259 foreach ($http_headers as $header) { 260 header($header); 261 } 262 263 @readfile($backupFile); 264 autoupdate_deltree($conf['local_data_dir'].'/autoupdate'); 265 exit(); 266 } 267 else 268 { 269 array_push($page['errors'], l10n('Unable to dump database.')); 270 } 271 } 272 273 function autoupdate_upgrade_to($upgrade_to, &$step) 184 274 { 185 275 global $page, $conf, $template;
Note: See TracChangeset
for help on using the changeset viewer.