Skip to content

Commit eca4c3b

Browse files
committed
Merged changes from Pro and added translation
1 parent 866332d commit eca4c3b

File tree

8 files changed

+15387
-4596
lines changed

8 files changed

+15387
-4596
lines changed

inc/class-create-archive.php

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ public function add_file( $file_name, $name_in_archive = '' ) {
313313
case 'ZipArchive':
314314
$file_size = filesize( $file_name );
315315
if ( $file_size === FALSE ) {
316-
$file_size = PHP_INT_MAX;
316+
return FALSE;
317317
}
318318
//check if entry already in archive and delete it if it not in full size
319319
if ( $zip_file_stat = $this->ziparchive->statName( $name_in_archive ) ) {
@@ -326,41 +326,49 @@ public function add_file( $file_name, $name_in_archive = '' ) {
326326
return TRUE;
327327
}
328328
}
329-
//close and reopen, all added files are open on fs
330-
if ( $this->file_count > 20 ) { //35 works with PHP 5.2.4 on win
331-
if ( ! $this->ziparchive->close() ) {
332-
$this->ziparchive_status();
333-
trigger_error(__( 'ZIP archive cannot be closed correctly', 'backwpup' ), E_USER_ERROR );
334-
sleep( 1 );
335-
}
336-
$this->ziparchive = NULL;
337-
if ( ! $this->check_archive_filesize() ) {
338-
return FALSE;
339-
}
340-
$this->ziparchive = new ZipArchive();
341-
$ziparchive_open = $this->ziparchive->open( $this->file, ZipArchive::CREATE );
342-
if ( $ziparchive_open !== TRUE ) {
343-
$this->ziparchive_status();
344-
return FALSE;
345-
}
346-
$this->file_count = 0;
347-
}
348-
if ( $file_size < ( 1024 * 1024 * 2 ) ) {
349-
if ( ! $this->ziparchive->addFromString( $name_in_archive, file_get_contents( $file_name ) ) ) {
350-
$this->ziparchive_status();
351-
trigger_error( sprintf( __( 'Cannot add "%s" to zip archive!', 'backwpup' ), $name_in_archive ), E_USER_ERROR );
352-
return FALSE;
353-
} else {
354-
$file_factor = round( $file_size / ( 1024 * 1024 ), 4 ) * 2;
355-
$this->file_count = $this->file_count + $file_factor;
356-
}
357-
} else {
329+
if ( version_compare( PHP_VERSION, '5.3.3', '>=') ) { //php > 5.3.3
358330
if ( ! $this->ziparchive->addFile( $file_name, $name_in_archive ) ) {
359331
$this->ziparchive_status();
360332
trigger_error( sprintf( __( 'Cannot add "%s" to zip archive!', 'backwpup' ), $name_in_archive ), E_USER_ERROR );
361333
return FALSE;
334+
}
335+
} else { //php < 5.3
336+
//close and reopen, all added files are open on fs
337+
if ( $this->file_count > 20 ) { //35 works with PHP 5.2.4 on win
338+
if ( ! $this->ziparchive->close() ) {
339+
$this->ziparchive_status();
340+
trigger_error(__( 'ZIP archive cannot be closed correctly', 'backwpup' ), E_USER_ERROR );
341+
sleep( 1 );
342+
}
343+
$this->ziparchive = NULL;
344+
if ( ! $this->check_archive_filesize() ) {
345+
return FALSE;
346+
}
347+
$this->ziparchive = new ZipArchive();
348+
$ziparchive_open = $this->ziparchive->open( $this->file, ZipArchive::CREATE );
349+
if ( $ziparchive_open !== TRUE ) {
350+
$this->ziparchive_status();
351+
return FALSE;
352+
}
353+
$this->file_count = 0;
354+
}
355+
if ( $file_size < ( 1024 * 1024 * 2 ) ) {
356+
if ( ! $this->ziparchive->addFromString( $name_in_archive, file_get_contents( $file_name ) ) ) {
357+
$this->ziparchive_status();
358+
trigger_error( sprintf( __( 'Cannot add "%s" to zip archive!', 'backwpup' ), $name_in_archive ), E_USER_ERROR );
359+
return FALSE;
360+
} else {
361+
$file_factor = round( $file_size / ( 1024 * 1024 ), 4 ) * 2;
362+
$this->file_count = $this->file_count + $file_factor;
363+
}
362364
} else {
363-
$this->file_count++;
365+
if ( ! $this->ziparchive->addFile( $file_name, $name_in_archive ) ) {
366+
$this->ziparchive_status();
367+
trigger_error( sprintf( __( 'Cannot add "%s" to zip archive!', 'backwpup' ), $name_in_archive ), E_USER_ERROR );
368+
return FALSE;
369+
} else {
370+
$this->file_count++;
371+
}
364372
}
365373
}
366374
break;
@@ -653,13 +661,12 @@ private function tar_empty_folder( $folder_name, $name_in_archive ) {
653661
*/
654662
private function check_archive_filesize( $file_to_add = '' ) {
655663

664+
$file_to_add_size = 0;
656665
if ( ! empty( $file_to_add ) ) {
657666
$file_to_add_size = filesize( $file_to_add );
658667
if ( $file_to_add_size === FALSE ) {
659-
$file_to_add_size = PHP_INT_MAX;
668+
$file_to_add_size = 0;
660669
}
661-
} else {
662-
$file_to_add_size = 0;
663670
}
664671

665672
if ( is_resource( $this->filehandel ) ) {

inc/class-jobtype-file.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public function edit_tab( $main ) {
285285
</tr>
286286
</table>
287287

288-
<h3 class="title"><?php _e( 'Special option', 'backwpup' ) ?></h3>
288+
<h3 class="title"><?php _e( 'Special options', 'backwpup' ) ?></h3>
289289
<p></p>
290290
<table class="form-table">
291291
<tr>
@@ -297,11 +297,11 @@ public function edit_tab( $main ) {
297297
</td>
298298
</tr>
299299
<tr>
300-
<th scope="row"><?php _e( 'Move WP install folder up', 'backwpup' ); ?></th>
300+
<th scope="row"><?php _e( 'Use one folder above as WP install folder', 'backwpup' ); ?></th>
301301
<td>
302302
<label for="idbackupabsfolderup"><input class="checkbox" id="idbackupabsfolderup"
303303
type="checkbox"<?php checked( $abs_folder_up, TRUE, TRUE ); ?>
304-
name="backupabsfolderup" value="1" /> <?php _e( 'Move WordPress install folder one folder up! If special WordPress installation that will help.', 'backwpup' ); ?></label>
304+
name="backupabsfolderup" value="1" /> <?php _e( 'Use one folder above as WordPress install folder! That can be helpful, if you would backup files and folder that are not in the WordPress installation folder. Or if you made a "<a href="https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">Giving WordPress Its Own Directory</a>" installation. Excludes must be configured again.', 'backwpup' ); ?></label>
305305
</td>
306306
</tr>
307307
</table>
@@ -502,7 +502,7 @@ public function job_run( BackWPup_Job $job_object ) {
502502
$job_object->additional_files_to_backup[ ] = str_replace( '\\', '/', ABSPATH . 'wp-config.php' );
503503
$job_object->log( sprintf( __( 'Added "%s" to backup file list', 'backwpup' ), 'wp-config.php' ) );
504504
}
505-
elseif ( BackWPup_File::is_in_open_basedir( dirname( ABSPATH ) . '/wp-config.php' ) ) {
505+
elseif ( BackWPup_File::is_in_open_basedir( dirname( ABSPATH ) ) ) {
506506
if ( is_readable( dirname( ABSPATH ) . '/wp-config.php' ) && ! is_readable( dirname( ABSPATH ) . '/wp-settings.php' ) ) {
507507
$job_object->additional_files_to_backup[ ] = str_replace( '\\', '/', dirname( ABSPATH ) . '/wp-config.php' );
508508
$job_object->log( sprintf( __( 'Added "%s" to backup file list', 'backwpup' ), 'wp-config.php' ) );

inc/class-page-settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class="small-text code" />
316316
<legend class="screen-reader-text"><span><?php _e( 'Enable an empty Output on backup working.', 'backwpup' ); ?></span>
317317
</legend>
318318
<label for="jobdooutput">
319-
<input name="jobdooutput" type="checkbox" id="jobdooutput" class="help-tip" title="<?php esc_attr_e( 'This do an empty output on job working. This kan help in some situations or can brake the working. You must test it.', 'backwpup' ); ?>"
319+
<input name="jobdooutput" type="checkbox" id="jobdooutput" class="help-tip" title="<?php esc_attr_e( 'This do an empty output on job working. This can help in some situations or can brake the working. You must test it.', 'backwpup' ); ?>"
320320
value="1" <?php checked( get_site_option( 'backwpup_cfg_jobdooutput' ), TRUE ); ?> />
321321
<?php _e( 'Enable an empty Output on backup working.', 'backwpup' ); ?>
322322
</label>

languages/backwpup-de_DE.mo

1.26 KB
Binary file not shown.

0 commit comments

Comments
 (0)