function backupFilesNext($include_data, $exclude_data, $backup_file, $backup_url, $nextCount, $p_filedescr_list = array(), $account_info = array(), $files_with_error = array(), $files_excluded_by_size = array(), $zip_split_part = 0) { $historyID = $this->hisID; $is_new_zip = false; $backup_settings_values = $this->backup_settings_vals; //$file_block_size = $backup_settings_values['file_block_size']; //$is_compressed = $backup_settings_values['is_compressed']; //$file_loop_break_time = $backup_settings_values['file_loop_break_time']; //$task_name = $backup_settings_values['task_name']; //get the settings by other method $requestParams = $this->getRequiredData($historyID, "requestParams"); $file_block_size = $requestParams['args']['file_block_size']; //darkcode changed $is_compressed = $requestParams['args']['is_compressed']; $file_loop_break_time = $requestParams['args']['file_loop_break_time']; $task_name = $requestParams['args']['backup_name']; $exclude_file_size = $requestParams['args']['exclude_file_size']; $exclude_extensions = $requestParams['args']['exclude_extensions']; $zip_split_size = $requestParams['args']['zip_split_size']; if ($backup_settings_values['dbFileHashValue'][$historyID]) { $dbFileHashValue = $backup_settings_values['dbFileHashValue'][$historyID]; } else { $dbFileHashValue = array(); } $responseParams = $this->getRequiredData($historyID, "responseParams"); $category = $responseParams['category']; //Am getting the category to perform the dbZip actions $get_file_list = isset($responseParams['response_data']['get_file_list']) ? $responseParams['response_data']['get_file_list'] : ''; $this->statusLog($historyID, array('stage' => 'backupFilesMultiCall', 'status' => 'processing', 'statusMsg' => 'backupMultiCallInitiated', 'responseParams' => $responseParams)); $time = microtime(true); $start = $time; //include_once 'pclzip.class.php'; //include_once 'pclzip.class.split.php'; $archive = new IWPPclZip($backup_file); if ($category == 'dbZip') { if (empty($p_filedescr_list) || $nextCount == 0) { if ($get_file_list != 'completed') { $p_filedescr_list_array = $archive->getFileList(IWP_DB_DIR, IWP_PCLZIP_OPT_REMOVE_PATH, IWP_BACKUP_DIR, IWP_PCLZIP_OPT_CHUNK_BLOCK_SIZE, $file_block_size, IWP_PCLZIP_OPT_HISTORY_ID, $historyID); //darkCode set the file block size here .. static values $p_filedescr_list = $p_filedescr_list_array['p_filedescr_list']; $next_file_index = $p_filedescr_list_array['next_file_index']; if ($p_filedescr_list_array['status'] == 'partiallyCompleted') { $result_arr = array(); $result_arr = $responseParams; $result_arr['nextFunc'] = 'backupFilesZIP'; $result_arr['response_data']['p_filedescr_list'] = $p_filedescr_list; $result_arr['response_data']['next_file_index'] = $p_filedescr_list_array['next_file_index']; $result_arr['response_data']['complete_folder_list'] = $p_filedescr_list_array['complete_folder_list']; unset($p_filedescr_list_array); $this->statusLog($this->hisID, array('stage' => 'gettingFileList', 'status' => 'processing', 'statusMsg' => 'gettingFileListInMultiCall', 'responseParams' => $result_arr)); $resArray = array(); $resArray['status'] = 'partiallyCompleted'; $resArray['backupParentHID'] = $historyID; return $resArray; } elseif ($p_filedescr_list_array['status'] == 'error' || !$p_filedescr_list_array) { return $this->statusLog($this->hisID, array('stage' => 'backupFiles', 'status' => 'error', 'statusMsg' => 'Backup of files failed - Error while preparing file list', 'statusCode' => 'backup_files_next_dbZip_backup_of_files_failed_error_while_preparing_file_list')); } elseif ($p_filedescr_list_array['status'] == 'completed') { } } } } else { if (empty($p_filedescr_list) || $nextCount == 0) { if ($get_file_list != 'completed') { //$p_filedescr_list_array = $archive->getFileList($include_data, IWP_PCLZIP_OPT_REMOVE_PATH, ABSPATH, IWP_PCLZIP_OPT_IWP_EXCLUDE, $exclude_data, IWP_PCLZIP_OPT_CHUNK_BLOCK_SIZE, $file_block_size, IWP_PCLZIP_OPT_HISTORY_ID, $historyID); //testing darkCode set the file block size here .. static values $p_filedescr_list_array = $archive->getFileList($include_data, IWP_PCLZIP_OPT_REMOVE_PATH, ABSPATH, IWP_PCLZIP_OPT_FILE_EXCLUDE_SIZE, $exclude_file_size, IWP_PCLZIP_OPT_IWP_EXCLUDE, $exclude_data, IWP_PCLZIP_OPT_IWP_EXCLUDE_EXT, $exclude_extensions, IWP_PCLZIP_OPT_CHUNK_BLOCK_SIZE, $file_block_size, IWP_PCLZIP_OPT_HISTORY_ID, $historyID); $p_filedescr_list = $p_filedescr_list_array['p_filedescr_list']; if ($p_filedescr_list_array['status'] == 'partiallyCompleted') { $result_arr = array(); $result_arr = $responseParams; $result_arr['nextFunc'] = 'backupFilesZIP'; $result_arr['response_data']['p_filedescr_list'] = $p_filedescr_list; unset($p_filedescr_list); unset($p_filedescr_list_array['p_filedescr_list']); $result_arr['response_data']['next_file_index'] = $p_filedescr_list_array['next_file_index']; $result_arr['response_data']['complete_folder_list'] = $p_filedescr_list_array['complete_folder_list']; $this->statusLog($this->hisID, array('stage' => 'gettingFileList', 'status' => 'processing', 'statusMsg' => 'gettingFileListInMultiCall', 'responseParams' => $result_arr)); unset($p_filedescr_list_array); $resArray = array(); $resArray['status'] = 'partiallyCompleted'; $resArray['backupParentHID'] = $historyID; $resArray['isGetFileList'] = true; return $resArray; } elseif ($p_filedescr_list_array['status'] == 'error' || !$p_filedescr_list_array) { return $this->statusLog($this->hisID, array('stage' => 'backupFiles', 'status' => 'error', 'statusMsg' => 'Backup of files failed - Error while preparing file list', 'statusCode' => 'backup_files_next_p_filedescr_list_array_dbZip_backup_of_files_failed_Error_while_preparing_file_list')); } elseif ($p_filedescr_list_array['status'] == 'completed') { } } } } $archive->privDisableMagicQuotes(); if (($v_result = $archive->privOpenFd('rb+')) != 1) { $archive->privSwapBackMagicQuotes(); $this->statusLog($historyID, array('stage' => 'backupFilesMultiCall', 'status' => 'error', 'statusMsg' => 'openingFileError', 'statusCode' => 'opening_file_error')); return array('error' => 'Zip-error: Error opening file', 'error_code' => 'zip_error_opening_file'); //return $v_result; } clearstatcache(); // ----- Read the central directory informations $v_central_dir = array(); if (($v_result = $archive->privReadEndCentralDir($v_central_dir)) != 1) { echo 'iwpmsg error2'; $archive->privCloseFd(); $archive->privSwapBackMagicQuotes(); if (is_array($v_result) && !empty($v_result['error'])) { return $this->statusLog($historyID, array('stage' => 'backupFilesMultiCall', 'status' => 'error', 'statusMsg' => $v_result['error'], 'statusCode' => 'priv_read_end_central_dir_error')); } else { return $this->statusLog($historyID, array('stage' => 'backupFilesMultiCall', 'status' => 'error', 'statusMsg' => 'Zip-error: Error reading end directory', 'statusCode' => 'zip_error_error_reading_end_directory')); } } // ----- Go to beginning of File @rewind($archive->zip_fd); // ----- Creates a temporay file $v_zip_temp_name = IWP_PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.tmp'; // ----- Open the temporary file in write mode if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb+')) == 0) { $archive->privCloseFd(); $archive->privSwapBackMagicQuotes(); echo 'iwpmsg error3'; return $this->statusLog($historyID, array('stage' => 'backupFilesMultiCall', 'status' => 'error', 'statusMsg' => 'Unable to open temporary file', 'statusCode' => 'unable_to_open_temporary_file')); // ----- Return } // ----- Copy the files from the archive to the temporary file // TBC : Here I should better append the file and go back to erase the central dir $v_size = $v_central_dir['offset']; fseek($archive->zip_fd, $v_size, SEEK_SET); $actualFileSize = iwp_mmb_get_file_size($backup_file); while ($actualFileSize != 0) { $v_read_size = $actualFileSize < IWP_PCLZIP_READ_BLOCK_SIZE ? $actualFileSize : IWP_PCLZIP_READ_BLOCK_SIZE; $v_buffer = fread($archive->zip_fd, $v_read_size); @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); $actualFileSize -= $v_read_size; } // ----- Swap the file descriptor // Here is a trick : I swap the temporary fd with the zip fd, in order to use // the following methods on the temporary fil and not the real archive /* $v_swap = $archive->zip_fd; $archive->zip_fd = $v_zip_temp_fd; $v_zip_temp_fd = $v_swap; */ //usort($p_filedescr_list, "cmp"); //truncate the file after just at the begining of central header fseek($archive->zip_fd, $v_size, SEEK_SET); $truncateResult = ftruncate($archive->zip_fd, $v_size); clearstatcache(); $p_options = array(77021 => true, 77007 => !$is_compressed, 77020 => 63082332); $v_result = 1; $v_header = array(); $p_result_list = array(); $v_header_list = array(); $v_nb = $v_nb_initial = get_iwp_files_db_count('headers'); $v_comment = ''; //$nextCount = $_REQUEST['nextCount']; $omitted_flag = ''; $nextCountHere = 0; $p_filedescr_list_size = get_iwp_files_db_count('files'); iwp_mmb_print_flush("loopStarted"); echo $p_filedescr_list_size; manual_debug('', 'beforeStartingNextLoop', 0); $p_filedescr_list = array(); for ($j = $nextCount; $j < $p_filedescr_list_size && $v_result == 1; $j++) { //new method of getting fileList $p_filedescr_list[$j] = get_from_iwp_files_db($j); // ----- Format the filename $p_filedescr_list[$j]['filename'] = IWPPclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false); // ----- Skip empty file names // TBC : Can this be possible ? not checked in DescrParseAtt ? if ($p_filedescr_list[$j]['filename'] == "") { continue; } // ----- Check the filename if ($p_filedescr_list[$j]['type'] != 'virtual_file' && !file_exists($p_filedescr_list[$j]['filename'])) { echo 'FILE DOESNT EXIST'; } // ----- Look if it is a file or a dir with no all path remove option // or a dir with all its path removed // if ( (is_file($p_filedescr_list[$j]['filename'])) // || ( is_dir($p_filedescr_list[$j]['filename']) if ($p_filedescr_list[$j]['type'] == 'file' || $p_filedescr_list[$j]['type'] == 'virtual_file' || $p_filedescr_list[$j]['type'] == 'folder' && (!isset($p_options[IWP_PCLZIP_OPT_REMOVE_ALL_PATH]) || !$p_options[IWP_PCLZIP_OPT_REMOVE_ALL_PATH])) { $time = microtime(true); $finish_part = $time; $total_time_part = $finish_part - $start; $nextCountHere = $j + 1; /* if(($total_time_part > 2)&&($p_filedescr_list[$j]['size'] > 5000000)) { $p_filedescr_list_omitted[$j] = $p_filedescr_list[$j]; $v_nb++; $nextCount = $v_nb; $omitted_flag = 'set'; continue; } */ // ----- Add the file echo "|"; //global $cur_file; $cur_file = $p_filedescr_list[$j]['filename']; $v_result = $archive->privAddFile($p_filedescr_list[$j], $v_header, $p_options); //saving the header in DB if ($v_result == 1) { $header_save_result = save_in_iwp_files_db(0, array(), $v_header, 'update', $v_nb); } else { $header_save_result = save_in_iwp_files_db(0, array(), array('error' => 1), 'update', $v_nb); } if (is_array($header_save_result) && isset($header_save_result['error'])) { return $this->statusLog($historyID, array('stage' => 'backupFilesMultiCall', 'status' => 'error', 'statusMsg' => 'Zip-error: Error while updating the file "' . $cur_file . '" in the file list table.', 'statusCode' => 'zip_error_while_updating_file_list_table')); } $v_nb++; unset($p_filedescr_list); // ----- Store the file infos //$v_header_list[$v_nb++] = $v_header; if ($v_result != 1) { //$this->statusLog($historyID, array('stage' => 'backupFilesMultiCall', 'status' => 'error', 'statusMsg' => 'SomeError1')); echo "iwpmsg error zipping this file:" . $cur_file; echo 'iwpmsg errorCode - ' . $v_result; $files_with_error[] = $cur_file; if ($v_result == -10) { return $this->statusLog($historyID, array('stage' => 'backupFilesMultiCall', 'status' => 'error', 'statusMsg' => 'Zip-error: Error compressing the file "' . $cur_file . '".Try excluding this file and try again.', 'statusCode' => 'zip_error_while_compressing_file')); } continue; //return $v_result; } } $time = microtime(true); $finish = $time; $total_time = $finish - $this->iwpScriptStartTime; $buffer_size = $zip_split_size * 1024 * 1024 - 3 * 1024 * 1024 * $file_block_size; if ($total_time > $file_loop_break_time || iwp_mmb_get_file_size($backup_file) >= $buffer_size) { if (iwp_mmb_get_file_size($backup_file) >= $buffer_size) { $zip_split_part += 1; $is_new_zip = true; echo "iwpmsg splitting into new zip"; } break; } //iwp_mmb_print_flush("|"); iwp_mmb_auto_print("multiCallZip"); //echo "|"; manual_debug('', "zipLoop", 1000); } echo "iwpmsg loopEnded"; manual_debug('', 'afterNextLoop', 0); $v_offset = @ftell($archive->zip_fd); $v_size = $v_central_dir['size']; /* while ($v_size != 0) { $v_read_size = ($v_size < IWP_PCLZIP_READ_BLOCK_SIZE ? $v_size : IWP_PCLZIP_READ_BLOCK_SIZE); $v_buffer = @fread($v_zip_temp_fd, $v_read_size); @fwrite($archive->zip_fd, $v_buffer, $v_read_size); $v_size -= $v_read_size; } */ clearstatcache(); $endOfFile = iwp_mmb_get_file_size($backup_file); //writing the header which is stored in temp file fseek($archive->zip_fd, $endOfFile, SEEK_SET); fseek($v_zip_temp_fd, 0, SEEK_SET); $v_buffer = fread($v_zip_temp_fd, $v_central_dir['size']); $writeResult = fwrite($archive->zip_fd, $v_buffer); manual_debug('', 'beforeStartingNextHeaderWrite', 0); $v_header_list = array(); //array_pop($v_header_list); //$v_header_list = $p_result_list; // ----- Create the Central Dir files header $total_header_count = get_iwp_files_db_count('headers'); for ($i = $v_nb_initial, $v_count = 0; $i < $total_header_count; $i++) { //getting header list from db $v_header_list[$i] = get_from_iwp_files_db($i, 'thisFileHeader'); // ----- Create the file header if ($v_header_list[$i]['status'] == 'ok') { if (($v_result = $archive->privWriteCentralFileHeader($v_header_list[$i])) != 1) { echo 'iwpmsg error4'; fclose($v_zip_temp_fd); $archive->privCloseFd(); @unlink($v_zip_temp_name); $archive->privSwapBackMagicQuotes(); // ----- Return return $this->statusLog($historyID, array('stage' => 'backupFilesMultiCall', 'status' => 'error', 'statusMsg' => 'Zip-error: Error while writing header', 'statusCode' => 'zip_error_while_writing_header')); //return $v_result; } $v_count++; } // ----- Transform the header to a 'usable' info $archive->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); unset($v_header_list); unset($p_result_list); } manual_debug('', 'afterNextHeaderWrite', 0); // ----- Calculate the size of the central header $v_size = @ftell($archive->zip_fd) - $v_offset; // ----- Create the central dir footer if (($v_result = $archive->privWriteCentralHeader($v_count + $v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) { // ----- Reset the file list echo 'iwpmsg error5'; unset($v_header_list); $archive->privSwapBackMagicQuotes(); return $this->statusLog($historyID, array('stage' => 'backupFilesMultiCall', 'status' => 'error', 'statusMsg' => 'Zip-Error: Error while writing footer', 'statusCode' => 'zip_error_while_writing_footer')); } // ----- Swap back the file descriptor /* $v_swap = $archive->zip_fd; $archive->zip_fd = $v_zip_temp_fd; $v_zip_temp_fd = $v_swap; */ // ----- Close $archive->privCloseFd(); // ----- Close the temporary file @fclose($v_zip_temp_fd); // ----- Magic quotes trick $archive->privSwapBackMagicQuotes(); // ----- Delete the zip file // TBC : I should test the result ... //@unlink($archive->zipname); @unlink($v_zip_temp_name); // ----- Rename the temporary file // TBC : I should test the result ... //@rename($v_zip_temp_name, $archive->zipname); //IWPPclZipUtilRename($v_zip_temp_name, $archive->zipname); $nextCount = $nextCountHere; $size_file_des = get_iwp_files_db_count('files'); if ($nextCount == $size_file_des) { $nextCount = "completed"; $status = "completed"; } else { $status = "partiallyCompleted"; } manual_debug('', 'afterWholeHeaderWrite', 0); $result_arr = array(); $result_arr['response_data']['nextCount'] = $nextCount; $result_arr['status'] = $status; $result_arr['category'] = $category; $result_arr['nextFunc'] = 'backupFilesZIP'; $result_arr['response_data']['include_data'] = $include_data; $result_arr['response_data']['exclude_data'] = $exclude_data; $result_arr['response_data']['backup_file'] = $backup_file; $result_arr['response_data']['backup_url'] = $backup_url; $result_arr['response_data']['account_info'] = $account_info; $result_arr['response_data']['zip_split_part'] = $zip_split_part; $result_arr['response_data']['is_new_zip'] = $is_new_zip; $result_arr['response_data']['files_with_error'] = $files_with_error; $result_arr['response_data']['files_excluded_by_size'] = $files_excluded_by_size; $result_arr['response_data']['get_file_list'] = 'completed'; //$result_arr['response_data']['p_filedescr_list'] = $p_filedescr_list; $resArray = array('responseData' => array('stage' => 'backupFilesNext', 'status' => 'completed'), 'parentHID' => $this->hisID, 'nextFunc' => 'backupFilesZIP', 'status' => $status, 'backupParentHID' => $this->hisID); if ($nextCount == 0 && $nextCount != 'completed') { $this->statusLog($this->hisID, array('stage' => 'backupFiles', 'status' => 'error', 'statusMsg' => 'backupFileNextCallError' . $status, 'responseParams' => $result_arr, 'statusCode' => 'backup_file_next_call_error')); $nextFunc = 'error'; $status = 'error'; return array('error' => 'Must be error', 'error_code' => 'backup_file_next_call_error'); } if ($status == "partiallyCompleted") { echo 'iwpmsg filesNextCount: ' . $nextCount; echo 'iwpmsg totalFilesCount: ' . $p_filedescr_list_size; $result_arr['response_data']['p_filedescr_list'] = array(); unset($p_filedescr_list); $this->statusLog($this->hisID, array('stage' => 'backupFilesMultiCall', 'status' => 'completed', 'statusMsg' => 'nextCall' . $status, 'nextFunc' => 'backupFilesZIP', 'responseParams' => $result_arr)); unset($result_arr); } else { $main_category = $this->getRequiredData($historyID, "category"); //this is where the call goes to backupFiles after DB complete if ($main_category == 'full' && $category != 'fileZipAfterDBZip') { //storing hash values of db-file if any $backup_settings_values['dbFileHashValue'][$historyID] = $this->getHashValuesArray($p_filedescr_list); update_option('iwp_client_multi_backup_temp_values', $backup_settings_values); $result_arr['category'] = 'fileZipAfterDBZip'; $resArray['status'] = 'partiallyCompleted'; $result_arr['nextFunc'] = 'backupFiles'; $result_arr['status'] = 'partiallyCompleted'; $result_arr['response_data']['get_file_list'] = ''; $this->statusLog($this->hisID, array('stage' => 'backupFiles', 'status' => 'completed', 'statusMsg' => 'nextCall' . $status, 'nextFunc' => 'backupFiles', 'responseParams' => $result_arr)); } else { //$this->statusLog($this -> hisID, array('stage' => 'backupFiles', 'status' => 'completed', 'statusMsg' => 'nextCall'.$status, 'responseParams' => $result_arr)); refresh_iwp_files_db(); //truncating table on final call. $paths = array(); $tempPaths = array(); $backup_files_array = $this->get_files_array_from_iwp_part($backup_file); $backup_file = array(); $backup_file = $backup_files_array; $backup_url_array = $this->get_files_array_from_iwp_part($backup_url); $backup_url = array(); $backup_url = $backup_url_array; $size = round($this->get_total_files_size($backup_file) / 1024, 2); if ($size > 1000) { $paths['size'] = round($size / 1024, 2) . " MB"; //Modified by IWP //Mb => MB } else { $paths['size'] = $size . 'KB'; //Modified by IWP //Kb => KB } $paths['backup_name'] = $task_name; $paths['mechanism'] = 'multicall'; $paths['server'] = array('file_path' => $backup_file, 'file_url' => $backup_url); $paths['time'] = time(); $paths['adminHistoryID'] = $historyID; $paths['files_with_error'] = $files_with_error; $paths['files_excluded_by_size'] = $files_excluded_by_size; //$paths['hashValues'] = $this -> getHashValuesArray($p_filedescr_list); //$paths['hashValues'] = array_merge($dbFileHashValue, $paths['hashValues']); unset($p_filedescr_list); $tempPath = $paths; $paths['task_results'][$historyID] = $tempPath; if (empty($account_info)) { //this is where the call goes to upload after backup zip completion .. $resArray['status'] = 'completed'; $tempPath['server']['dbHost'] = DB_HOST; $tempPath['server']['dbName'] = DB_NAME; $tempPath['server']['dbUser'] = DB_USER; $tempPath['server']['dbPassword'] = DB_PASSWORD; $resArray['task_results'][$historyID] = $tempPath; $result_arr['nextFunc'] = 'backupFilesZIPOver'; $result_arr['status'] = 'completed'; } else { $resArray['actual_file_size'] = $size; //necessary for dropbox function $resArray['status'] = 'partiallyCompleted'; $result_arr['nextFunc'] = 'backup_uploads'; $result_arr['status'] = 'partiallyCompleted'; $result_arr['actual_file_size'] = $size; $result_arr['response_data']['backup_file'] = $backup_file; } $this->statusLog($this->hisID, array('stage' => 'backupFiles', 'status' => 'completed', 'statusMsg' => 'nextCall' . $status, 'responseParams' => $result_arr, 'task_result' => $paths)); if ($main_category != 'files' && $category == 'dbZip' || $main_category == 'db') { @unlink(IWP_BACKUP_DIR . '/iwp_db/index.php'); @unlink(DB_NAME); @rmdir(IWP_DB_DIR); } //checking zip corruption if (is_array($backup_file)) { foreach ($backup_file as $key => $single_backup_file) { $verification_result = $this->postBackupVerification($archive, $single_backup_file); if (!$verification_result) { return $this->statusLog($historyID, array('stage' => 'backupFilesMultiCall', 'status' => 'error', 'statusMsg' => 'The zip file was corrupted while zipping', 'responseParams' => $result_arr)); } } } //Remove the old backups (limit) $removed = $this->remove_old_backups($requestParams['task_name']); if (is_array($removed) && isset($removed['error'])) { return $this->statusLog($this->hisID, array('stage' => 'removingBackupFiles', 'status' => 'error', 'statusMsg' => 'Error while removing old backups. (' . $removed['error'] . ')', 'responseParams' => $result_arr, 'statusCode' => 'error_while_removing_old_backups')); } } } return $resArray; }
function fileDetailsExpandManual($absPath, $v_options, $next_file_index = 0) { global $total_FL_count; global $total_count; $total_count++; $this_result = false; if ($total_count >= $next_file_index) { $to_be_expanded_array = array(0 => array('filename' => $absPath)); $v_result = $this->privFileDescrExpand($to_be_expanded_array, $v_options, "getFileList"); if ($v_result == 1 && !empty($to_be_expanded_array)) { foreach ($to_be_expanded_array as $key => $value) { $this_result = save_in_iwp_files_db(0, $value); if (!empty($this_result) && !empty($this_result['break'])) { $total_count = $total_count - 1; $this_result['loop_count'] = $total_count; return $this_result; } } $total_FL_count++; } } return $this_result; }