Website : phonehp.ir
backdoor
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Home
Console
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Warning
: Undefined variable $backdoor in
/home/nehpir/public_html/goods.php
on line
326
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
nehpir
/
public_html
/
wp-content
/
plugins
/
woocommersa
/
includes
/
API
/
Filename :
JobController.php
back
Warning
: Undefined variable $file in
/home/nehpir/public_html/goods.php
on line
545
Copy
<?php namespace WooCommersa\API; if (!defined('ABSPATH')) exit; use WooCommersa\Core\JobManager; class JobController extends BaseController { public function __construct() { add_action('rest_api_init', [$this, 'register_routes']); } public function register_routes() { register_rest_route($this->namespace, '/jobs/active', [ 'methods' => 'GET', 'callback' => [$this, 'get_active_jobs'], 'permission_callback' => [$this, 'permissions_check'], ]); register_rest_route($this->namespace, '/jobs/cancel', [ 'methods' => 'POST', 'callback' => [$this, 'cancel_job'], 'permission_callback' => [$this, 'permissions_check'], ]); register_rest_route($this->namespace, '/jobs', [ 'methods' => 'POST', 'callback' => [$this, 'create_job'], 'permission_callback' => [$this, 'permissions_check'], ]); register_rest_route($this->namespace, '/jobs/(?P<id>[a-zA-Z0-9_\-]+)', [ 'methods' => 'GET', 'callback' => [$this, 'get_job_status'], 'permission_callback' => [$this, 'permissions_check'], ]); register_rest_route($this->namespace, '/jobs/process', [ 'methods' => 'POST', 'callback' => [$this, 'trigger_worker'], 'permission_callback' => [$this, 'permissions_check'], ]); } public function cancel_job($request) { $params = $request->get_json_params(); $id = $params['id'] ?? ''; if (empty($id)) return new \WP_REST_Response(['message' => 'No ID'], 400); $success = JobManager::cancel_job($id); return new \WP_REST_Response(['success' => (bool)$success], 200); } public function trigger_worker($request) { $params = $request->get_json_params(); $job_id = $params['job_id'] ?? ''; if (empty($job_id)) { return new \WP_REST_Response(['message' => 'No Job ID'], 400); } do_action('wm_process_job', $job_id); return new \WP_REST_Response(['success' => true], 200); } public function create_job($request) { $params = $request->get_json_params(); $ids = $params['ids'] ?? []; $updates = $params['updates'] ?? []; if (empty($ids)) return new \WP_REST_Response(['message' => 'No IDs'], 400); $job_id = JobManager::create_job('bulk_update', $ids, ['updates' => $updates]); return new \WP_REST_Response(['success' => true, 'job_id' => $job_id], 200); } public function get_active_jobs($request) { $type = $request->get_param('type'); $jobs = JobManager::list_recent_jobs($type); return new \WP_REST_Response($jobs, 200); } public function get_job_status($request) { $id = $request['id']; $job = JobManager::get_job($id); if (!$job) return new \WP_REST_Response(['message' => 'Not found'], 404); return new \WP_REST_Response($job, 200); } }