Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ Web Server : Apache/2.4.52 (Ubuntu) System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.22 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/1534260/cwd/plugins/jetpack/jetpack_vendor/automattic/jetpack-backup/src/js/actions/ |
Upload File : |
import apiFetch from '@wordpress/api-fetch'; import { SITE_BACKUP_SIZE_GET, SITE_BACKUP_SIZE_GET_FAILED, SITE_BACKUP_SIZE_GET_SUCCESS, SITE_BACKUP_POLICIES_GET, SITE_BACKUP_POLICIES_GET_FAILED, SITE_BACKUP_POLICIES_GET_SUCCESS, SITE_BACKUP_STORAGE_SET, SITE_BACKUP_STORAGE_ADDON_OFFER_SET, } from './types'; const getSiteSize = () => ( { dispatch } ) => { dispatch( { type: SITE_BACKUP_SIZE_GET } ); apiFetch( { path: '/jetpack/v4/site/backup/size' } ).then( res => { if ( ! res.ok ) { dispatch( { type: SITE_BACKUP_SIZE_GET_FAILED } ); return; } const payload = { size: res.size, lastBackupSize: res.last_backup_size, minDaysOfBackupsAllowed: res.min_days_of_backups_allowed, daysOfBackupsAllowed: res.days_of_backups_allowed, daysOfBackupsSaved: res.days_of_backups_saved, retentionDays: res.retention_days, }; dispatch( { type: SITE_BACKUP_SIZE_GET_SUCCESS, payload } ); }, () => { dispatch( { type: SITE_BACKUP_SIZE_GET_FAILED } ); } ); }; const getSitePolicies = () => ( { dispatch } ) => { dispatch( { type: SITE_BACKUP_POLICIES_GET } ); apiFetch( { path: '/jetpack/v4/site/backup/policies' } ).then( res => { const payload = { activityLogLimitDays: res.policies?.activity_log_limit_days ?? null, storageLimitBytes: res.policies?.storage_limit_bytes ?? null, }; dispatch( { type: SITE_BACKUP_POLICIES_GET_SUCCESS, payload } ); }, () => { dispatch( { type: SITE_BACKUP_POLICIES_GET_FAILED } ); } ); }; const setStorageUsageLevel = usageLevel => ( { dispatch } ) => { dispatch( { type: SITE_BACKUP_STORAGE_SET, usageLevel, } ); }; const setAddonStorageOfferSlug = addonSlug => ( { dispatch } ) => { dispatch( { type: SITE_BACKUP_STORAGE_ADDON_OFFER_SET, addonOfferSlug: addonSlug, } ); }; const actions = { getSiteSize, getSitePolicies, setStorageUsageLevel, setAddonStorageOfferSlug, }; export default actions;