From 1923a1c203fe0404b96a8f532ab55628983b1504 Mon Sep 17 00:00:00 2001 From: balexey88 Date: Mon, 15 Apr 2024 23:27:28 +0300 Subject: [PATCH] 4.0.3, Info section and minor fixes --- changelog.txt | 14 + changes.md | 14 + .../batch/class-batch-task-manager.php | 4 +- lib/classes/class-addons.php | 2 +- lib/classes/class-bootstrap.php | 56 ++- lib/classes/class-db.php | 24 +- lib/classes/class-dynamic-image-support.php | 2 +- lib/classes/class-gs-client.php | 7 +- lib/classes/class-migrator.php | 4 + lib/classes/class-settings.php | 75 ++++ lib/classes/class-sync-non-media.php | 4 +- lib/classes/class-utility.php | 11 +- lib/classes/status/class-info-stateless.php | 393 ++++++++++++++++++ lib/classes/status/class-info.php | 360 ++++++++++++++-- lib/classes/status/class-migrations.php | 4 + lib/classes/sync/class-background-sync.php | 5 +- readme.txt | 16 +- static/scripts/wp-stateless-settings.js | 18 + static/styles/wp-stateless-settings.css | 19 + static/styles/wp-stateless-status.css | 76 +++- static/views/settings-sections/file-url.php | 2 +- .../google-cloud-storage.php | 2 +- static/views/settings_interface.php | 6 +- static/views/status-sections/info.php | 52 ++- vendor/composer/autoload_classmap.php | 1 + vendor/composer/autoload_static.php | 1 + vendor/composer/installed.php | 4 +- wp-stateless-media.php | 2 +- 28 files changed, 1066 insertions(+), 112 deletions(-) create mode 100644 lib/classes/status/class-info-stateless.php diff --git a/changelog.txt b/changelog.txt index 098c7518..8a0e6f0b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,18 @@ == Changelog == += 4.0.3 = +* NEW - added `Info` section to the `Status` tab on the Settings page, which contains the system info and the ability to copy report to clipboard. +* ENHANCEMENT - added `Documentation` link on the Plugins page. +* ENHANCEMENT - added `Addons` link on the Plugins page. +* ENHANCEMENT - added `Documentation` link on the Settings page. +* FIX - fixed `Settings` shortcut on the Plugins page. +* FIX - in multisite network, do not show Data Optimization on the Network Admin Page. +* FIX - properly set `Content Disposition` fields for media objects. +* FIX - properly use `Cache Control` setting for media objects. +* FIX - fixed `Creation of dynamic property` PHP deprecation notice. +* FIX - fixed `Cannot use ::class with dynamic class name` PHP warning. +* FIX - avoid PHP warning when unable to get file path in `Stateless` mode [728](https://github.com/udx/wp-stateless/issues/728). +* FIX - fixed links to the constants documentation. + = 4.0.2 = * FIX - in multisite network, deleting site can potentially remove WP-Stateless tables from another site. * COMPATIBILITY - Gravity Forms Compatibility updated for the newest Gravity Forms version. diff --git a/changes.md b/changes.md index f793a0fc..3218024b 100644 --- a/changes.md +++ b/changes.md @@ -1,3 +1,17 @@ +#### 4.0.3 +* NEW - added `Info` section to the `Status` tab on the Settings page, which contains the system info and the ability to copy report to clipboard. +* ENHANCEMENT - added `Documentation` link on the Plugins page. +* ENHANCEMENT - added `Addons` link on the Plugins page. +* ENHANCEMENT - added `Documentation` link on the Settings page. +* FIX - fixed `Settings` shortcut on the Plugins page. +* FIX - in multisite network, do not show Data Optimization on the Network Admin Page. +* FIX - properly set `Content Disposition` fields for media objects. +* FIX - properly use `Cache Control` setting for media objects. +* FIX - fixed `Creation of dynamic property` PHP deprecation notice. +* FIX - fixed `Cannot use ::class with dynamic class name` PHP warning. +* FIX - avoid PHP warning when unable to get file path in `Stateless` mode [728](https://github.com/udx/wp-stateless/issues/728). +* FIX - fixed links to the constants documentation. + #### 4.0.2 * FIX - in multisite network, deleting site can potentially remove WP-Stateless tables from another site. * COMPATIBILITY - Gravity Forms Compatibility updated for the newest Gravity Forms version. diff --git a/lib/classes/batch/class-batch-task-manager.php b/lib/classes/batch/class-batch-task-manager.php index ab800e26..39270d8a 100644 --- a/lib/classes/batch/class-batch-task-manager.php +++ b/lib/classes/batch/class-batch-task-manager.php @@ -230,7 +230,7 @@ protected function complete() { // Check if we have more batched to run try { $object = $this->_get_batch_task_object(); - $class = $object::class; + $class = get_class($object); $batch = $object->get_batch(); if ( !empty($batch) ) { @@ -242,7 +242,7 @@ protected function complete() { return; } - Helper::log( 'Batch task completed: ' . $object::class ); + Helper::log( 'Batch task completed: ' . $class ); } catch (\Throwable $e) { Helper::log( "Unable to process next batch: " . $e->getMessage() ); } diff --git a/lib/classes/class-addons.php b/lib/classes/class-addons.php index 01826d0a..25b1f46d 100644 --- a/lib/classes/class-addons.php +++ b/lib/classes/class-addons.php @@ -203,7 +203,7 @@ private function get_addons_view($addons) { $plugin_desc = __('Provides compatibility between the %s and the WP-Stateless plugins.', ud_get_stateless_media()->domain); $theme_desc = __('Provides compatibility between the %s theme and the WP-Stateless plugin.', ud_get_stateless_media()->domain); - $link = 'https://stateless.udx.io/addons/%s'; + $link = ud_get_stateless_media()->get_docs_page_url('addons/%s'); $defaults = [ 'title' => '', diff --git a/lib/classes/class-bootstrap.php b/lib/classes/class-bootstrap.php index dd35f4b4..0d747c02 100644 --- a/lib/classes/class-bootstrap.php +++ b/lib/classes/class-bootstrap.php @@ -356,12 +356,9 @@ private function _init_filters($type = '') { } /** - * Override Cache Control is option is enabled + * Override Cache Control if option is enabled */ - $cacheControl = trim($this->get('sm.cache_control')); - if (!empty($cacheControl)) { - add_filter('sm:item:cacheControl', array($this, 'override_cache_control')); - } + add_filter('sm:item:cacheControl', array($this->settings, 'override_cache_control')); add_filter('wp_stateless_file_name', array($this, 'handle_root_dir'), 10, 4); @@ -645,6 +642,18 @@ public function get_settings_page_url($path = '') { return $url . $path; } + /** + * Return docs page url. + * + * @param string $path + * @return string + */ + public function get_docs_page_url($path = '') { + $path = ltrim($path, '/'); + + return 'https://stateless.udx.io/' . $path; + } + /** * Get new blog settings once switched blog. * @param $new_blog @@ -1190,26 +1199,6 @@ public function _convert_to_gs_link($meta, $image_host, $url, $file_ext) { return $meta; } - /** - * @param $links - * @param $file - * @return mixed - */ - public function plugin_action_links($links, $file) { - - if ($file == plugin_basename(dirname(__DIR__) . '/wp-stateless-media.php')) { - $settings_link = '' . __('Settings', 'ssd') . ''; - array_unshift($links, $settings_link); - } - - if ($file == plugin_basename(dirname(__DIR__) . '/wp-stateless.php')) { - $settings_link = '' . __('Settings', 'ssd') . ''; - array_unshift($links, $settings_link); - } - - return $links; - } - /** * Determines if plugin is loaded via mu-plugins * or Network Enabled. @@ -1265,7 +1254,7 @@ public function admin_init() { wp_register_script('wp-stateless-select2', ud_get_stateless_media()->path('static/scripts/select2.min.js', 'url'), array('jquery'), self::$version, true); /* Stateless settings page */ - wp_register_script('wp-stateless-settings', ud_get_stateless_media()->path('static/scripts/wp-stateless-settings.js', 'url'), array(), self::$version); + wp_register_script('wp-stateless-settings', ud_get_stateless_media()->path('static/scripts/wp-stateless-settings.js', 'url'), array('clipboard'), self::$version); wp_localize_script('wp-stateless-settings', 'stateless_l10n', $this->get_l10n_data()); wp_register_style('wp-stateless-settings', $this->path('static/styles/wp-stateless-settings.css', 'url'), array(), self::$version); @@ -1371,7 +1360,7 @@ public function admin_enqueue_scripts($hook) { 'title' => sprintf(__("Stateless and Ephemeral modes enables and requires the Cache-Busting option.", ud_get_stateless_media()->domain)), 'message' => sprintf(__("WordPress looks at local files to prevent files with the same filenames. Since Stateless mode bypasses this check, there is a potential for files to be stored with the same file name. We enforce the Cache-Busting option to prevent this. - Override with the %s constant.", ud_get_stateless_media()->domain), "https://stateless.udx.io/docs/constants/#wp_stateless_media_cache_busting", "WP_STATELESS_MEDIA_CACHE_BUSTING"), + Override with the %s constant.", ud_get_stateless_media()->domain), ud_get_stateless_media()->get_docs_page_url('docs/constants/#wpstatelessmediacachebusting'), "WP_STATELESS_MEDIA_CACHE_BUSTING"), ); echo "