Skip to content

Commit

Permalink
Merged changes from Pro and added translation
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhuesken committed Sep 16, 2015
1 parent 866332d commit eca4c3b
Show file tree
Hide file tree
Showing 8 changed files with 15,387 additions and 4,596 deletions.
75 changes: 41 additions & 34 deletions inc/class-create-archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public function add_file( $file_name, $name_in_archive = '' ) {
case 'ZipArchive':
$file_size = filesize( $file_name );
if ( $file_size === FALSE ) {
$file_size = PHP_INT_MAX;
return FALSE;
}
//check if entry already in archive and delete it if it not in full size
if ( $zip_file_stat = $this->ziparchive->statName( $name_in_archive ) ) {
Expand All @@ -326,41 +326,49 @@ public function add_file( $file_name, $name_in_archive = '' ) {
return TRUE;
}
}
//close and reopen, all added files are open on fs
if ( $this->file_count > 20 ) { //35 works with PHP 5.2.4 on win
if ( ! $this->ziparchive->close() ) {
$this->ziparchive_status();
trigger_error(__( 'ZIP archive cannot be closed correctly', 'backwpup' ), E_USER_ERROR );
sleep( 1 );
}
$this->ziparchive = NULL;
if ( ! $this->check_archive_filesize() ) {
return FALSE;
}
$this->ziparchive = new ZipArchive();
$ziparchive_open = $this->ziparchive->open( $this->file, ZipArchive::CREATE );
if ( $ziparchive_open !== TRUE ) {
$this->ziparchive_status();
return FALSE;
}
$this->file_count = 0;
}
if ( $file_size < ( 1024 * 1024 * 2 ) ) {
if ( ! $this->ziparchive->addFromString( $name_in_archive, file_get_contents( $file_name ) ) ) {
$this->ziparchive_status();
trigger_error( sprintf( __( 'Cannot add "%s" to zip archive!', 'backwpup' ), $name_in_archive ), E_USER_ERROR );
return FALSE;
} else {
$file_factor = round( $file_size / ( 1024 * 1024 ), 4 ) * 2;
$this->file_count = $this->file_count + $file_factor;
}
} else {
if ( version_compare( PHP_VERSION, '5.3.3', '>=') ) { //php > 5.3.3
if ( ! $this->ziparchive->addFile( $file_name, $name_in_archive ) ) {
$this->ziparchive_status();
trigger_error( sprintf( __( 'Cannot add "%s" to zip archive!', 'backwpup' ), $name_in_archive ), E_USER_ERROR );
return FALSE;
}
} else { //php < 5.3
//close and reopen, all added files are open on fs
if ( $this->file_count > 20 ) { //35 works with PHP 5.2.4 on win
if ( ! $this->ziparchive->close() ) {
$this->ziparchive_status();
trigger_error(__( 'ZIP archive cannot be closed correctly', 'backwpup' ), E_USER_ERROR );
sleep( 1 );
}
$this->ziparchive = NULL;
if ( ! $this->check_archive_filesize() ) {
return FALSE;
}
$this->ziparchive = new ZipArchive();
$ziparchive_open = $this->ziparchive->open( $this->file, ZipArchive::CREATE );
if ( $ziparchive_open !== TRUE ) {
$this->ziparchive_status();
return FALSE;
}
$this->file_count = 0;
}
if ( $file_size < ( 1024 * 1024 * 2 ) ) {
if ( ! $this->ziparchive->addFromString( $name_in_archive, file_get_contents( $file_name ) ) ) {
$this->ziparchive_status();
trigger_error( sprintf( __( 'Cannot add "%s" to zip archive!', 'backwpup' ), $name_in_archive ), E_USER_ERROR );
return FALSE;
} else {
$file_factor = round( $file_size / ( 1024 * 1024 ), 4 ) * 2;
$this->file_count = $this->file_count + $file_factor;
}
} else {
$this->file_count++;
if ( ! $this->ziparchive->addFile( $file_name, $name_in_archive ) ) {
$this->ziparchive_status();
trigger_error( sprintf( __( 'Cannot add "%s" to zip archive!', 'backwpup' ), $name_in_archive ), E_USER_ERROR );
return FALSE;
} else {
$this->file_count++;
}
}
}
break;
Expand Down Expand Up @@ -653,13 +661,12 @@ private function tar_empty_folder( $folder_name, $name_in_archive ) {
*/
private function check_archive_filesize( $file_to_add = '' ) {

$file_to_add_size = 0;
if ( ! empty( $file_to_add ) ) {
$file_to_add_size = filesize( $file_to_add );
if ( $file_to_add_size === FALSE ) {
$file_to_add_size = PHP_INT_MAX;
$file_to_add_size = 0;
}
} else {
$file_to_add_size = 0;
}

if ( is_resource( $this->filehandel ) ) {
Expand Down
8 changes: 4 additions & 4 deletions inc/class-jobtype-file.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public function edit_tab( $main ) {
</tr>
</table>

<h3 class="title"><?php _e( 'Special option', 'backwpup' ) ?></h3>
<h3 class="title"><?php _e( 'Special options', 'backwpup' ) ?></h3>
<p></p>
<table class="form-table">
<tr>
Expand All @@ -297,11 +297,11 @@ public function edit_tab( $main ) {
</td>
</tr>
<tr>
<th scope="row"><?php _e( 'Move WP install folder up', 'backwpup' ); ?></th>
<th scope="row"><?php _e( 'Use one folder above as WP install folder', 'backwpup' ); ?></th>
<td>
<label for="idbackupabsfolderup"><input class="checkbox" id="idbackupabsfolderup"
type="checkbox"<?php checked( $abs_folder_up, TRUE, TRUE ); ?>
name="backupabsfolderup" value="1" /> <?php _e( 'Move WordPress install folder one folder up! If special WordPress installation that will help.', 'backwpup' ); ?></label>
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>
</td>
</tr>
</table>
Expand Down Expand Up @@ -502,7 +502,7 @@ public function job_run( BackWPup_Job $job_object ) {
$job_object->additional_files_to_backup[ ] = str_replace( '\\', '/', ABSPATH . 'wp-config.php' );
$job_object->log( sprintf( __( 'Added "%s" to backup file list', 'backwpup' ), 'wp-config.php' ) );
}
elseif ( BackWPup_File::is_in_open_basedir( dirname( ABSPATH ) . '/wp-config.php' ) ) {
elseif ( BackWPup_File::is_in_open_basedir( dirname( ABSPATH ) ) ) {
if ( is_readable( dirname( ABSPATH ) . '/wp-config.php' ) && ! is_readable( dirname( ABSPATH ) . '/wp-settings.php' ) ) {
$job_object->additional_files_to_backup[ ] = str_replace( '\\', '/', dirname( ABSPATH ) . '/wp-config.php' );
$job_object->log( sprintf( __( 'Added "%s" to backup file list', 'backwpup' ), 'wp-config.php' ) );
Expand Down
2 changes: 1 addition & 1 deletion inc/class-page-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ class="small-text code" />
<legend class="screen-reader-text"><span><?php _e( 'Enable an empty Output on backup working.', 'backwpup' ); ?></span>
</legend>
<label for="jobdooutput">
<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' ); ?>"
<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' ); ?>"
value="1" <?php checked( get_site_option( 'backwpup_cfg_jobdooutput' ), TRUE ); ?> />
<?php _e( 'Enable an empty Output on backup working.', 'backwpup' ); ?>
</label>
Expand Down
Binary file modified languages/backwpup-de_DE.mo
Binary file not shown.
Loading

0 comments on commit eca4c3b

Please sign in to comment.