b6df4dbb92
MLS plugin fixes from this session: - Fix silent insert failures: location column NOT NULL was rejecting wpdb->insert calls, causing ~18k new properties since Dec 2025 to be lost. Inserts now build raw SQL with ST_PointFromText so the spatial column is populated atomically. - Auto-refresh expired media URLs in MLS_Media_Handler::fetch_and_cache(), guarded by a property-level GET_LOCK so concurrent fetches share one API refresh. - Normalize WP_Error to null in mls_get_property_image() so callers can rely on the documented string|null contract. - Support comma-separated property_type filters in MLS_Query and MLS_Cluster so the homepage "View All Commercial" link (?property_type=Commercial+Sale,Land,Farm) actually filters correctly. - Incremental sync now looks back 10 minutes past the latest modification timestamp as a safety margin against missed records. - Smart sync exits silently (info-level, not warning) when a full sync is in progress. Operational: - New cron: weekly full sync Sundays at 3 AM (/usr/local/bin/mls-full-sync). - New cron: hourly 2GB cap on mls-thumbnails/ and cache/transformed-images/ (/usr/local/bin/mls-image-cache-cap). - Logrotate config for wp-content/debug.log (2-day retention, daily rotation, delaycompress). Repo policy: - CLAUDE.md updated with explicit "commit everything except build artifacts" policy. - .gitignore: untrack runtime image caches and debug.log rotations. Other modifications in this snapshot are pre-existing in-flight theme/plugin/db_content_updates work. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
182 lines
3.1 KiB
JavaScript
Executable File
182 lines
3.1 KiB
JavaScript
Executable File
/* global wpforms_admin */
|
|
/**
|
|
* Connect functionality.
|
|
*
|
|
* @since 1.5.4
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var WPFormsConnect = window.WPFormsConnect || ( function( document, window, $ ) {
|
|
|
|
/**
|
|
* Elements reference.
|
|
*
|
|
* @since 1.5.5
|
|
*
|
|
* @type {object}
|
|
*/
|
|
var el = {
|
|
$connectBtn: $( '#wpforms-settings-connect-btn' ),
|
|
$connectKey: $( '#wpforms-settings-upgrade-license-key' ),
|
|
};
|
|
|
|
/**
|
|
* Public functions and properties.
|
|
*
|
|
* @since 1.5.5
|
|
*
|
|
* @type {object}
|
|
*/
|
|
var app = {
|
|
|
|
/**
|
|
* Start the engine.
|
|
*
|
|
* @since 1.5.5
|
|
*/
|
|
init: function() {
|
|
|
|
$( app.ready );
|
|
},
|
|
|
|
/**
|
|
* Document ready.
|
|
*
|
|
* @since 1.5.5
|
|
*/
|
|
ready: function() {
|
|
|
|
app.events();
|
|
},
|
|
|
|
/**
|
|
* Register JS events.
|
|
*
|
|
* @since 1.5.5
|
|
*/
|
|
events: function() {
|
|
|
|
app.connectBtnClick();
|
|
},
|
|
|
|
/**
|
|
* Register connect button event.
|
|
*
|
|
* @since 1.5.5
|
|
*/
|
|
connectBtnClick: function() {
|
|
el.$connectBtn.on( 'click', function( event ) {
|
|
event.preventDefault();
|
|
app.gotoUpgradeUrl();
|
|
} );
|
|
},
|
|
|
|
/**
|
|
* Get the alert arguments in case of Pro already installed.
|
|
*
|
|
* @since 1.5.5
|
|
*
|
|
* @param {object} res Ajax query result object.
|
|
*
|
|
* @returns {object} Alert arguments.
|
|
*/
|
|
proAlreadyInstalled: function( res ) {
|
|
|
|
var buttons = {
|
|
confirm: {
|
|
text: wpforms_admin.plugin_activate_btn,
|
|
btnClass: 'btn-confirm',
|
|
keys: [ 'enter' ],
|
|
action: function() {
|
|
window.location.reload();
|
|
},
|
|
},
|
|
};
|
|
|
|
return {
|
|
title: wpforms_admin.almost_done,
|
|
content: res.data.message,
|
|
icon: 'fa fa-check-circle',
|
|
type: 'green',
|
|
buttons: buttons,
|
|
};
|
|
},
|
|
|
|
/**
|
|
* Go to upgrade url.
|
|
*
|
|
* @since 1.5.5
|
|
*/
|
|
gotoUpgradeUrl: function() {
|
|
|
|
var data = {
|
|
action: 'wpforms_connect_url',
|
|
key: el.$connectKey.val(),
|
|
nonce: wpforms_admin.nonce,
|
|
};
|
|
|
|
$.post( wpforms_admin.ajax_url, data )
|
|
.done( function( res ) {
|
|
|
|
if ( res.success ) {
|
|
if ( res.data.reload ) {
|
|
$.alert( app.proAlreadyInstalled( res ) );
|
|
return;
|
|
}
|
|
window.location.href = res.data.url;
|
|
return;
|
|
}
|
|
$.alert( {
|
|
title: wpforms_admin.oops,
|
|
content: res.data.message,
|
|
icon: 'fa fa-exclamation-circle',
|
|
type: 'orange',
|
|
buttons: {
|
|
confirm: {
|
|
text: wpforms_admin.ok,
|
|
btnClass: 'btn-confirm',
|
|
keys: [ 'enter' ],
|
|
},
|
|
},
|
|
} );
|
|
} )
|
|
.fail( function( xhr ) {
|
|
|
|
app.failAlert( xhr );
|
|
} );
|
|
},
|
|
|
|
/**
|
|
* Alert in case of server error.
|
|
*
|
|
* @since 1.5.5
|
|
*
|
|
* @param {object} xhr XHR object.
|
|
*/
|
|
failAlert: function( xhr ) {
|
|
|
|
$.alert( {
|
|
title: wpforms_admin.oops,
|
|
content: wpforms_admin.server_error + '<br>' + xhr.status + ' ' + xhr.statusText + ' ' + xhr.responseText,
|
|
icon: 'fa fa-exclamation-circle',
|
|
type: 'orange',
|
|
buttons: {
|
|
confirm: {
|
|
text: wpforms_admin.ok,
|
|
btnClass: 'btn-confirm',
|
|
keys: [ 'enter' ],
|
|
},
|
|
},
|
|
} );
|
|
},
|
|
};
|
|
|
|
// Provide access to public functions/properties.
|
|
return app;
|
|
|
|
}( document, window, jQuery ) );
|
|
|
|
// Initialize.
|
|
WPFormsConnect.init();
|