Changeset 2781798
- Timestamp:
- 09/08/2022 08:13:25 AM (4 years ago)
- Location:
- pcloud-wp-backup
- Files:
-
- 26 added
- 10 edited
-
tags/1.0.3 (added)
-
tags/1.0.3/assets (added)
-
tags/1.0.3/assets/css (added)
-
tags/1.0.3/assets/css/wpb2pcloud.css (added)
-
tags/1.0.3/assets/img (added)
-
tags/1.0.3/assets/img/logo-pcloud.png (added)
-
tags/1.0.3/assets/img/logo_16.png (added)
-
tags/1.0.3/assets/img/zip.png (added)
-
tags/1.0.3/assets/js (added)
-
tags/1.0.3/assets/js/wp2pcl.js (added)
-
tags/1.0.3/assets/translate.json (added)
-
tags/1.0.3/classes (added)
-
tags/1.0.3/classes/class-pcl-mysqldump.php (added)
-
tags/1.0.3/classes/class-pcl-type-adapter-mysql.php (added)
-
tags/1.0.3/classes/class-wp2pclouddbbackup.php (added)
-
tags/1.0.3/classes/class-wp2pclouddebugger.php (added)
-
tags/1.0.3/classes/class-wp2pcloudfilebackup.php (added)
-
tags/1.0.3/classes/class-wp2pcloudfilerestore.php (added)
-
tags/1.0.3/classes/class-wp2pcloudfuncs.php (added)
-
tags/1.0.3/classes/class-wp2pcloudlogger.php (added)
-
tags/1.0.3/pcloud-wp-backup.php (added)
-
tags/1.0.3/readme.txt (added)
-
tags/1.0.3/tmp (added)
-
tags/1.0.3/views (added)
-
tags/1.0.3/views/wp2pcl-config.php (added)
-
trunk/assets/css/wpb2pcloud.css (modified) (1 diff)
-
trunk/assets/js/wp2pcl.js (modified) (5 diffs)
-
trunk/classes/class-pcl-mysqldump.php (modified) (10 diffs)
-
trunk/classes/class-wp2pclouddebugger.php (modified) (3 diffs)
-
trunk/classes/class-wp2pcloudfilebackup.php (modified) (15 diffs)
-
trunk/classes/class-wp2pcloudfilerestore.php (modified) (4 diffs)
-
trunk/classes/class-wp2pcloudfuncs.php (modified) (1 diff)
-
trunk/pcloud-wp-backup.php (modified) (21 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/tmp (added)
-
trunk/views/wp2pcl-config.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pcloud-wp-backup/trunk/assets/css/wpb2pcloud.css
r2732482 r2781798 121 121 } 122 122 123 #setting-error-settings_updated { 123 #setting-error-settings_updated, 124 #setting-error-mysql-settings_updated { 124 125 display: none; 125 126 margin: 0 0 10px; -
pcloud-wp-backup/trunk/assets/js/wp2pcl.js
r2732482 r2781798 137 137 ); 138 138 } 139 140 /** 141 * SET INCLUDE DATABASE IN THE BACKUP -> 142 * SET INCLUDE DATABASE IN THE BACKUP -> 143 */ 144 $( '#wp2pcl_withmysql' ).on( 145 'change', 146 function ( e ) { 147 e.preventDefault(); 148 $( '#setting-error-mysql-settings_updated' ).show(); 149 $.post( 150 ajax_url + '&method=set_with_mysql', 151 $( '#wp2_incl_db_form' ).serialize(), 152 function () { 153 $.get( 'admin.php' ); 154 }, 155 'JSON' 156 ); 157 } 158 ); 139 159 140 160 /** … … 264 284 let backupLogWin = $( '.log_show' ); 265 285 266 function pclCheckActivity( )286 function pclCheckActivity( recheck ) 267 287 { 268 288 $.ajax( … … 397 417 ).always( 398 418 function () { 399 window.setTimeout( 400 function () { 401 pclCheckActivity(); 402 }, 403 log_reader_timer 404 ); 419 if ( typeof recheck !== "undefined" && recheck ) { 420 window.setTimeout( 421 function () { 422 pclCheckActivity( true ); 423 }, 424 log_reader_timer 425 ); 426 } 405 427 } 406 428 ); … … 408 430 } 409 431 410 pclCheckActivity( );432 pclCheckActivity( true ); 411 433 412 434 /** … … 441 463 wp2pcl_debugmode = true; 442 464 btn.css( 'color', '#333' ); 465 pclCheckActivity(); 443 466 backupLogWin.show(); 444 467 } -
pcloud-wp-backup/trunk/classes/class-pcl-mysqldump.php
r2731122 r2781798 25 25 * File handler 26 26 * 27 * @var null $file_handler27 * @var null|resource $file_handler 28 28 */ 29 29 private $file_handler = null; … … 218 218 219 219 $pdo_settings_default = array( 220 PDO::ATTR_PERSISTENT => true, 221 PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, 220 PDO::ATTR_PERSISTENT => true, // phpcs:ignore 221 PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, // phpcs:ignore 222 222 ); 223 223 … … 228 228 // This drops MYSQL dependency, only use the constant if it's defined. 229 229 if ( 'mysql' === $this->db_type ) { 230 $pdo_settings_default[ PDO::MYSQL_ATTR_USE_BUFFERED_QUERY ] = false; 230 $pdo_settings_default[ PDO::MYSQL_ATTR_USE_BUFFERED_QUERY ] = false; // phpcs:ignore 231 231 } 232 232 … … 351 351 352 352 try { 353 $this->db_handler = new PDO( 353 $this->db_handler = new PDO( // phpcs:ignore 354 354 $this->dsn, 355 355 $this->user, … … 368 368 } 369 369 370 $this->db_handler->setAttribute( PDO::ATTR_ORACLE_NULLS, PDO::NULL_NATURAL ); 370 $this->db_handler->setAttribute( PDO::ATTR_ORACLE_NULLS, PDO::NULL_NATURAL ); // phpcs:ignore 371 371 $this->type_adapter = Pcl_Type_Adapter_Mysql::create( $this->db_handler, $this->dump_settings ); 372 372 } … … 713 713 $this->type_adapter->show_columns( $table_name ) 714 714 ); 715 $columns->setFetchMode( PDO::FETCH_ASSOC ); 715 $columns->setFetchMode( PDO::FETCH_ASSOC ); // phpcs:ignore 716 716 717 717 foreach ( $columns as $col ) { … … 952 952 953 953 $result_set = $this->db_handler->query( $stmt ); 954 $result_set->setFetchMode( PDO::FETCH_ASSOC ); 954 $result_set->setFetchMode( PDO::FETCH_ASSOC ); // phpcs:ignore 955 955 956 956 $ignore = $this->dump_settings['insert-ignore'] ? ' IGNORE' : ''; … … 1124 1124 */ 1125 1125 public function compress_open( $file_name ) { 1126 $this->file_handler = fopen( $file_name, 'wb' ); 1126 $this->file_handler = fopen( $file_name, 'wb' ); // phpcs:ignore 1127 1127 if ( false === $this->file_handler ) { 1128 1128 throw new Exception( 'Output file is not writable' ); … … 1140 1140 */ 1141 1141 public function compress_write( $str ) { 1142 $bytes_written = fwrite( $this->file_handler, $str ); 1143 if ( false === $bytes_written ) { 1144 throw new Exception( 'Writting to file failed! Probably, there is no more free space left?' ); 1145 } 1146 1147 return $bytes_written; 1142 1143 if ( ! is_null( $this->file_handler ) ) { 1144 1145 $bytes_written = fwrite( $this->file_handler, $str ); // phpcs:ignore 1146 if ( false === $bytes_written ) { 1147 throw new Exception( 'Writting to file failed! Probably, there is no more free space left?' ); 1148 } 1149 1150 return $bytes_written; 1151 } else { 1152 return 0; 1153 } 1148 1154 } 1149 1155 … … 1154 1160 */ 1155 1161 public function compress_close() { 1156 return fclose( $this->file_handler ); 1162 if ( ! is_null( $this->file_handler ) ) { 1163 return fclose( $this->file_handler ); // phpcs:ignore 1164 } else { 1165 return false; 1166 } 1157 1167 } 1158 1168 } -
pcloud-wp-backup/trunk/classes/class-wp2pclouddebugger.php
r2732482 r2781798 57 57 58 58 $current_data = WP2pCloudFuncs::get_storred_val( PCLOUD_DBG_LOG ); 59 $mem_usage = WP2pCloudFuncs::memory_usage(); 59 60 60 61 if ( 'uploading' === $new_data ) { … … 64 65 } 65 66 } else { 66 $current_data .= '<br/>' . gmdate( 'Y-m-d H:i:s' ) . ' - ' . $new_data;67 $current_data .= '<br/>' . gmdate( 'Y-m-d H:i:s' ) . ' [' . $mem_usage . '] - ' . $new_data; 67 68 } 68 69 … … 70 71 71 72 } 72 73 /**74 * Clear log method, clears the log data75 *76 * @return void77 */78 public static function clear_log() {79 WP2pCloudFuncs::set_storred_val( PCLOUD_DBG_LOG, '' );80 }81 73 } -
pcloud-wp-backup/trunk/classes/class-wp2pcloudfilebackup.php
r2732482 r2781798 61 61 public function __construct( $base_dir ) { 62 62 63 $this->sql_backup_file = false;63 $this->sql_backup_file = ''; 64 64 $this->base_dir = $base_dir; 65 65 $this->authkey = WP2pCloudFuncs::get_storred_val( PCLOUD_AUTH_KEY ); … … 127 127 128 128 $this->clear_all_tmp_files(); 129 129 130 WP2pCloudDebugger::log( 'All temporary files - cleared!' ); 130 131 131 132 $rootdir = rtrim( ABSPATH, '/' ); 132 133 133 $dirs = self::find_all_files( $rootdir ); 134 WP2pCloudDebugger::log( 'All files collected and ready to be compressed!' ); 135 WP2pCloudDebugger::log( 'Start creating ZIP archive!' ); 136 137 $this->create_zip( $dirs, $backup_file_name ); 138 139 WP2pCloudDebugger::log( 'ZIP archive - READY!' ); 134 WP2pCloudDebugger::log( 'Creating a list of files to be compressed!' ); 135 136 $files = self::find_all_files( $rootdir ); 137 138 WP2pCloudDebugger::log( 'The List of all files is ready and will be sent for compression!' ); 139 140 $php_extensions = get_loaded_extensions(); 141 $has_archive_ext_installed = array_search( 'zip', $php_extensions, true ); 142 143 if ( $has_archive_ext_installed ) { 144 145 WP2pCloudDebugger::log( 'Start creating ZIP archive!' ); 146 147 for ( $try = 0; $try < 2; $try++ ) { 148 149 WP2pCloudDebugger::log( 'Attempt [ ' . ( $try + 1 ) . ' ] to create the ZIP archive!' ); 150 151 $zipping_successfull = $this->create_zip( $files, $backup_file_name ); 152 if ( $zipping_successfull ) { 153 break; 154 } 155 } 156 157 if ( ! $zipping_successfull ) { 158 159 WP2pCloudFuncs::set_operation( array() ); 160 161 WP2pCloudLogger::info( '<span>ERROR: Failed to create backup ZIP file !</span>' ); 162 WP2pCloudDebugger::log( 'Failed to create valid ZIP archive after all 5 tries!' ); 163 164 } else { 165 166 sleep( 3 ); 167 168 try { 169 170 WP2pCloudDebugger::log( 'Archive seems ready, trying to validate it!' ); 171 172 $this->validate_zip_archive( $backup_file_name ); 173 174 WP2pCloudDebugger::log( 'Zip Archive - seems valid!' ); 175 176 } catch ( Exception $e ) { 177 178 WP2pCloudLogger::info( '<span>ERROR: Backup archive not valid!</span>' ); 179 WP2pCloudDebugger::log( 'Invalid backup file detected, error: ' . $e->getMessage() . ' file: ' . $backup_file_name ); 180 181 WP2pCloudFuncs::set_operation( array() ); 182 183 exit(); 184 } 185 } 186 } else { 187 188 WP2pCloudLogger::info( "<span class='pcl_transl' data-i10nk='err_backup_arch_no_file'>ERROR: Backup archive file don't exist!</span>" ); 189 WP2pCloudDebugger::log( 'Backup file does not exist! PHP Zip extension is missing!' ); 190 191 WP2pCloudFuncs::set_operation( array() ); 192 193 exit(); 194 } 195 196 WP2pCloudDebugger::log( 'Archiving process - COMPLETED!' ); 140 197 141 198 WP2pCloudLogger::info( "<span class='pcl_transl' data-i10nk='zip_file_created'>Zip file is created! Uploading to pCloud</span>" ); … … 154 211 155 212 if ( ! file_exists( $backup_file_name ) ) { 213 156 214 WP2pCloudLogger::info( "<span class='pcl_transl' data-i10nk='err_backup_arch_no_file'>ERROR: Backup archive file don't exist!</span>" ); 157 WP2pCloudDebugger::log( 'Backup file does not exist!' ); 215 WP2pCloudDebugger::log( 'Backup file does not exist, quiting... !' ); 216 217 WP2pCloudFuncs::set_operation( array() ); 218 158 219 } else { 159 220 … … 238 299 * @param string $backup_file_name Backup file name. 239 300 * 240 * @return void301 * @return bool 241 302 */ 242 303 private function create_zip( $files, $backup_file_name ) { … … 245 306 246 307 $zip = new ZipArchive(); 247 $zip->open( $backup_file_name, ZIPARCHIVE::CREATE ); 248 WP2pCloudDebugger::log( 'ZIP state - open' ); 249 $zip->setArchiveComment( 'Wordpress2pCloud' ); 250 251 foreach ( $files as $el ) { 252 $zip->addFile( $el, str_replace( ABSPATH, '', $el ) ); 253 } 254 255 WP2pCloudDebugger::log( 'ZIP files added' ); 256 257 if ( false !== $this->sql_backup_file ) { 258 $zip->addFile( $this->sql_backup_file, 'backup.sql' ); 259 } 260 261 WP2pCloudDebugger::log( 'ZIP DB file - added' ); 308 if ( true !== $zip->open( $backup_file_name, ZIPARCHIVE::CREATE ) ) { 309 310 $zip->close(); 311 $zip = null; 312 313 WP2pCloudDebugger::log( 'ZIP state - failed to create the ZIP file, leaving ...!' ); 314 315 return false; 316 } 317 318 WP2pCloudDebugger::log( 'ZIP state - opened!' ); 319 320 $zip->setArchiveComment( 'Wordpress2pCloud-' . gmdate( 'd.m.Y H:i:s' ) ); 321 322 foreach ( $files as $file ) { 323 if ( file_exists( $file ) && is_readable( $file ) ) { 324 $zip->addFile( $file, str_replace( ABSPATH, '', $file ) ); 325 } 326 } 327 328 WP2pCloudDebugger::log( 'ZIP entries added [ ' . count( $files ) . ' ] ' ); 329 330 if ( ! empty( $this->sql_backup_file ) ) { 331 if ( file_exists( $this->sql_backup_file ) && is_readable( $this->sql_backup_file ) ) { 332 $zip->addFile( $this->sql_backup_file, 'backup.sql' ); 333 WP2pCloudDebugger::log( 'ZIP DB file - added!' ); 334 } 335 } 336 337 WP2pCloudDebugger::log( 'ZIP archive - filling-up and closing ' ); 262 338 263 339 if ( $zip->close() ) { 264 340 265 $size = $this->format_bytes( filesize( $backup_file_name ) );266 267 WP2pCloudLogger::info( "<span class='pcl_transl' data-i10nk='backup_file_size'>Backup file size:</span> ( " . $size . ')');341 $size = WP2pCloudFuncs::format_bytes( filesize( $backup_file_name ) ); 342 343 WP2pCloudLogger::info( "<span class='pcl_transl' data-i10nk='backup_file_size'>Backup file size:</span> ( $size )" ); 268 344 WP2pCloudDebugger::log( 'ZIP File successfully closed! [ ' . $size . ' ]' ); 269 345 270 } else { 271 272 $status = $zip->getStatusString(); 273 274 WP2pCloudLogger::info( "<span class='pcl_transl' data-i10nk='err_failed2zip'>Error: failed to create zip archive [ '. $status . ' ]</span>" ); 275 WP2pCloudFuncs::set_operation( array() ); 276 277 WP2pCloudDebugger::log( '--------- |||| -------- Failed to create ZIP file: ' . $status ); 278 279 exit(); 280 } 281 346 $zip = null; 347 348 return true; 349 350 } else { 351 352 WP2pCloudLogger::info( "<span class='pcl_transl' data-i10nk='err_failed2zip'>Error: failed to create zip archive!</span>" ); 353 WP2pCloudDebugger::log( '--------- |||| -------- Failed to create ZIP file!' ); 354 355 $zip = null; 356 } 357 358 return false; 282 359 } 283 360 … … 388 465 public function upload_chunk( $path, $folder_id = 0, $upload_id = 0, $uploadoffset = 0, $num_failures = 0 ) { 389 466 467 $filesize = abs( filesize( $path ) ); 468 469 $this->set_chunk_size( $filesize ); 470 390 471 if ( ! file_exists( $path ) || ! is_file( $path ) || ! is_readable( $path ) ) { 391 472 WP2pCloudLogger::info( "<span class='pcl_transl' data-i10nk='invalid_file_provided'>Invalid file provided!</span>" ); … … 394 475 } 395 476 396 $filesize = abs( filesize( $path ) );397 398 477 if ( $uploadoffset > $filesize ) { 399 478 WP2pCloudLogger::info( "<span class='pcl_transl' data-i10nk='wp_all_done'>All Done!</span>" ); … … 408 487 409 488 // Complicated file operations, currently not supported by: WP_Filesystem. 410 $file = fopen( $path, 'r' ); 489 $file = fopen( $path, 'r' ); // phpcs:ignore 411 490 412 491 if ( $uploadoffset > 0 ) { 413 fseek( $file, $uploadoffset ); 414 } 415 $content = fread( $file, $this->part_size ); 492 fseek( $file, $uploadoffset ); // phpcs:ignore 493 } 494 $content = fread( $file, $this->part_size ); // phpcs:ignore 416 495 try { 417 496 if ( ! empty( $content ) ) { … … 436 515 } 437 516 } 438 fclose( $file ); 517 fclose( $file ); // phpcs:ignore 439 518 440 519 if ( $uploadoffset > $filesize ) { … … 451 530 } 452 531 } catch ( Exception $e ) { 453 fclose( $file ); 532 fclose( $file ); // phpcs:ignore 454 533 } 455 534 … … 478 557 } else { 479 558 $filesize = abs( filesize( $path ) ); 559 560 $this->set_chunk_size( $filesize ); 480 561 } 481 562 … … 495 576 $num_failures = 0; 496 577 497 $file = fopen( $path, 'r' ); 578 $file = fopen( $path, 'r' ); // phpcs:ignore 498 579 while ( ! feof( $file ) ) { 499 $content = fread( $file, $this->part_size ); 580 $content = fread( $file, $this->part_size ); // phpcs:ignore 500 581 do { 501 582 try { … … 542 623 } 543 624 544 fclose( $file ); 625 fclose( $file ); // phpcs:ignore 545 626 546 627 if ( $uploadoffset >= $filesize ) { … … 671 752 $err_message = trim( $response_json['error'] ); 672 753 } else { 673 WP2pCloudDebugger::log( 'write() - unexpected msg returned: ' . print_r( $response_json, true) );754 WP2pCloudDebugger::log( 'write() - unexpected msg returned: ' . wp_json_encode( $response_json ) ); 674 755 } 675 756 } … … 689 770 690 771 /** 691 * Format bytes to human-readable format 692 * 693 * @param string|int $bytes Bytes to be made more human-readable. 694 * 695 * @return string 696 */ 697 private function format_bytes( $bytes ) { 698 $size = array( 'B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ); 699 $factor = floor( ( strlen( $bytes ) - 1 ) / 3 ); 700 701 return sprintf( '%.2f', $bytes / pow( 1024, $factor ) ) . $size[ $factor ]; 772 * Validate the ZIP archive. 773 * 774 * @param string $file Filename to test. 775 * 776 * @return void 777 * @throws Exception Throws exception if issue is detected. 778 */ 779 private function validate_zip_archive( $file ) { 780 781 $zip = new ZipArchive(); 782 $open_archive = $zip->open( $file, ZIPARCHIVE::CHECKCONS ); 783 784 if ( is_bool( $open_archive ) && ! $open_archive ) { 785 786 if ( ! is_null( $zip ) ) { 787 $zip->close(); 788 } 789 $zip = null; 790 791 throw new Exception( 'error opening zip for validation!' ); 792 793 } elseif ( is_bool( $open_archive ) ) { 794 795 if ( ! is_null( $zip ) ) { 796 $zip->close(); 797 } 798 $zip = null; 799 } 800 801 switch ( $open_archive ) { 802 803 case ZipArchive::ER_MULTIDISK: 804 case ZipArchive::ER_OK: 805 break; 806 807 case ZipArchive::ER_NOZIP: 808 throw new Exception( 'not a zip archive' ); 809 case ZipArchive::ER_INCONS: 810 throw new Exception( 'zip archive inconsistent' ); 811 case ZipArchive::ER_CRC: 812 throw new Exception( 'checksum failed' ); 813 case ZipArchive::ER_INTERNAL: 814 throw new Exception( 'internal error' ); 815 case ZipArchive::ER_EOF: 816 throw new Exception( 'premature EOF' ); 817 case ZipArchive::ER_CHANGED: 818 throw new Exception( 'entry has been changed' ); 819 case ZipArchive::ER_MEMORY: 820 throw new Exception( 'memory allocation failure' ); 821 case ZipArchive::ER_ZLIB: 822 throw new Exception( 'zlib error' ); 823 case ZipArchive::ER_TMPOPEN: 824 throw new Exception( 'failure to create temporary file.' ); 825 case ZipArchive::ER_OPEN: 826 throw new Exception( 'can\'t open file' ); 827 case ZipArchive::ER_SEEK: 828 throw new Exception( 'seek error' ); 829 case ZipArchive::ER_NOENT: 830 throw new Exception( 'ZIP file not found!' ); 831 832 default: 833 throw new Exception( 'unknown error occured: ' . $open_archive ); 834 } 835 836 if ( ! is_null( $zip ) ) { 837 $zip->close(); 838 } 839 $zip = null; 840 } 841 842 /** 843 * Set chunk size, based on the archive size. 844 * 845 * @param int $filesize ZIP Archive file. 846 * @return void 847 */ 848 public function set_chunk_size( $filesize ) { 849 850 if ( ! is_numeric( $filesize ) ) { 851 return; 852 } 853 854 if ( $filesize > ( 100 * 1000 * 1000 ) ) { // If Archive size is higher than 100MB. 855 $this->part_size = 10 * 1000 * 1000; 856 } 702 857 } 703 858 } -
pcloud-wp-backup/trunk/classes/class-wp2pcloudfilerestore.php
r2732482 r2781798 77 77 } else { 78 78 79 $o_handle = fopen( $archive_file, 'ab' ); 79 $o_handle = fopen( $archive_file, 'ab' ); // phpcs:ignore 80 80 if ( ! $o_handle ) { 81 81 … … 85 85 return $offset; 86 86 } else { 87 fwrite( $o_handle, $content ); 88 } 89 90 fclose( $o_handle ); 87 fwrite( $o_handle, $content ); // phpcs:ignore 88 } 89 90 fclose( $o_handle ); // phpcs:ignore 91 91 92 92 $offset += $chunksize; … … 153 153 if ( ! is_file( $sql ) ) { 154 154 155 WP2pCloudLogger::info( "<span class='pcl_transl' data-i10nk='failed2restore_db'>Failed to restore Database, backup.sql not found in the archive!</span>" );156 155 WP2pCloudDebugger::log( 'restore->restore_db() - Failed to restore Database, backup.sql not found in the archive!' ); 157 156 return; … … 167 166 168 167 $dns = 'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=' . DB_CHARSET; 169 $db = new PDO( 168 $db = new PDO( // phpcs:ignore 170 169 $dns, 171 170 DB_USER, 172 171 DB_PASSWORD, 173 172 array( 174 PDO::ATTR_EMULATE_PREPARES => false, 175 PDO::ATTR_PERSISTENT => false, 176 PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, 177 PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, 173 PDO::ATTR_EMULATE_PREPARES => false, // phpcs:ignore 174 PDO::ATTR_PERSISTENT => false, // phpcs:ignore 175 PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, // phpcs:ignore 176 PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, // phpcs:ignore 178 177 ) 179 178 ); -
pcloud-wp-backup/trunk/classes/class-wp2pcloudfuncs.php
r2731122 r2781798 155 155 } 156 156 157 /** 158 * Format bytes to human-readable format 159 * 160 * @param string|int $bytes Bytes to be made more human-readable. 161 * 162 * @return string 163 */ 164 public static function format_bytes( $bytes ) { 165 $size = array( 'B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ); 166 $factor = floor( ( strlen( $bytes ) - 1 ) / 3 ); 167 168 return sprintf( '%.2f', $bytes / pow( 1024, $factor ) ) . $size[ $factor ]; 169 } 170 171 /** 172 * Get the current memory usage allocated to this PHP process and convert it to human-readable. 173 174 * @return string 175 */ 176 public static function memory_usage() { 177 178 $memlimitini = ini_get( 'memory_limit' ); 179 180 $mem = memory_get_usage(); 181 if ( $mem > 0 ) { 182 return 'mem: ' . self::format_bytes( $mem ) . '/' . $memlimitini; 183 } else { 184 return 'mem: --'; 185 } 186 } 157 187 } -
pcloud-wp-backup/trunk/pcloud-wp-backup.php
r2732482 r2781798 9 9 * Plugin URI: https://www.pcloud.com 10 10 * Summary: pCloud WP Backup plugin 11 * Description: pCloud WP Backup has been created to make instant backups of your blog and its data, regularly. Just choose a day, time and how often you wish your backup to be saved in your pCloud! You have a lot of content on your blog such as images, videos, and comments. If your database is erased or corrupted you may lose all the information you have generated over the years. By backing up your blog, you will be able to restore everything quickly and efficiently if anything happens. Having a current backup of your WordPress blog is critical for protecting your website, so back up your files and database backups into the cloud and restore with a single click! Just create pCloud account and never worry about it again! https://www.youtube.com/watch?v=s_rDLeqr-oA&t=1s&ab_channel=pCloud12 * Version: 1.0. 213 * Author: pCloud ( Vasil Tsintsev )11 * Description: pCloud WP Backup has been created to make instant backups of your blog and its data, regularly. 12 * Version: 1.0.3 13 * Author: pCloud 14 14 * URI: https://www.pcloud.com 15 15 * License: Copyright 2013-2022 - pCloud … … 32 32 define( 'PCLOUD_SCHDATA_KEY', 'wp2pcl_schdata' ); 33 33 } 34 if ( ! defined( 'PCLOUD_SCHDATA_INCLUDE_MYSQL' ) ) { 35 define( 'PCLOUD_SCHDATA_INCLUDE_MYSQL', 'wp2pcl_include_mysql' ); 36 } 34 37 if ( ! defined( 'PCLOUD_OPERATION' ) ) { 35 38 define( 'PCLOUD_OPERATION', 'wp2pcl_operation' ); … … 70 73 * This hack will increase the wp_remote_request timeout, which otherwise dies after 5-10sec. 71 74 * 72 * @param string|int $time input time.73 *74 75 * @return int 75 */ 76 function pcl_wb_bkup_timeout_extend( $time ) { 76 * @noinspection PhpUnused 77 */ 78 function pcl_wb_bkup_timeout_extend() { 77 79 return 120; 78 80 } … … 102 104 * 103 105 * @return void 106 * @noinspection PhpUnused 104 107 */ 105 108 function backup_to_pcloud_admin_menu() { … … 126 129 127 130 $dbg_mode = false; 128 if ( isset( $_GET['dbg'] ) && 'true' === s trval( wp_unslash( $_GET['dbg'] ) ) ) {131 if ( isset( $_GET['dbg'] ) && 'true' === sanitize_text_field( wp_unslash( $_GET['dbg'] ) ) ) { 129 132 $dbg_mode = true; 130 133 } … … 137 140 WP2pCloudFuncs::set_storred_val( PCLOUD_USEDQUOTA, '1' ); 138 141 WP2pCloudFuncs::set_storred_val( PCLOUD_API_LOCATIONID, '1' ); 142 WP2pCloudFuncs::set_storred_val( PCLOUD_SCHDATA_INCLUDE_MYSQL, '1' ); 139 143 140 144 $result['status'] = 0; 141 145 142 } elseif ( 'set_ schedule' === $m ) {146 } elseif ( 'set_with_mysql' === $m ) { 143 147 144 148 if ( ! isset( $_POST['wp2pcl_nonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['wp2pcl_nonce'] ) ) ) { … … 152 156 } 153 157 158 $withmysql = isset( $_POST['wp2pcl_withmysql'] ) ? '1' : '0'; 159 160 WP2pCloudFuncs::set_storred_val( PCLOUD_SCHDATA_INCLUDE_MYSQL, $withmysql ); 161 162 $result['status'] = 0; 163 164 } elseif ( 'set_schedule' === $m ) { 165 166 if ( ! isset( $_POST['wp2pcl_nonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['wp2pcl_nonce'] ) ) ) { 167 $result['status'] = 15; 168 $result['msg'] = '<p>Failed to validate the request!</p>'; 169 $result['sitename'] = $sitename; 170 171 echo wp_json_encode( $result ); 172 173 return; 174 } 175 154 176 $freq = isset( $_POST['freq'] ) ? trim( sanitize_text_field( wp_unslash( $_POST['freq'] ) ) ) : 't'; 155 177 156 178 if ( 't' === $freq ) { 157 158 add_filter(159 'cron_schedules',160 function ( $schedules ) {161 $schedules['10_sec'] = array(162 'interval' => 10,163 'display' => __( '10 seconds' ),164 );165 $schedules['1_hour'] = array(166 'interval' => 3600,167 'display' => __( '1 hour' ),168 );169 $schedules['4_hours'] = array(170 'interval' => 3600 * 4,171 'display' => __( '4 hours' ),172 );173 174 return $schedules;175 }176 );177 179 178 180 WP2pCloudDebugger::log( 'Test initiated !' ); … … 580 582 } elseif ( 'download' === $operation['operation'] && 'cleanup' === $operation['state'] ) { 581 583 582 WP2pCloudLogger::info( "<span class='pcl_transl' data-i10nk='db_restored'>Database - restored!</span>" );583 584 WP2pCloudLogger::info( "<span class='pcl_transl' data-i10nk='clean_up_pls_wait'>Cleaning up, please wait...</span>" ); 584 585 … … 655 656 WP2pCloudLogger::generate_new( "<span class='pcl_transl' data-i10nk='start_backup_at'>Start backup at</span> " . gmdate( 'Y-m-d H:i:s' ) ); 656 657 657 WP2pCloudDebugger::log( 'Database backup will start now!' );658 $b = new WP2pCloudDBBackUp();659 $file = $b->start();660 WP2pCloudDebugger::log( 'Database backup - ready!' );661 662 WP2pCloudDebugger::log( 'File backup will start now!' );663 658 $f = new WP2pCloudFileBackUp( $plugin_path_base ); 664 $f->set_mysql_backup_filename( $file ); 665 $f->start(); 666 667 } 668 669 670 /** 671 * This function performce auto-backup 672 * 673 * @throws Exception Standart exception will be thrown. 674 */ 675 function wp2pcl_perform_auto_backup() { 676 677 global $plugin_path_base; 678 679 WP2pCloudDebugger::log( 'wp2pcl_perform_auto_backup()' ); 680 681 $operation = WP2pCloudFuncs::get_operation(); 682 683 if ( 'init' === $operation['state'] ) { 684 685 WP2pCloudDebugger::log( 'wp2pcl_perform_auto_backup() - op:init !' ); 686 687 WP2pCloudLogger::generate_new( "<span class='pcl_transl' data-i10nk='start_auto_backup_at'>Start auto backup at</span> " . gmdate( 'Y-m-d H:i:s' ) ); 688 659 660 $wp2pcl_withmysql = WP2pCloudFuncs::get_storred_val( PCLOUD_SCHDATA_INCLUDE_MYSQL ); 661 if ( ! empty( $wp2pcl_withmysql ) && 1 === intval( $wp2pcl_withmysql ) ) { 662 WP2pCloudDebugger::log( 'Database backup will start now!' ); 689 663 $b = new WP2pCloudDBBackUp(); 690 664 $file = $b->start(); 665 $f->set_mysql_backup_filename( $file ); 666 667 WP2pCloudDebugger::log( 'Database backup - ready!' ); 668 } 669 670 WP2pCloudDebugger::log( 'File backup will start now!' ); 671 672 $f->start(); 673 } 674 675 676 /** 677 * This function performce auto-backup 678 * 679 * @throws Exception Standart exception will be thrown. 680 */ 681 function wp2pcl_perform_auto_backup() { 682 683 global $plugin_path_base; 684 685 $operation = WP2pCloudFuncs::get_operation(); 686 687 if ( 'init' === $operation['state'] ) { 688 689 WP2pCloudDebugger::log( 'wp2pcl_perform_auto_backup() - op:init !' ); 690 691 WP2pCloudLogger::generate_new( "<span class='pcl_transl' data-i10nk='start_auto_backup_at'>Start auto backup at</span> " . gmdate( 'Y-m-d H:i:s' ) ); 691 692 692 693 $f = new WP2pCloudFileBackUp( $plugin_path_base ); 693 $f->set_mysql_backup_filename( $file ); 694 695 $wp2pcl_withmysql = WP2pCloudFuncs::get_storred_val( PCLOUD_SCHDATA_INCLUDE_MYSQL ); 696 if ( ! empty( $wp2pcl_withmysql ) && 1 === intval( $wp2pcl_withmysql ) ) { 697 $b = new WP2pCloudDBBackUp(); 698 $file = $b->start(); 699 $f->set_mysql_backup_filename( $file ); 700 } 701 694 702 $f->start( 'auto' ); 695 703 … … 723 731 if ( '1_hour' === $freq ) { 724 732 if ( $lastbackupdt_tm > ( time() - 3600 ) ) { 725 WP2pCloudDebugger::log( 'wp2pcl_perform_auto_backup() rej: hourly' );726 733 $rejected = true; 727 734 } … … 729 736 if ( '4_hours' === $freq ) { 730 737 if ( $lastbackupdt_tm > ( time() - ( 3600 * 4 ) ) ) { 731 WP2pCloudDebugger::log( 'wp2pcl_perform_auto_backup() rej: hourly' );732 738 $rejected = true; 733 739 } … … 735 741 if ( 'daily' === $freq ) { 736 742 if ( $lastbackupdt_tm > ( time() - 86400 ) ) { 737 WP2pCloudDebugger::log( 'wp2pcl_perform_auto_backup() rej: daily' );738 743 $rejected = true; 739 744 } … … 741 746 if ( 'weekly' === $freq ) { 742 747 if ( $lastbackupdt_tm > strtotime( '-1 week' ) ) { 743 WP2pCloudDebugger::log( 'wp2pcl_perform_auto_backup() rej: weekly' );744 748 $rejected = true; 745 749 } … … 747 751 if ( 'monthly' === $freq ) { 748 752 if ( $lastbackupdt_tm > strtotime( '-1 month' ) ) { 749 WP2pCloudDebugger::log( 'wp2pcl_perform_auto_backup() rej: monthly' );750 753 $rejected = true; 751 754 } … … 784 787 WP2pCloudFuncs::set_storred_val( 'wp2pcl_operation', $json_data ); 785 788 789 if ( ! wp_next_scheduled( 'init_autobackup' ) ) { // This will always be false. 790 wp_schedule_event( time(), '10_sec', 'init_autobackup', array( false ) ); 791 } 786 792 } else { 787 793 … … 802 808 if ( ! extension_loaded( 'zip' ) ) { 803 809 print( '<h2 style="color: red">PHP ZIP extension not loaded</h2><small>Please, contact the server administrator!</small>' ); 804 805 810 return; 806 811 } 807 812 808 if ( isset( $_GET['do'], $_GET['access_token'] ) && ( 'pcloud_auth' === $_GET['do'] ) && ! empty( $_GET['access_token'] ) ) { 809 810 $sel_location = isset( $_GET['locationid'] ) ? intval( sanitize_key( wp_unslash( $_GET['locationid'] ) ) ) : 1; 811 if ( $sel_location > 0 && $sel_location < 100 ) { 812 WP2pCloudFuncs::set_storred_val( PCLOUD_API_LOCATIONID, $sel_location ); 813 $do = ''; 814 $auth_key = ''; 815 $locationid = 1; 816 817 if ( isset( $_GET['do'] ) ) { // phpcs:ignore 818 $do = sanitize_text_field( wp_unslash( $_GET['do'] ) ); // phpcs:ignore 819 } 820 if ( isset( $_GET['access_token'] ) ) { // phpcs:ignore 821 $auth_key = trim( sanitize_text_field( wp_unslash( $_GET['access_token'] ) ) ); // phpcs:ignore 822 } 823 if ( isset( $_GET['locationid'] ) ) { // phpcs:ignore 824 $locationid = intval( sanitize_key( wp_unslash( $_GET['locationid'] ) ) ); // phpcs:ignore 825 } 826 827 if ( ( 'pcloud_auth' === $do ) && ! empty( $auth_key ) ) { 828 829 if ( $locationid > 0 && $locationid < 100 ) { 830 WP2pCloudFuncs::set_storred_val( PCLOUD_API_LOCATIONID, $locationid ); 813 831 $result['status'] = 0; 814 832 } 815 833 816 $auth_key = trim( sanitize_text_field( wp_unslash( $_GET['access_token'] ) ) ); 817 818 if ( ! empty( $auth_key ) ) { 819 WP2pCloudFuncs::set_storred_val( PCLOUD_AUTH_KEY, $auth_key ); 820 821 print '<h2 style="color: green;text-align: center" class="wp2pcloud-login-succcess">You are successfully logged in!</h2>'; 822 823 } 824 } 825 826 $static_files_ver = '1.0.18'; 834 WP2pCloudFuncs::set_storred_val( PCLOUD_AUTH_KEY, $auth_key ); 835 836 print '<h2 style="color: green;text-align: center" class="wp2pcloud-login-succcess">You are successfully logged in!</h2>'; 837 838 } 839 840 $static_files_ver = '1.0.20'; 827 841 828 842 wp_enqueue_script( 'wp2pcl-scr', plugins_url( '/assets/js/wp2pcl.js', __FILE__ ), array(), $static_files_ver, true ); … … 859 873 WP2pCloudFuncs::get_storred_val( PCLOUD_AUTH_MAIL ); 860 874 WP2pCloudFuncs::get_storred_val( PCLOUD_SCHDATA_KEY, 'daily' ); 875 WP2pCloudFuncs::get_storred_val( PCLOUD_SCHDATA_INCLUDE_MYSQL, '1' ); 861 876 WP2pCloudFuncs::get_storred_val( PCLOUD_OPERATION ); 862 877 WP2pCloudFuncs::get_storred_val( PCLOUD_HAS_ACTIVITY, '0' ); … … 887 902 ); 888 903 889 wp_schedule_event( time(), '10_sec', 'init_autobackup', array( ), true);904 wp_schedule_event( time(), '10_sec', 'init_autobackup', array( false ) ); 890 905 } 891 906 … … 902 917 delete_option( PCLOUD_AUTH_MAIL ); 903 918 delete_option( PCLOUD_SCHDATA_KEY ); 919 delete_option( PCLOUD_SCHDATA_INCLUDE_MYSQL ); 904 920 delete_option( PCLOUD_OPERATION ); 905 921 delete_option( PCLOUD_HAS_ACTIVITY ); … … 918 934 * 919 935 * @return array 936 * @noinspection PhpUnused 920 937 */ 921 938 function backup_to_pcloud_cron_schedules( $schedules ) { … … 961 978 */ 962 979 function wp2pcl_load_scripts() { 963 wp_register_script( 'wp2pcl-wp2pcljs', plugins_url( '/assets/js/wp2pcl.js', __FILE__ ), array(), '1.0. 2', true );980 wp_register_script( 'wp2pcl-wp2pcljs', plugins_url( '/assets/js/wp2pcl.js', __FILE__ ), array(), '1.0.3', true ); 964 981 wp_enqueue_script( 'jquery' ); 965 982 } -
pcloud-wp-backup/trunk/readme.txt
r2732482 r2781798 1 === pCloud WP Backup ===2 Contributors: p Cloud1 === pCloud WP Backup === 2 Contributors: ploudapp, the_root 3 3 Tags: backup, pCloud 4 4 Requires at least: 5.0 5 Tested up to: 6.0.0 6 Stable tag: 1.0.2 5 Tested up to: 6.0.2 6 Requires PHP: 5.6 7 Stable tag: 1.0.3 7 8 License: GPLv3 or later 8 9 10 The pCloud WP Backup plugin will help you to backup everything on your blog with one click and store it in the cloud in the most secure way. 11 9 12 == Description == 10 pCloud WP Backup has been created to make instant backups of your blog and its data, regularly. Just choose a day, time and how often you wish your backup to be saved in your pCloud! You have a lot of content on your blog such as images, videos, and comments. If your database is erased or corrupted you may lose all the information you have generated over the years. By backing up your blog, you will be able to restore everything quickly and efficiently if anything happens. Having a current backup of your WordPress blog is critical for protecting your website, so back up your files and database backups into the cloud and restore with a single click! Just create pCloud account and never worry about it again! https://www.youtube.com/watch?v=s_rDLeqr-oA&t=1s&ab_channel=pCloud 13 # pCloud WP Backup 11 14 12 == Screenshots == 13 1. Here's a screenshot of it in action 15 The pCloud WP Backup plugin was created to help you backup everything on your blog with just one click and store it in the cloud in the most secure way possible. 16 17 Just create an account select a backup schedule, and we will take care of the rest. 18 19 * The backup is done directly in the cloud, so you will have access to all your files on: 20 Our Blog admin interface. 21 * All your other devices (laptops, smartphones, tablets etc.) or via https://www.pcloud.com 22 23 ## Why you should always have a backup of your website and all its assets 24 25 Backups are the ultimate insurance for your website. They ensure that if something were to happen, and you lost all data on it including backup files (which should be regularly updated), then at least one copy of everything would still exist so an emergency situation can easily be resolved with little downtime or disruption. 26 27 Just set and forget with pCloud WP Backup. The plugin will backup all your important files automatically, so you can focus on what really matters! 28 29 ## Restoring backups 30 The plugin can not only create backups but if something goes wrong with your website it can restore a previous version in just one click 31 32 ## Security 33 To guarantee your file's safety, pCloud WP Backup uses TLS/SSL encryption, applied when information is transferred from your website to the pCloud servers. At pCloud data security is our top priority, and we do our best to apply first class safety measures. With pCloud, your files are stored on at least three server locations in a highly secure data storage area. Optionally, you can subscribe for pCloud Crypto and have your most important files encrypted and password protected. We provide the so called client-side encryption, which, unlike server-side encryption, means that no one, except you will, have the keys for file decryption. 34 14 35 15 36 == Installation == 16 Once installed, the authorization is 'one step' process.17 When you first access the plugin’s options page, it will ask you to authorize the plugin with pCloud. Login with your email and password and press the button.37 Once installed, you will see a new menu \"pCloud Backup\", open the menu and use the \"Authenticate with pCloud\" link to authenticate with your pCloud account. 38 After successful authentication, you will be able to enjoy the full functionality of the plugin. 18 39 19 40 = Minimum Requirements = 20 41 21 1. PHP 5.6 or higher with [ZIP support](https://www.php.net/manual/en/zip.installation.php) 22 2. [pCloud account](https://my.pcloud.com/#page=register&ref=1235) 42 * PHP 5.6 or higher with [ZIP support](https://www.php.net/manual/en/zip.installation.php) 43 * [pCloud account](https://my.pcloud.com/#page=register&ref=1235) 44 45 46 == Frequently Asked Questions == 47 = I am having issues with the plugin, it does not work as expected, what to do ? = 48 49 Click \"Backup Now\" and on the upper / right corner of the page you will see small \"debug\" button, click on it and the black info window will show much more debugging / useful info related to the backup process. You can send the content of that black window to: support@pcloud.com and ask for support from the pCloud team. 50 51 = Why the manual ( Backup Now ) works, but the automatic / scheduled does not ? = 52 53 If the manual backup mode works it means that the plugin is functioning correctly, on the other hand - to work correctly in automatic ( scheduled ) mode the website needs to have enough visitors, so they can kick-up the backup process or at least someone needs to visit the admin page of the blog. 54 55 56 == Screenshots == 57 1. Here is a screenshot of the plugin in action 58 59 == Changelog == 60 = 1.0.3 = 61 * Added an option to choose whether to include a database snapshot in the backup archive or not. 62 * Much more debugging is added in order to determine the Zipping process issues. 63 64 = 1.0.2 = 65 * First public release, tested and confirmed to be stable enough. 66 67 = 1.0.0 = 68 * Initial version of the plugin. 69 70 71 == Upgrade Notice == 72 Plugin is more stable now and expected to work faster for bigger archives. -
pcloud-wp-backup/trunk/views/wp2pcl-config.php
r2732482 r2781798 10 10 $auth_mail = WP2pCloudFuncs::get_storred_val( PCLOUD_AUTH_MAIL ); 11 11 12 $lastbackupdt_tm = intval( WP2pCloudFuncs::get_storred_val( PCLOUD_LAST_BACKUPDT ) ); 13 14 $last_backup_data = ( $lastbackupdt_tm > 9999 ) ? gmdate( 'd.m.Y H:i:s', $lastbackupdt_tm ) : 15 '<em class="pcl_transl" data-i10nk="no_bk_so_far">no auto backups so far</em>'; 12 $php_extensions = get_loaded_extensions(); 13 $has_archive_ext_installed = array_search( 'zip', $php_extensions, true ); 14 15 $lastbackupdt_tm = intval( WP2pCloudFuncs::get_storred_val( PCLOUD_LAST_BACKUPDT ) ); 16 $last_backup_data = ( $lastbackupdt_tm > 9999 ) ? gmdate( 'd.m.Y H:i:s', $lastbackupdt_tm ) : ''; 16 17 17 18 if ( PCLOUD_DEBUG ) { 18 19 $freg = array( 20 't' => 'Test', 19 21 '1_hour' => '1 Hour', 20 22 '4_hours' => '4 Hours', … … 34 36 $sched = WP2pCloudFuncs::get_storred_val( PCLOUD_SCHDATA_KEY ); 35 37 38 $wp2pcl_withmysql_chk = 'checked="checked"'; 39 $wp2pcl_withmysql = WP2pCloudFuncs::get_storred_val( PCLOUD_SCHDATA_INCLUDE_MYSQL ); 40 if ( empty( $wp2pcl_withmysql ) || intval( $wp2pcl_withmysql ) < 1 ) { 41 $wp2pcl_withmysql_chk = ''; 42 } 43 36 44 $next_sch = wp_next_scheduled( 'wp2pcl_run_pcloud_backup_hook' ); 37 45 … … 66 74 $msg = sanitize_text_field( wp_unslash( $_GET['msg'] ) ); 67 75 } 76 77 $auth_url = '#'; 68 78 69 79 if ( empty( $auth ) ) { … … 81 91 82 92 <div id="wp2pcloud-error" class="error notice" style="display: none"><p></p></div> 93 94 <?php if ( ! $has_archive_ext_installed ) : ?> 95 <div id="wp2pcloud-error" class="error notice"> 96 <p class="pcl_transl" data-i10nk="no_zip_zlib_ext_found"> 97 No "zip" PHP extension has been found, backup will not be possible. 98 Please, contact the support of your hosting company and request the extension to be enabled for your website. 99 </p> 100 </div> 101 <?php endif; ?> 83 102 84 103 <?php if ( 'restore_ok' === $msg ) : ?> … … 161 180 162 181 <div class="wp2pcloud-register-wrap"> 182 <?php if ( $has_archive_ext_installed ) : ?> 163 183 <button type="button" id="run_wp_backup_now" class="button pcl_transl" data-i10nk="cta_backup_now">Make 164 184 backup now 165 185 </button> 186 <?php endif; ?> 187 </div> 188 189 <div class="wp2pcloud-register-wrap" style="padding-bottom: 30px"> 190 <h4 class="pcl_transl" data-i10nk="incl_db_backup_ttl">Database backup:</h4> 191 192 <form action="" id="wp2_incl_db_form" autocomplete="off"> 193 194 <div id="setting-error-mysql-settings_updated" class="updated settings-error below-h2"> 195 <p class="pcl_transl" data-i10nk="your_sett_saved">Your settings are saved</p> 196 </div> 197 198 <div id="" class="below-h2"> 199 <label for="wp2pcl_withmysql" data-i10nk="incl_db_backup_lbl"> 200 Include Database ( MySQL ) in the backup: 201 </label> 202 <input type="checkbox" name="wp2pcl_withmysql" id="wp2pcl_withmysql" value="1" 203 <?php echo esc_attr( $wp2pcl_withmysql_chk ); ?> /> 204 </div> 205 206 <input type="hidden" name="wp2pcl_nonce" value="<?php echo esc_attr( $nonce ); ?>"/> 207 208 </form> 209 166 210 </div> 167 211 … … 197 241 198 242 <div style="display: flex; align-items: center; padding-top: 10px;"> 199 <label for="freq" class="pcl_transl" data-i10nk="last_auto_backup">Last auto 200 backup: </label> <?php echo esc_html( $last_backup_data ); ?> 201 </div> 202 203 <input type="hidden" name="wp2pcl_nonce" id="wp2pcl_nonce" value="<?php echo esc_attr( $nonce ); ?>"/> 243 <label for="freq" class="pcl_transl" data-i10nk="last_auto_backup">Last auto backup: </label> 244 <?php if ( empty( $last_backup_data ) ) : ?> 245 <em class="pcl_transl" data-i10nk="no_bk_so_far">no auto backups so far</em> 246 <?php else : ?> 247 <?php echo esc_html( $last_backup_data ); ?> 248 <?php endif; ?> 249 </div> 250 251 <input type="hidden" name="wp2pcl_nonce" value="<?php echo esc_attr( $nonce ); ?>"/> 204 252 205 253 </form>
Note: See TracChangeset
for help on using the changeset viewer.