Changeset 3312938
- Timestamp:
- 06/17/2025 06:56:19 AM (10 months ago)
- Location:
- xcloner-backup-and-restore/trunk
- Files:
-
- 7 edited
-
CHANGELOG.txt (modified) (1 diff)
-
admin/partials/xcloner_restore_page.php (modified) (1 diff)
-
lib/Xcloner_Restore.php (modified) (7 diffs)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/composer/InstalledVersions.php (modified) (5 diffs)
-
vendor/composer/installed.php (modified) (2 diffs)
-
xcloner.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
xcloner-backup-and-restore/trunk/CHANGELOG.txt
r3195000 r3312938 1 = 4.7.8 = 2 * https://github.com/watchfulli/XCloner-Wordpress/issues/322 3 * https://github.com/watchfulli/XCloner-Wordpress/issues/329 4 5 = 4.7.7 = 6 * Update "tested up to" version 7 1 8 = 4.7.6 = 2 9 * Update "tested up to" version -
xcloner-backup-and-restore/trunk/admin/partials/xcloner_restore_page.php
r2820379 r3312938 238 238 data-tooltip="<?php echo __('Restore the database-sql.sql mysql backup from the xcloner-xxxxx/ folder', 'xcloner-backup-and-restore') ?>"> 239 239 <input class="with-gap" name="filter_files" type="radio" id="filter_files_database" 240 value=" /^xcloner-(.*)\/(.*)\.sql/"/>240 value="#^xcloner-(.*)/(.*).sql#"/> 241 241 <span> 242 242 <?php echo __("Only Database Backup", "xcloner-backup-and-restore") ?> -
xcloner-backup-and-restore/trunk/lib/Xcloner_Restore.php
r2843536 r3312938 217 217 218 218 $mysqli = $this->xcloner_container->get_xcloner_database(); 219 $this->set_foreign_key_checks($mysqli, false); 219 220 220 221 $line_count = 0; … … 246 247 } 247 248 248 //exclude usermeta info for local restores to fix potential session logout 249 if (strpos($line, "_usermeta`") !== false) { 250 $line = str_replace("_usermeta`", "_usermeta2`", $line); 251 } 249 $prefix = $mysqli->prefix; 250 $tables_to_update = ['usermeta', 'users', 'options']; 251 252 foreach ($tables_to_update as $table) { 253 $search = "`$prefix$table`"; 254 $replace = "`$prefix{$table}_new`"; 255 256 if (strpos($line, $search) !== false) { 257 $line = str_replace($search, $replace, $line); 258 } 259 } 260 261 if (stripos($line, 'INSERT INTO') !== false) { 262 $line = preg_replace('/INSERT\s+INTO/i', 'INSERT IGNORE INTO', $line); 263 } 252 264 253 265 $query .= $line; … … 261 273 } 262 274 263 if ( !$mysqli->query($query)&& !stristr($mysqli->error, "Duplicate entry")) {275 if ($mysqli->query($query) === false && !stristr($mysqli->error, "Duplicate entry")) { 264 276 //$return['error_line'] = $line_count; 265 277 $return['start'] = ftell($fp) - strlen($line); … … 288 300 } else { 289 301 $this->logger->info('Mysql Import Done.'); 302 $this->set_foreign_key_checks($mysqli, true); 290 303 } 291 304 … … 318 331 319 332 $wpdb->select($wpdb->dbname); 320 321 333 $wpdb->hide_errors(); 322 if ($result = $wpdb->get_var("SELECT count(*) FROM " . $wpdb->prefix . "usermeta2")) { 323 if ($result > 0) { 324 $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "usermeta_backup"); 325 $wpdb->query("ALTER TABLE " . $wpdb->prefix . "usermeta RENAME TO " . $wpdb->prefix . "usermeta_backup"); 326 $wpdb->query("ALTER TABLE " . $wpdb->prefix . "usermeta2 RENAME TO " . $wpdb->prefix . "usermeta"); 327 } 328 } 334 335 foreach ( [ 'usermeta', 'users', 'options' ] as $table ) { 336 $this->replace_table_with_new_version( $wpdb, $table ); 337 } 329 338 330 339 $return = "Restore Process Finished."; 331 340 $this->send_response(200, $return); 332 341 } 342 343 private function replace_table_with_new_version( $mysqli, $table_name ) { 344 $prefix = $mysqli->prefix; 345 346 $count = $mysqli->get_var( "SELECT count(*) FROM `$prefix{$table_name}_new`" ); 347 if ( $count <= 0 ) { 348 return; 349 } 350 351 $mysqli->query( "DROP TABLE IF EXISTS `$prefix{$table_name}_backup`" ); 352 $mysqli->query( "ALTER TABLE `$prefix$table_name` RENAME TO `$prefix{$table_name}_backup`" ); 353 $mysqli->query( "ALTER TABLE `$prefix{$table_name}_new` RENAME TO `$prefix$table_name`" ); 354 } 333 355 334 356 /** … … 507 529 $include_filter_files = $this->xcloner_sanitization->sanitize_input_as_string($_POST['filter_files']); 508 530 $exclude_filter_files = ""; 509 $start = $this->xcloner_sanitization->sanitize_input_as_int($_POST['start'] );510 $return['part'] = (int)$this->xcloner_sanitization->sanitize_input_as_int($_POST['part'] );511 $return['processed'] = (int)$this->xcloner_sanitization->sanitize_input_as_int($_POST['processed'] );531 $start = $this->xcloner_sanitization->sanitize_input_as_int($_POST['start'] ?? 0); 532 $return['part'] = (int)$this->xcloner_sanitization->sanitize_input_as_int($_POST['part'] ?? 0); 533 $return['processed'] = (int)$this->xcloner_sanitization->sanitize_input_as_int($_POST['processed'] ?? 0); 512 534 $this->target_adapter = new Local($this->site_path, LOCK_EX, 'SKIP_LINKS'); 513 535 $this->target_filesystem = new Filesystem($this->target_adapter, new Config([ … … 778 800 die(json_encode($return)); 779 801 } 802 803 private function set_foreign_key_checks( Xcloner_Database $mysqli, bool $enable ) { 804 $status = (int) $enable; 805 $mysqli->query( "SET FOREIGN_KEY_CHECKS=$status;" ); 806 } 780 807 } -
xcloner-backup-and-restore/trunk/vendor/autoload.php
r3118643 r3312938 18 18 } 19 19 } 20 trigger_error( 21 $err, 22 E_USER_ERROR 23 ); 20 throw new RuntimeException($err); 24 21 } 25 22 -
xcloner-backup-and-restore/trunk/vendor/composer/InstalledVersions.php
r3118643 r3312938 31 31 { 32 32 /** 33 * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to 34 * @internal 35 */ 36 private static $selfDir = null; 37 38 /** 33 39 * @var mixed[]|null 34 40 * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null 35 41 */ 36 42 private static $installed; 43 44 /** 45 * @var bool 46 */ 47 private static $installedIsLocalDir; 37 48 38 49 /** … … 313 324 self::$installed = $data; 314 325 self::$installedByVendor = array(); 326 327 // when using reload, we disable the duplicate protection to ensure that self::$installed data is 328 // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not, 329 // so we have to assume it does not, and that may result in duplicate data being returned when listing 330 // all installed packages for example 331 self::$installedIsLocalDir = false; 332 } 333 334 /** 335 * @return string 336 */ 337 private static function getSelfDir() 338 { 339 if (self::$selfDir === null) { 340 self::$selfDir = strtr(__DIR__, '\\', '/'); 341 } 342 343 return self::$selfDir; 315 344 } 316 345 … … 326 355 327 356 $installed = array(); 357 $copiedLocalDir = false; 328 358 329 359 if (self::$canGetVendors) { 360 $selfDir = self::getSelfDir(); 330 361 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 362 $vendorDir = strtr($vendorDir, '\\', '/'); 331 363 if (isset(self::$installedByVendor[$vendorDir])) { 332 364 $installed[] = self::$installedByVendor[$vendorDir]; … … 334 366 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 335 367 $required = require $vendorDir.'/composer/installed.php'; 336 $installed[] = self::$installedByVendor[$vendorDir] = $required; 337 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 338 self::$installed = $installed[count($installed) - 1]; 368 self::$installedByVendor[$vendorDir] = $required; 369 $installed[] = $required; 370 if (self::$installed === null && $vendorDir.'/composer' === $selfDir) { 371 self::$installed = $required; 372 self::$installedIsLocalDir = true; 339 373 } 374 } 375 if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { 376 $copiedLocalDir = true; 340 377 } 341 378 } … … 354 391 } 355 392 356 if (self::$installed !== array() ) {393 if (self::$installed !== array() && !$copiedLocalDir) { 357 394 $installed[] = self::$installed; 358 395 } -
xcloner-backup-and-restore/trunk/vendor/composer/installed.php
r3195000 r3312938 5 5 'root' => array( 6 6 'name' => 'watchfulli/xcloner-wordpress', 7 'pretty_version' => 'v4.7. 7',8 'version' => '4.7. 7.0',9 'reference' => ' 4636a06b674a88dab301be6fd7f9aca7e20d7cd3',7 'pretty_version' => 'v4.7.8', 8 'version' => '4.7.8.0', 9 'reference' => 'a3f1c4d1953012d7c89400e70a50c19f33df0858', 10 10 'type' => 'library', 11 11 'install_path' => __DIR__ . '/../../', … … 498 498 ), 499 499 'watchfulli/xcloner-wordpress' => array( 500 'pretty_version' => 'v4.7. 7',501 'version' => '4.7. 7.0',502 'reference' => ' 4636a06b674a88dab301be6fd7f9aca7e20d7cd3',500 'pretty_version' => 'v4.7.8', 501 'version' => '4.7.8.0', 502 'reference' => 'a3f1c4d1953012d7c89400e70a50c19f33df0858', 503 503 'type' => 'library', 504 504 'install_path' => __DIR__ . '/../../', -
xcloner-backup-and-restore/trunk/xcloner.php
r3195000 r3312938 16 16 * Plugin URI: https://xcloner.com/ 17 17 * Description: XCloner is a tool that will help you manage your website backups, generate/restore/move so your website will be always secured! With XCloner you will be able to clone your site to any other location with just a few clicks, as well as transfer the backup archives to remote FTP, SFTP, DropBox, Amazon S3, Google Drive, WebDAV, Backblaze, Azure accounts. 18 * Version: 4.7. 718 * Version: 4.7.8 19 19 * Author: watchful 20 20 * Author URI: https://watchful.net/
Note: See TracChangeset
for help on using the changeset viewer.