Skip to content

Commit

Permalink
Lastest Cafe changes 5.0.12.p
Browse files Browse the repository at this point in the history
  • Loading branch information
Pebblo committed Nov 29, 2023
1 parent c63335f commit a489b2b
Show file tree
Hide file tree
Showing 314 changed files with 10,538 additions and 76,581 deletions.
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Releases

### [5.0.12]

#### Added
- [Add Yesterday View to Registrations Admin List Table (#971)](https://github.com/eventespresso/cafe/pull/971)

#### Fixed
- [Fix Admin UI Styles (#902)](https://github.com/eventespresso/cafe/pull/902)
- [Fix Transaction Admin Payment Currency Formatting (#931)](https://github.com/eventespresso/cafe/pull/931)
- [Don't Duplicate Default Prices When Duplicating Event (#932)](https://github.com/eventespresso/cafe/pull/932)
- [Fix or Suppress PHP 8.2 Warnings (#936)](https://github.com/eventespresso/cafe/pull/936)
- [Add Class Loader for EE_Transaction_Processor (#950)](https://github.com/eventespresso/cafe/pull/950)
- [Fix Registrations Report CSV Question Order (#946)](https://github.com/eventespresso/cafe/pull/946)
- [Add Styes for Multi-Select Inputs (#943)](https://github.com/eventespresso/cafe/pull/943)
- [Fix Promotions Tax Line Items (#851)](https://github.com/eventespresso/cafe/pull/851)
- [Fix PHP 8.2 Warnings III (#968)](https://github.com/eventespresso/cafe/pull/968)
- [Relax Onsite Gateway URL Prop Type (#964)](https://github.com/eventespresso/cafe/pull/964)

#### Changed
- [BM 5.0.11 changes (#926)](https://github.com/eventespresso/cafe/pull/926)
- [Refactor Maintenance Mode (#852)](https://github.com/eventespresso/cafe/pull/852)
- [Refactor Cron Jobs (#853)](https://github.com/eventespresso/cafe/pull/853)
- [Double Varchar Size for Extra Join Model IDs (#939)](https://github.com/eventespresso/cafe/pull/939)
- [Dont Map Meta Caps if Cap is NULL (#938)](https://github.com/eventespresso/cafe/pull/938)
- [Optimize DB Table Indexes (#949)](https://github.com/eventespresso/cafe/pull/949)
- [Reduce the number of queries used when multiple datetimes are assigned to a ticket (#955)](https://github.com/eventespresso/cafe/pull/955)
- [Add New Feature Flags Admin UI (Barista#1269) (#957)](https://github.com/eventespresso/cafe/pull/957)
- [Fix RTE Button Active State Styles (Barista#1242) (#958)](https://github.com/eventespresso/cafe/pull/958)
- [Fix Required Ticket Sort Order in EDTR (Barista#1244) (#959)](https://github.com/eventespresso/cafe/pull/959)
- [Fix or Suppress PHP 8.2 Warnings Part II (#947)](https://github.com/eventespresso/cafe/pull/947)
- [Add credit card parameter for E2E tests for PayPal Commerce (Barista#1273) (#961)](https://github.com/eventespresso/cafe/pull/961)
- [More query optimizations (#962)](https://github.com/eventespresso/cafe/pull/962)
- [Increase Query Limit to 250 (Barista#1274) (#972)](https://github.com/eventespresso/cafe/pull/972)
- [Undo Changes Made to Cron Jobs in #853 (#967)](https://github.com/eventespresso/cafe/pull/967)
- [Increase GQL Query Limit to 250 (#969)](https://github.com/eventespresso/cafe/pull/969)



### [5.0.11]

#### Added
Expand Down
8 changes: 4 additions & 4 deletions PaymentMethods/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
use EE_Error;
use EE_Payment_Method;
use EEM_Payment_Method;
use EventEspresso\core\domain\services\database\DbStatus;
use EventEspresso\core\services\loaders\LoaderFactory;
use EventEspresso\core\services\request\RequestInterface;
use ReflectionException;
use EE_Maintenance_Mode;

/**
* Class EventEspresso\PaymentMethods\Manager
Expand All @@ -25,9 +25,9 @@ class Manager
* List of PMs that can be replaced with PP Commerce.
* ['payment method name' => 'settings option']
*
* @var $pms_can_hide
* @var array $pms_can_hide
*/
protected static $pms_can_hide = [
protected static array $pms_can_hide = [
'paypal_express' => 'api_username',
'paypal_pro' => 'api_username',
'aim' => 'login_id',
Expand All @@ -39,7 +39,7 @@ class Manager
*/
public function __construct()
{
if (! EE_Maintenance_Mode::instance()->models_can_query()) {
if (DbStatus::isOffline()) {
return;
}
$this->loadPaymentMethods();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use EventEspresso\core\domain\services\database\DbStatus;
use EventEspresso\core\services\request\DataType;
use EventEspresso\PaymentMethods\PayPalCommerce\api\orders\CaptureOrder;
use EventEspresso\PaymentMethods\PayPalCommerce\api\orders\CreateOrder;
Expand Down Expand Up @@ -57,7 +58,7 @@ public static function set_hooks()
*/
public static function set_hooks_admin()
{
if (EE_Maintenance_Mode::instance()->models_can_query()) {
if (DbStatus::isOnline()) {
// Create an Order.
add_action('wp_ajax_eeaPpCreateOrder', [__CLASS__, 'createOrderRequest']);
add_action('wp_ajax_nopriv_eeaPpCreateOrder', [__CLASS__, 'createOrderRequest']);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use EventEspresso\core\domain\services\database\DbStatus;
use EventEspresso\PaymentMethods\PayPalCommerce\api\partners\TrackSellerOnboarding;
use EventEspresso\PaymentMethods\PayPalCommerce\api\PayPalApi;
use EventEspresso\PaymentMethods\PayPalCommerce\domain\Domain;
Expand Down Expand Up @@ -56,7 +57,7 @@ public static function set_hooks()
*/
public static function set_hooks_admin()
{
if (EE_Maintenance_Mode::instance()->models_can_query()) {
if (DbStatus::isOnline()) {
// Get onboarding URL.
add_action('wp_ajax_eeaPpGetOnboardingUrl', [__CLASS__, 'getOnboardingUrl']);
// Get the seller access token.
Expand Down
7 changes: 4 additions & 3 deletions admin_pages/about/About_Admin_Page.core.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use EventEspresso\core\domain\services\database\DbStatus;

/**
*
* EE_About_Admin_Page
Expand Down Expand Up @@ -148,7 +150,7 @@ public function load_scripts_styles()

protected function _whats_new()
{
/*$steps = EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ? $this->_get_started_steps() : FALSE;
/*$steps = EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::STATUS_FULL_SITE ? $this->_get_started_steps() : FALSE;
$steps = $steps !== FALSE ? $steps : '';
$this->_admin_page_title = sprintf( esc_html__('Welcome to Event Espresso %s', 'event_espresso'), EVENT_ESPRESSO_VERSION );
$settings_message = $steps;
Expand All @@ -168,8 +170,7 @@ protected function _overview()
$this->display_about_admin_page();*/

// Copied from _whats_new()
$steps = EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance
? $this->_get_started_steps() : false;
$steps = DbStatus::isOnline() ? $this->_get_started_steps() : false;
$steps = $steps !== false ? $steps : '';
$this->_admin_page_title = sprintf(
esc_html__('Welcome to Event Espresso %s', 'event_espresso'),
Expand Down
4 changes: 3 additions & 1 deletion admin_pages/about/templates/ee4-overview.template.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

use EventEspresso\core\domain\services\database\MaintenanceStatus;

// maintenance mode on?
if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
if (MaintenanceStatus::isFullSite()) {
?>
<div class="ee-attention">
<h2 class="ee-maintenance-mode-callout">
Expand Down
4 changes: 3 additions & 1 deletion admin_pages/about/templates/whats_new.template.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
// comment out the following two lines if version is a major release
use EventEspresso\core\domain\services\database\MaintenanceStatus;

$type = 'minor';
$heading = _n('Minor Release Information', 'Minor Releases', 1, 'event_espresso');

Expand Down Expand Up @@ -36,7 +38,7 @@
<div class="changelog">
<?php
// maintenance mode on?
if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
if (MaintenanceStatus::isFullSite()) {
?>
<div class="ee-attention">
<h2 class="ee-maintenance-mode-callout">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Event_Categories_Admin_List_Table extends EE_Admin_List_Table
/**
* @var Events_Admin_Page $_admin_page
*/
protected $_admin_page;
protected EE_Admin_Page $_admin_page;


/**
Expand Down
2 changes: 1 addition & 1 deletion admin_pages/events/Events_Admin_List_Table.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Events_Admin_List_Table extends EE_Admin_List_Table
/**
* @var Events_Admin_Page
*/
protected $_admin_page;
protected EE_Admin_Page $_admin_page;

/**
* @var EE_Datetime
Expand Down
12 changes: 8 additions & 4 deletions admin_pages/events/Events_Admin_Page.core.php
Original file line number Diff line number Diff line change
Expand Up @@ -1967,15 +1967,19 @@ public function get_events(int $per_page = 10, int $current_page = 1, bool $coun
$end = $DateTime->getTimestamp();
$where['Datetime.DTT_EVT_start'] = ['BETWEEN', [$start, $end]];
} elseif ($status === 'today') {
$DateTime =
new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
$DateTime = new DateTime(
'now',
new DateTimeZone(EEM_Event::instance()->get_timezone())
);
$start = $DateTime->setTime(0, 0)->format(implode(' ', $start_formats));
$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
$where['Datetime.DTT_EVT_start'] = ['BETWEEN', [$start, $end]];
} elseif ($status === 'month') {
$now = date('Y-m-01');
$DateTime =
new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
$DateTime = new DateTime(
$now,
new DateTimeZone(EEM_Event::instance()->get_timezone())
);
$start = $DateTime->setTime(0, 0)->format(implode(' ', $start_formats));
$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))
->setTime(23, 59, 59)
Expand Down
1 change: 0 additions & 1 deletion admin_pages/events/assets/event-editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
margin-inline: 0;
margin-block: 0;
max-width: 100%;
min-width: unset;
padding-inline-end: var(--ee-padding-nano);
padding-inline-start: var(--ee-padding-nano);
width: 100%;
Expand Down
4 changes: 4 additions & 0 deletions admin_pages/events/assets/events-admin-page.css
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,7 @@
line-height: 1.1;
}

.espresso-admin.wp-core-ui .ee-status.event-active-status {
white-space: nowrap;
}

34 changes: 16 additions & 18 deletions admin_pages/maintenance/Maintenance_Admin_Page.core.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use EventEspresso\core\domain\entities\DbSafeDateTime;
use EventEspresso\core\domain\services\database\MaintenanceStatus;
use EventEspresso\core\libraries\batch\JobHandlers\DatetimeOffsetFix;

/**
Expand Down Expand Up @@ -211,11 +212,10 @@ public function _maintenance()
// it all depends on if we're in maintenance model level 1 (frontend-only) or
// level 2 (everything except maintenance page)
try {
// get the current maintenance level and check if
// we are removed
$mMode_level = $this->maintenance_mode->level();
$placed_in_mm = $this->maintenance_mode->set_maintenance_mode_if_db_old();
if ($mMode_level == EE_Maintenance_Mode::level_2_complete_maintenance && ! $placed_in_mm) {
// get the current maintenance level and check if we are removed
$was_full_site_maintenence_mode = MaintenanceStatus::isFullSite();
$no_longer_in_maintenence_mode = ! $this->maintenance_mode->set_maintenance_mode_if_db_old();
if ($was_full_site_maintenence_mode && $no_longer_in_maintenence_mode) {
// we just took the site out of maintenance mode, so notify the user.
// unfortunately this message appears to be echoed on the NEXT page load...
// oh well, we should really be checking for this on addon deactivation anyways
Expand All @@ -228,12 +228,10 @@ public function _maintenance()
$this->_process_notices(['page' => 'espresso_maintenance_settings']);
}
// in case an exception is thrown while trying to handle migrations
if ($mMode_level === EE_Maintenance_Mode::level_2_complete_maintenance) {
if (MaintenanceStatus::isFullSite()) {
$show_maintenance_switch = false;
$show_migration_progress = true;
if (isset($this->_req_data['continue_migration'])) {
$show_backup_db_text = false;
} else {
if (! isset($this->_req_data['continue_migration'])) {
$show_backup_db_text = true;
}
$scripts_needing_to_run =
Expand Down Expand Up @@ -270,8 +268,8 @@ public function _maintenance()
&& $most_recent_migration->is_broken()
)
) {
$this->_template_path =
EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_was_borked_page.template.php';
$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_was_borked_page.template.php';

$this->_template_args['support_url'] = 'https://eventespresso.com/support/forums/';
$this->_template_args['next_url'] = EEH_URL::add_query_args_and_nonce(
[
Expand Down Expand Up @@ -306,7 +304,7 @@ public function _maintenance()
[
'current_db_state' => sprintf(
esc_html__("EE%s (%s)", "event_espresso"),
isset($current_db_state[ $plugin_slug ]) ? $current_db_state[ $plugin_slug ] : 3,
$current_db_state[ $plugin_slug ] ?? 3,
$plugin_slug
),
'next_db_state' => sprintf(
Expand All @@ -317,8 +315,8 @@ public function _maintenance()
]
);
} else {
$this->_template_args['current_db_state'] = null;
$this->_template_args['next_db_state'] = null;
$this->_template_args['current_db_state'] = '';
$this->_template_args['next_db_state'] = '';
}
$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_page.template.php';
$this->_template_args = array_merge(
Expand Down Expand Up @@ -642,7 +640,7 @@ public function _confirm_migration_crash_report_sent()
*/
public function _reset_db($nuke_old_ee4_data = true)
{
$this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
$this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::STATUS_OFF);
if ($nuke_old_ee4_data) {
EEH_Activation::delete_all_espresso_cpt_data();
EEH_Activation::delete_all_espresso_tables_and_data(false);
Expand All @@ -664,7 +662,7 @@ public function _reset_db($nuke_old_ee4_data = true)
*/
public function _delete_db()
{
$this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
$this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::STATUS_OFF);
EEH_Activation::delete_all_espresso_cpt_data();
EEH_Activation::delete_all_espresso_tables_and_data();
EEH_Activation::remove_cron_tasks();
Expand All @@ -682,12 +680,12 @@ public function _delete_db()
*/
public function _rerun_migration_from_ee3()
{
$this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
$this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::STATUS_OFF);
EEH_Activation::delete_all_espresso_cpt_data();
EEH_Activation::delete_all_espresso_tables_and_data(false);
// set the db state to something that will require migrations
update_option(EE_Data_Migration_Manager::current_database_state, '3.1.36.0');
$this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::level_2_complete_maintenance);
$this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::STATUS_FULL_SITE);
$this->_redirect_after_action(
true,
esc_html__("Database", 'event_espresso'),
Expand Down
19 changes: 7 additions & 12 deletions admin_pages/maintenance/Maintenance_Admin_Page_Init.core.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use EventEspresso\core\domain\entities\admin\menu\AdminMenuItem;
use EventEspresso\core\domain\services\database\MaintenanceStatus;

/**
* Event Espresso
Expand All @@ -17,21 +18,15 @@
*/
class Maintenance_Admin_Page_Init extends EE_Admin_Page_Init
{
/**
* @var int
*/
protected $m_mode_level;
protected int $m_mode_level;

/**
* @var bool
*/
protected $is_full_m_mode;
protected bool $is_full_m_mode;


public function __construct()
{
$this->m_mode_level = EE_Maintenance_Mode::instance()->level();
$this->is_full_m_mode = $this->m_mode_level /*=== EE_Maintenance_Mode::level_2_complete_maintenance*/;
$this->is_full_m_mode = MaintenanceStatus::isNotDisabled();
// define some page related constants
if (! defined('EE_MAINTENANCE_PG_SLUG')) {
define('EE_MAINTENANCE_LABEL', esc_html__('Maintenance', 'event_espresso'));
Expand Down Expand Up @@ -82,8 +77,8 @@ public function check_maintenance_mode()
EE_Admin_Page::add_query_args_and_nonce([], EE_MAINTENANCE_ADMIN_URL)
);
switch ($this->m_mode_level) {
case EE_Maintenance_Mode::level_1_frontend_only_maintenance:
$notice = '<div class="update-nag ee-update-nag">';
case EE_Maintenance_Mode::STATUS_PUBLIC_ONLY:
$notice = '<div class="notice ee-nag-notice ee-status-outline ee-status-outline--warning ee-status-bg--warning">';
$notice .= sprintf(
esc_html__(
"Event Espresso is in Frontend-Only MAINTENANCE MODE. This means the front-end (ie, non-wp-admin pages) is disabled for ALL users except site admins. Visit the %s Maintenance Page %s to disable maintenance mode.",
Expand All @@ -94,7 +89,7 @@ public function check_maintenance_mode()
);
$notice .= '</div>';
break;
case EE_Maintenance_Mode::level_2_complete_maintenance:
case EE_Maintenance_Mode::STATUS_FULL_SITE:
$notice = '<div class="error"><p>';
$notice .= sprintf(
esc_html__(
Expand Down
Loading

0 comments on commit a489b2b

Please sign in to comment.