## ✅ Activity Log System - Complete
### Backend Implementation
**1. Database Table**
- `ActivityLogTable.php` - Table creation and management
- Auto-creates on plugin init
- Indexed for performance (user_id, action, object, created_at)
**2. Logger Class**
- `Logger.php` - Main logging functionality
- `log()` - Log activities
- `get_activities()` - Query with filters
- `get_stats()` - Activity statistics
- `cleanup()` - Delete old logs
**3. REST API**
- `ActivityLogController.php` - REST endpoints
- GET `/activity-log` - List activities
- POST `/activity-log` - Create activity
- GET `/activity-log/stats` - Get statistics
### Features
**Logging:**
- User ID and name
- Action type (order.created, product.updated, etc.)
- Object type and ID
- Object name (auto-resolved)
- Description
- Metadata (JSON)
- IP address
- User agent
- Timestamp
**Querying:**
- Pagination
- Filter by action, object, user, date
- Search by description, object name, user name
- Sort by date (newest first)
**Statistics:**
- Total activities
- By action (top 10)
- By user (top 10)
- Date range filtering
### Activity Types
**Orders:**
- order.created, order.updated, order.status_changed
- order.payment_completed, order.refunded, order.deleted
**Products:**
- product.created, product.updated
- product.stock_changed, product.deleted
**Customers:**
- customer.created, customer.updated, customer.deleted
**Notifications:**
- notification.sent, notification.failed, notification.clicked
**Settings:**
- settings.updated, channel.toggled, event.toggled
### Integration
- Registered in Bootstrap
- REST API routes registered
- Ready for WooCommerce hooks
- Ready for frontend UI
---
**Next:** Frontend UI + WooCommerce hooks
54 lines
1.5 KiB
PHP
54 lines
1.5 KiB
PHP
<?php
|
|
namespace WooNooW\Core;
|
|
|
|
use WooNooW\Core\Features;
|
|
use WooNooW\Admin\Menu;
|
|
use WooNooW\Admin\Assets;
|
|
use WooNooW\Admin\StandaloneAdmin;
|
|
use WooNooW\Compat\HideWooMenus;
|
|
use WooNooW\Compat\MenuProvider;
|
|
use WooNooW\Compat\AddonRegistry;
|
|
use WooNooW\Compat\RouteRegistry;
|
|
use WooNooW\Compat\NavigationRegistry;
|
|
use WooNooW\Compat\PaymentChannels;
|
|
use WooNooW\Compat\SettingsProvider;
|
|
use WooNooW\Admin\Rest\MenuController;
|
|
use WooNooW\Admin\Rest\SettingsController;
|
|
use WooNooW\Api\Routes;
|
|
use WooNooW\Core\Mail\MailQueue;
|
|
use WooNooW\Core\Mail\WooEmailOverride;
|
|
use WooNooW\Core\DataStores\OrderStore;
|
|
use WooNooW\Core\MediaUpload;
|
|
use WooNooW\Core\Notifications\PushNotificationHandler;
|
|
use WooNooW\Core\ActivityLog\ActivityLogTable;
|
|
use WooNooW\Branding;
|
|
|
|
class Bootstrap {
|
|
public static function init() {
|
|
Features::init();
|
|
HideWooMenus::init();
|
|
Menu::init();
|
|
Assets::init();
|
|
StandaloneAdmin::init();
|
|
Branding::init();
|
|
MediaUpload::init();
|
|
PushNotificationHandler::init();
|
|
|
|
// Activity Log
|
|
ActivityLogTable::create_table();
|
|
|
|
// Addon system (order matters: Registry → Routes → Navigation)
|
|
AddonRegistry::init();
|
|
RouteRegistry::init();
|
|
NavigationRegistry::init();
|
|
PaymentChannels::init();
|
|
|
|
MenuProvider::init();
|
|
MenuController::init();
|
|
SettingsProvider::init();
|
|
Routes::init();
|
|
MailQueue::init();
|
|
WooEmailOverride::init();
|
|
OrderStore::init();
|
|
}
|
|
} |