Tag: Update
Clicking custom plugin admin menu redirects to “No Update Required” on live site
I built a custom WordPress plugin that sends woocommerce purchase info to a CRM. The plugin works perfectly on localhost. But on live site, whenever I click on the admin menu, I always get redirected to "No Update Required" page.
Here is my main plugin file:
/** * Plugin Name: Woo Crm * Description: Sends customer data to the CRM on purchase. */ if (!defined('ABSPATH')) { echo 'I am a plugin I cannot do anything when called directly.'; exit; } // Config define('PLUGIN_NAME', 'Woo Crm'); define('PLUGIN_SLUG', 'woo_crm'); define('PLUGIN_URL', plugin_dir_url(__FILE__)); define('PLUGIN_PATH', plugin_dir_path(__FILE__)); // Imports require_once(PLUGIN_PATH . 'utils/utils.php'); require_once(PLUGIN_PATH . 'views/views.php'); require_once(PLUGIN_PATH . 'services/crm/crm.php'); require_once(PLUGIN_PATH . 'views/components/settings/settings.php'); class WooCrm { function __construct() { // Register Styles add_action('admin_enqueue_scripts', array($ this, 'register_styles')); // Create Menu Page add_action('admin_menu', array($ this, 'plugin_setup_menu')); // Add Settings Fields to Menu Page add_action('admin_init', array('settings', 'init')); // Woocommerce hook /** * First check if WooCommerce is activated * Then check if hook isn't empty */ if (class_exists('WooCommerce')) { $ hook = get_when_to_send_data_hook(); if (!empty($ hook)) { add_action($ hook, array($ this, 'woo_order_create_client')); } } } function woo_order_create_client($ order_id) { // Create client logic } function plugin_setup_menu() { $ icon_url = PLUGIN_URL . "public/images/dash-icon.png"; add_menu_page(__(PLUGIN_NAME, PLUGIN_SLUG), __(PLUGIN_NAME, PLUGIN_SLUG), 'manage_options', PLUGIN_SLUG, array('views', 'admin'), $ icon_url); } function register_styles() { wp_register_style('woo_crm_admin', PLUGIN_URL . 'public/css/admin.css'); wp_enqueue_style('woo_crm_admin'); } } new WooCrm();
Any help would be highly appreciated.
[Vn5socks.net] Auto update 24/7 – Good socks 11h30 PM
BlackHatKings: Proxies and VPN Section Posted By: FireHeaven Post Time: 4th Mar 2021 at 04:30 PM
[Vn5socks.net] Auto update 24/7 – Good socks 11h15 AM
BlackHatKings: Proxies and VPN Section Posted By: FireHeaven Post Time: 3rd Mar 2021 at 04:12 AM
[DICHVUSOCKS.US] 22h15 PM UPDATE 24/24- Good Socks
BlackHatKings: Proxies and VPN Section Posted By: dichvusocks Post Time: 27th Feb 2021 at 02:45 PM
[DICHVUSOCKS.US] 22h15 PM UPDATE 24/24- Good Socks
BlackHatKings: Proxies and VPN Section Posted By: dichvusocks Post Time: 26th Feb 2021 at 10:53 PM
[DICHVUSOCKS.US] 22h15 PM UPDATE 24/24- Good Socks
BlackHatKings: Proxies and VPN Section Posted By: dichvusocks Post Time: 23rd Feb 2021 at 03:43 PM
MongoDB Shema to support concurrent update on a document
We were working on a project with a 300 documents with currentValue
field in a main collection, in order to track the history of each document of first collection. we created another collection named history
with approximately 6.5 millions of documents. For each input of system we have to add around 30 history item and update currentValue
field of main collection, so, We tried computational field design pattern for currentValue
, which lead us to have writeConfilict
in concurrent situations (at concurrency of around 1000 requests).
Then we tried to compute currentValue
field with sum
(amount
field) and groupBy
(mainId
field) on history collection which takes too long (> 3s).
Main collection docs:
{ "_id" : ObjectId(...), "stock" : [ { "currentAmount" : -313430.0, "lastPrice" : -10.0, "storage" : ObjectId("..."), "alarmCapacity" : 12 }, { "currentAmount" : 30, "lastPrice" : 0, "storage" : ObjectId("..."), "alarmCapacity" : 12 }, . . . ], "name" : "name", }
History collection docs:
{ "_id" : ObjectId("..."), "mainId" : ObjectId("..."), "amount" : 5, }
If you have any other idea to handle this situation(application or db level), I would be thankful.
UPDATE 1
The update query if I use computed pattern would be:
mainCollection.findOneAndUpdate( { $ and: [ { _id: id }, { "stock.storage": fromId }, { "stock.deletedAt": null } ], }, { $ inc: { "stock.$ .currentAmount": -1 * amount, } }, { session } )
And Aggregation pipeline if I want to calculate currentAmount
everytime:
mainCollection.aggregate([ { $ match: { branch: new ObjectId("...") } }, { $ group: { _id: "$ ingredient", currentAmount: { $ sum: "$ amount" } } }])
[DICHVUSOCKS.US] 22h15 PM UPDATE 24/24- Good Socks
BlackHatKings: Proxies and VPN Section Posted By: dichvusocks Post Time: 20th Feb 2021 at 02:46 PM
[DICHVUSOCKS.US] 13h15 PM UPDATE 24/24- Good Socks
BlackHatKings: Proxies and VPN Section Posted By: dichvusocks Post Time: 20th Feb 2021 at 05:56 AM