Changeset 23821 for trunk/admin/include/updates.class.php
- Timestamp:
- Jul 7, 2013, 1:28:12 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/updates.class.php
r16179 r23821 34 34 } 35 35 36 function check_piwigo_upgrade()36 static function check_piwigo_upgrade() 37 37 { 38 38 $_SESSION['need_update'] = null; … … 243 243 } 244 244 245 function deltree($path, $move_to_trash=false) 246 { 247 if (is_dir($path)) 248 { 249 $fh = opendir($path); 250 while ($file = readdir($fh)) 251 { 252 if ($file != '.' and $file != '..') 253 { 254 $pathfile = $path . '/' . $file; 255 if (is_dir($pathfile)) 256 { 257 self::deltree($pathfile, $move_to_trash); 258 } 259 else 260 { 261 @unlink($pathfile); 262 } 263 } 264 } 265 closedir($fh); 266 if (@rmdir($path)) 267 { 268 return true; 269 } 270 elseif ($move_to_trash) 271 { 272 $trash = PHPWG_ROOT_PATH.'_trash'; 273 if (!is_dir($trash)) 274 { 275 @mkgetdir($trash); 276 } 277 return @rename($path, $trash . '/'.md5(uniqid(rand(), true))); 278 } 279 else 280 { 281 return false; 282 } 283 } 284 } 285 286 function process_obsolete_list($file) 245 static function process_obsolete_list($file) 287 246 { 288 247 if (file_exists(PHPWG_ROOT_PATH.$file) … … 300 259 elseif (is_dir($path)) 301 260 { 302 self::deltree($path, true);303 } 304 } 305 } 306 } 307 308 function dump_database($include_history=false)261 deltree($path, PHPWG_ROOT_PATH.'_trash'); 262 } 263 } 264 } 265 } 266 267 static function dump_database($include_history=false) 309 268 { 310 269 global $page, $conf, $cfgBase; … … 351 310 352 311 @readfile($backupFile); 353 self::deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update');312 deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update'); 354 313 exit(); 355 314 } … … 360 319 } 361 320 362 function upgrade_to($upgrade_to, &$step, $check_current_version=true)321 static function upgrade_to($upgrade_to, &$step, $check_current_version=true) 363 322 { 364 323 global $page, $conf, $template; … … 450 409 { 451 410 self::process_obsolete_list($obsolete_list); 452 self::deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update');411 deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update'); 453 412 invalidate_user_cache(true); 454 413 $template->delete_compiled_templates(); … … 478 437 else 479 438 { 480 self::deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update');439 deltree(PHPWG_ROOT_PATH.$conf['data_location'].'update'); 481 440 array_push($page['errors'], l10n('An error has occured during upgrade.')); 482 441 }
Note: See TracChangeset
for help on using the changeset viewer.