| 1 |
<?php |
| 2 |
/** |
| 3 |
* Stateless Sync Interface |
| 4 |
*/ |
| 5 |
global $wpdb; |
| 6 |
|
| 7 |
?> |
| 8 |
|
| 9 |
|
| 10 |
<div class="wrap" ng-controller="wpStatelessTools" ng-init="init()"> |
| 11 |
|
| 12 |
<noscript><p><em><?php _e( 'You must enable Javascript in order to proceed!', ud_get_stateless_media()->domain ); ?></em></p></noscript> |
| 13 |
|
| 14 |
<form id="go" ng-submit="processStart($event)"> |
| 15 |
|
| 16 |
<div> |
| 17 |
|
| 18 |
<div class="option"> |
| 19 |
<label> |
| 20 |
<input ng-disabled="isRunning || isLoading" type="radio" name="action" value="regenerate_images" ng-model="action" /> |
| 21 |
<?php _e( 'Regenerate all stateless images and synchronize Google Storage with local server', ud_get_stateless_media()->domain ); ?> |
| 22 |
</label> |
| 23 |
</div> |
| 24 |
|
| 25 |
<div class="option"> |
| 26 |
<label> |
| 27 |
<input ng-disabled="isRunning || isLoading" type="radio" name="action" value="sync_non_images" ng-model="action" /> |
| 28 |
<?php _e( 'Synchronize non-images files between Google Storage and local server', ud_get_stateless_media()->domain ); ?> |
| 29 |
</label> |
| 30 |
</div> |
| 31 |
|
| 32 |
<?php if(!empty($GLOBALS['show_non_library_sync'])):?> |
| 33 |
<div class="option"> |
| 34 |
<label> |
| 35 |
<input ng-disabled="isRunning || isLoading" type="radio" name="action" value="sync_non_library_files" ng-model="action" /> |
| 36 |
<?php _e( 'Synchronize non media library files between Google Storage and local server', ud_get_stateless_media()->domain ); ?> |
| 37 |
</label> |
| 38 |
</div> |
| 39 |
<?php endif;?> |
| 40 |
<?php do_action('stateless_sync_mode');?> |
| 41 |
</div> |
| 42 |
|
| 43 |
<div ng-if="action == 'regenerate_images' && progresses.images || action == 'sync_non_images' && progresses.other"> |
| 44 |
|
| 45 |
<h2><?php _e( 'Method', ud_get_stateless_media()->domain ); ?></h2> |
| 46 |
|
| 47 |
<div class="option"> |
| 48 |
<label> |
| 49 |
<input ng-disabled="isRunning || isLoading" type="radio" name="method" value="start" ng-model="$parent.method" /> |
| 50 |
<?php _e( 'Start a new process', ud_get_stateless_media()->domain ); ?> |
| 51 |
<span class="notice notice-warning" style="margin-left:20px;"> |
| 52 |
<?php _e( '<strong>Warning:</strong> This will make it impossible to continue the last process.', ud_get_stateless_media()->domain ); ?> |
| 53 |
</span> |
| 54 |
</label> |
| 55 |
</div> |
| 56 |
|
| 57 |
<div class="option"> |
| 58 |
<label> |
| 59 |
<input ng-disabled="isRunning || isLoading" type="radio" name="method" value="continue" ng-model="$parent.method" /> |
| 60 |
<?php _e( 'Continue the last process', ud_get_stateless_media()->domain ); ?> |
| 61 |
</label> |
| 62 |
</div> |
| 63 |
|
| 64 |
<div class="start-form" ng-if="method == 'continue'"> |
| 65 |
<h3> |
| 66 |
<?php _e( 'Start sync from', ud_get_stateless_media()->domain ); ?> |
| 67 |
</h3> |
| 68 |
<div> |
| 69 |
<input ng-disabled="isRunning || isLoading" type="number" name="startFrom" ng-model="$parent.startFrom" /> |
| 70 |
<br /> |
| 71 |
<p class="description" style="margin-top: 11px;"> |
| 72 |
<?php _e( 'Enter attachment ID from which you want to restart the sync process, will also include attachments added after you started the first sync. The sync process start from new attachment to old attachments.', ud_get_stateless_media()->domain ); ?> |
| 73 |
</p> |
| 74 |
</div> |
| 75 |
</div> |
| 76 |
|
| 77 |
</div> |
| 78 |
|
| 79 |
<div ng-if="(action == 'regenerate_images' && fails.images) || (action == 'sync_non_images' && fails.other)"> |
| 80 |
|
| 81 |
<h2><?php _e( 'Fix errors', ud_get_stateless_media()->domain ); ?></h2> |
| 82 |
|
| 83 |
<div class="option"> |
| 84 |
<label> |
| 85 |
<input ng-disabled="isRunning || isLoading" type="checkbox" name="method" ng-true-value="'fix'" ng-model="$parent.method" /> |
| 86 |
<?php _e( 'Try to fix previously failed items', ud_get_stateless_media()->domain ); ?> |
| 87 |
<span class="notice notice-warning" style="margin-left:20px;"> |
| 88 |
<?php _e( '<strong>Warning:</strong> This will make it impossible to continue the last process.', ud_get_stateless_media()->domain ); ?> |
| 89 |
</span> |
| 90 |
</label> |
| 91 |
</div> |
| 92 |
|
| 93 |
</div> |
| 94 |
|
| 95 |
<div ng-if="bucket_folder !== '' && (action == 'regenerate_images' || action == 'sync_non_images')"> |
| 96 |
|
| 97 |
<h2><?php _e( 'Use Bucket Folder setting', ud_get_stateless_media()->domain ); ?></h2> |
| 98 |
|
| 99 |
<div class="option"> |
| 100 |
<label> |
| 101 |
<input ng-disabled="isRunning || isLoading" type="checkbox" name="use_wildcards" ng-true-value="'1'" ng-model="$parent.use_wildcards" /> |
| 102 |
<?php _e( 'Use Bucket Folder setting', ud_get_stateless_media()->domain ); ?> |
| 103 |
<span class="notice notice-warning" style="margin-left:20px;"> |
| 104 |
<?php _e( '<strong>Warning:</strong> This will replace existing files to new folder', ud_get_stateless_media()->domain ); ?> |
| 105 |
</span> |
| 106 |
</label> |
| 107 |
</div> |
| 108 |
|
| 109 |
</div> |
| 110 |
|
| 111 |
<div> |
| 112 |
|
| 113 |
<h2><?php _e( 'Bulk Size', ud_get_stateless_media()->domain ); ?></h2> |
| 114 |
|
| 115 |
<div class="option"> |
| 116 |
<label> |
| 117 |
<input ng-disabled="isRunning || isLoading" type="number" name="bulk_size" ng-model="bulk_size" /> |
| 118 |
<?php _e( 'How many items to process at once', ud_get_stateless_media()->domain ); ?> |
| 119 |
</label> |
| 120 |
</div> |
| 121 |
|
| 122 |
</div> |
| 123 |
|
| 124 |
<div class="status ud-admin-notice {{error?'error':'notice'}}" ng-show="status"> |
| 125 |
<p> |
| 126 |
<?php _e( 'Status:', ud_get_stateless_media()->domain ); ?> {{status}} |
| 127 |
<span class="button button-secondary" ng-show="extraStatus" ng-click="showErrorDetails = !showErrorDetails"><?php _e( 'Details', ud_get_stateless_media()->domain ); ?></span> |
| 128 |
</p> |
| 129 |
<div id="sm-error-details" class="extra-info" ng-show="extraStatus && showErrorDetails" ng-bind-html="extraStatus | trust"></div> |
| 130 |
</div> |
| 131 |
|
| 132 |
<div ng-show="isRunning" id="regenthumbs-bar" style="position:relative;height:25px;"> |
| 133 |
<div id="regenthumbs-bar-percent" style="position:absolute;left:50%;top:50%;width:300px;margin-left:-150px;height:25px;margin-top:-9px;font-weight:bold;text-align:center;"></div> |
| 134 |
</div> |
| 135 |
|
| 136 |
<ol ng-show="log.length" id="regenthumbs-debuglist"> |
| 137 |
<li ng-repeat="l in log">{{l.message}}</li> |
| 138 |
</ol> |
| 139 |
|
| 140 |
<div class="buttons"> |
| 141 |
<button ng-disabled="isRunning || isLoading" type="submit" class="button-primary"><?php _e( 'Run (may take a while)' ); ?></button> |
| 142 |
<div ng-disabled="!isRunning" ng-click="processStop($event)" class="button-secondary"><?php _e( 'Stop' ); ?></div> |
| 143 |
<div ng-disabled="!log.length" ng-click="log=[]" class="button-secondary"><?php _e( 'Clear Log' ); ?></div> |
| 144 |
</div> |
| 145 |
|
| 146 |
</form> |
| 147 |
|
| 148 |
</div> |