File size: 3,890 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import {
	HOSTING_RESTORE_DATABASE_PASSWORD,
	HOSTING_GEO_AFFINITY_REQUEST,
	HOSTING_SFTP_USER_CREATE,
	HOSTING_SFTP_USERS_REQUEST,
	HOSTING_SFTP_PASSWORD_RESET,
	HOSTING_SFTP_USER_UPDATE,
	HOSTING_SFTP_USERS_SET,
	HOSTING_SSH_ACCESS_REQUEST,
	HOSTING_SSH_ACCESS_SET,
	HOSTING_SSH_ACCESS_ENABLE,
	HOSTING_SSH_ACCESS_DISABLE,
	HOSTING_PHP_VERSION_REQUEST,
	HOSTING_PHP_VERSION_SET_REQUEST,
	HOSTING_CLEAR_CACHE_REQUEST,
	HOSTING_STATIC_FILE_404_REQUEST,
	HOSTING_STATIC_FILE_404_SET_REQUEST,
	HOSTING_WP_VERSION_REQUEST,
	HOSTING_WP_VERSION_SET_REQUEST,
	HOSTING_CLEAR_EDGE_CACHE_SUCCESS,
} from 'calypso/state/action-types';

import 'calypso/state/data-layer/wpcom/sites/hosting/restore-database-password';
import 'calypso/state/data-layer/wpcom/sites/hosting/geo-affinity';
import 'calypso/state/data-layer/wpcom/sites/hosting/sftp-user';
import 'calypso/state/data-layer/wpcom/sites/hosting/ssh-access';
import 'calypso/state/data-layer/wpcom/sites/hosting/php-version';
import 'calypso/state/data-layer/wpcom/sites/hosting/static-file-404';
import 'calypso/state/data-layer/wpcom/sites/hosting/wp-version';
import 'calypso/state/data-layer/wpcom/sites/hosting/clear-cache';
import 'calypso/state/hosting/init';

export const restoreDatabasePassword = ( siteId ) => ( {
	type: HOSTING_RESTORE_DATABASE_PASSWORD,
	siteId,
} );

export const requestAtomicSftpUsers = ( siteId ) => ( {
	type: HOSTING_SFTP_USERS_REQUEST,
	siteId,
} );

export const setAtomicSftpUsers = ( siteId, users ) => ( {
	type: HOSTING_SFTP_USERS_SET,
	siteId,
	users,
} );

export const updateAtomicSftpUser = ( siteId, users ) => ( {
	type: HOSTING_SFTP_USER_UPDATE,
	siteId,
	users,
} );

export const createAtomicSftpUser = ( siteId, userId ) => ( {
	type: HOSTING_SFTP_USER_CREATE,
	siteId,
	userId,
} );

export const resetAtomicSftpPassword = ( siteId, sshUsername ) => ( {
	type: HOSTING_SFTP_PASSWORD_RESET,
	siteId,
	sshUsername,
} );

export const requestAtomicSshAccess = ( siteId ) => ( {
	type: HOSTING_SSH_ACCESS_REQUEST,
	siteId,
} );

export const setAtomicSshAccess = ( siteId, status ) => ( {
	type: HOSTING_SSH_ACCESS_SET,
	siteId,
	status,
} );

export const enableAtomicSshAccess = ( siteId ) => ( {
	type: HOSTING_SSH_ACCESS_ENABLE,
	siteId,
} );

export const disableAtomicSshAccess = ( siteId ) => ( {
	type: HOSTING_SSH_ACCESS_DISABLE,
	siteId,
} );

export const updateAtomicPhpVersion = ( siteId, version ) => ( {
	type: HOSTING_PHP_VERSION_SET_REQUEST,
	siteId,
	version,
	meta: {
		dataLayer: {
			trackRequest: true,
			requestKey: `${ HOSTING_PHP_VERSION_SET_REQUEST }-${ siteId }`,
		},
	},
} );

export const clearWordPressCache = ( siteId, reason ) => ( {
	type: HOSTING_CLEAR_CACHE_REQUEST,
	reason,
	siteId,
	meta: {
		dataLayer: {
			trackRequest: true,
			requestKey: `${ HOSTING_CLEAR_CACHE_REQUEST }-${ siteId }`,
		},
	},
} );

export const clearEdgeCacheSuccess = ( siteId ) => ( {
	type: HOSTING_CLEAR_EDGE_CACHE_SUCCESS,
	siteId,
} );

export const getAtomicGeoAffinity = ( siteId ) => ( {
	type: HOSTING_GEO_AFFINITY_REQUEST,
	siteId,
} );

export const getAtomicPhpVersion = ( siteId ) => ( {
	type: HOSTING_PHP_VERSION_REQUEST,
	siteId,
} );

export const getAtomicWpVersion = ( siteId ) => ( {
	type: HOSTING_WP_VERSION_REQUEST,
	siteId,
} );

export const updateAtomicWpVersion = ( siteId, version ) => ( {
	type: HOSTING_WP_VERSION_SET_REQUEST,
	siteId,
	version,
	meta: {
		dataLayer: {
			trackRequest: true,
			requestKey: `${ HOSTING_WP_VERSION_SET_REQUEST }-${ siteId }`,
		},
	},
} );

export const updateAtomicStaticFile404 = ( siteId, setting ) => ( {
	type: HOSTING_STATIC_FILE_404_SET_REQUEST,
	siteId,
	setting,
	meta: {
		dataLayer: {
			trackRequest: true,
			requestKey: `${ HOSTING_STATIC_FILE_404_SET_REQUEST }-${ siteId }`,
		},
	},
} );

export const getAtomicStaticFile404 = ( siteId ) => ( {
	type: HOSTING_STATIC_FILE_404_REQUEST,
	siteId,
} );