Changeset 2639590
- Timestamp:
- 12/05/2021 03:46:27 AM (4 years ago)
- Location:
- b2-sync/trunk
- Files:
-
- 7 edited
-
README.md (modified) (2 diffs)
-
b2-sync.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
src/Core/AdminLogPage.php (modified) (1 diff)
-
src/Core/SyncClass.php (modified) (1 diff)
-
src/Core/Utils.php (modified) (1 diff)
-
views/admin/page_log.twig (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
b2-sync/trunk/README.md
r2639404 r2639590 4 4 **Requires at least:** 4.7 5 5 **Tested up to:** 5.8.2 6 **Stable tag:** 1. 1.06 **Stable tag:** 1.2.0 7 7 **Requires PHP:** 7.2 8 8 **License:** GPLv2 or later 9 **License URI:** https://www.gnu.org/licenses/gpl-2.0.html 9 **License URI:** https://www.gnu.org/licenses/gpl-2.0.html 10 10 11 11  … … 62 62 ## Changelog ## 63 63 64 = 1.2.0 (December 5, 2021) = 65 * FIX: the process was blocking with wait(), let us try to make it async as getting real-time output and being async is a challenge 66 * Enhancement: display all lines in the log henceforth so that user can see what is happening from start to end 67 64 68 = 1.1.0 (December 4, 2021) = 65 66 69 * New Feature: see real-time output on the log screen 67 70 * Enhancement: Allow the system to check if a sync process is already running so tha we prevent triggering any duplicate sync process -
b2-sync/trunk/b2-sync.php
r2639401 r2639590 13 13 * Plugin URI: https://github.com/wkhayrattee/b2-sync 14 14 * Description: A WordPress plugin to sync assets files from wp-content/uploads onto a Backblaze B2 bucket 15 * Version: 1. 1.015 * Version: 1.2.0 16 16 * Requires at least: 5.7.0 17 17 * Requires PHP: 7.2 … … 53 53 */ 54 54 define('B2Sync_DS', DIRECTORY_SEPARATOR); 55 define('B2Sync_VERSION', '1. 1.0');55 define('B2Sync_VERSION', '1.2.0'); 56 56 define('B2Sync_MINIMUM_WP_VERSION', '5.7'); 57 57 define('B2Sync_PLUGIN_DIR_URL', plugin_dir_url(__FILE__)); //has trailing slash at end -
b2-sync/trunk/readme.txt
r2639405 r2639590 4 4 Requires at least: 4.7 5 5 Tested up to: 5.8.2 6 Stable tag: 1. 1.06 Stable tag: 1.2.0 7 7 Requires PHP: 7.2 8 8 License: GPLv2 or later … … 64 64 == Changelog == 65 65 66 = 1.2.0 (December 5, 2021) = 67 * FIX: the process was blocking with wait(), let us try to make it async as getting real-time output and being async is a challenge 68 * Enhancement: display all lines in the log henceforth so that user can see what is happening from start to end 69 66 70 = 1.1.0 (December 4, 2021) = 67 71 * New Feature: see real-time output on the log screen -
b2-sync/trunk/src/Core/AdminLogPage.php
r2639397 r2639590 112 112 } 113 113 114 //We only want to display the latest 10 entries 115 if ($max_lines < $lines) { 116 for ($i = 0; $i < ($lines - $max_lines); ++$i) { 117 unset($log_data_array[$i]); 118 } 119 } 114 //We only want to display the latest 100 entries 115 //NOTE: Let's now display everything, so commenting the below 116 // if ($max_lines < $lines) { 117 // for ($i = 0; $i < ($lines - $max_lines); ++$i) { 118 // unset($log_data_array[$i]); 119 // } 120 // } 120 121 121 122 //now fetch all lines -
b2-sync/trunk/src/Core/SyncClass.php
r2639397 r2639590 145 145 $remote_path, 146 146 ]); 147 $process->start(); 147 $process->setTimeout(3600); 148 149 //allow time process to start 150 usleep(100); 151 152 /** 153 * - Start process Asynchronously 154 * - Get real-time Process Output (from rclone) 155 */ 156 $process->start(function ($type, $buffer) { 157 B2Sync_logthis('[rclone]: ' . $buffer); 158 }); 159 160 //we also need to check any timeout issues 161 while ($process->isRunning()) { 162 $process->checkTimeout(); 163 } 148 164 149 165 /** 150 166 * Getting real-time Process Output (from rclone) 151 167 * Waits until the given anonymous function returns true 168 * [warning]: the below was obviously blocking 152 169 */ 153 $process->waitUntil(function ($type, $output) {154 B2Sync_logthis('[rclone]: ' . $output);155 156 return $output === 'Ready. Waiting for commands...';157 });170 // $process->waitUntil(function ($type, $output) { 171 // B2Sync_logthis('[rclone]: ' . $output); 172 // 173 // return $output === 'Ready. Waiting for commands...'; 174 // }); 158 175 159 176 if ($process->isSuccessful()) { -
b2-sync/trunk/src/Core/Utils.php
r2639397 r2639590 111 111 $error_msg = '[ERROR] the software "rclone" does not seem to be present on your server, please ask your server admin to install it before using this plugin'; 112 112 } else { 113 B2Sync_logthis('[INFO] A Sync was triggered by action: ' . $action);114 115 113 //Clear log file before starting next sync 116 114 $error_log_file = WP_CONTENT_DIR . B2Sync_DS . Enum::LOG_FILE_ERROR; 117 115 AdminLogPage::clearErrorLog($error_log_file); 118 116 117 B2Sync_logthis('[INFO] A Sync was triggered by action: ' . $action); 118 119 119 $sync = new SyncClass(); 120 120 if ($sync->field_status == Enum::FIELD_STATUS_VALUE_OFF) { 121 121 $error_msg = '[ERROR] Please enable the sync below in the dropdown or one of the field(s) is empty!'; 122 123 B2Sync_logthis('[ERROR] ' . $error_msg); 122 124 } else { 123 125 $error_msg = '[INFO] Syncing has started, check the log on the sub-menu ' . Enum::ADMIN_LOG_MENU_TITLE . ' page'; 126 124 127 $sync->start(); 125 128 } -
b2-sync/trunk/views/admin/page_log.twig
r2639397 r2639590 5 5 <table class="form-table"> 6 6 <tr> 7 <td>(<u>Only the latest 100 entries will be displayed</u> - pay attention to the DATE!)</td> 7 <td><u>Every line in the log file is being displayed</u></td> 8 </tr> 9 <tr> 10 <td>The log file <strong>is cleared for every sync process</strong> that is launched so that you get fresh output each time</td> 8 11 </tr> 9 12 <tr>
Note: See TracChangeset
for help on using the changeset viewer.