File size: 2,372 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 |
import wpcom from 'calypso/lib/wp';
import type { DataCenterOption } from 'calypso/data/data-center/types';
export async function fetchWordPressVersion( siteId: number ): Promise< string > {
return wpcom.req.get( {
path: `/sites/${ siteId }/hosting/wp-version`,
apiNamespace: 'wpcom/v2',
} );
}
export async function updateWordPressVersion( siteId: number, version: string ) {
return wpcom.req.post(
{
path: `/sites/${ siteId }/hosting/wp-version`,
apiNamespace: 'wpcom/v2',
},
{ version }
);
}
export async function fetchPHPVersion( siteId: number ): Promise< string > {
return wpcom.req.get( {
path: `/sites/${ siteId }/hosting/php-version`,
apiNamespace: 'wpcom/v2',
} );
}
export async function updatePHPVersion( siteId: number, version: string ) {
return wpcom.req.post(
{
path: `/sites/${ siteId }/hosting/php-version`,
apiNamespace: 'wpcom/v2',
},
{ version }
);
}
export async function fetchPhpMyAdminToken( siteId: number ): Promise< string > {
const { token } = await wpcom.req.post( {
path: `/sites/${ siteId }/hosting/pma/token`,
apiNamespace: 'wpcom/v2',
} );
return token;
}
export async function fetchPrimaryDataCenter( siteId: number ): Promise< DataCenterOption | null > {
return wpcom.req.get( {
path: `/sites/${ siteId }/hosting/geo-affinity`,
apiNamespace: 'wpcom/v2',
} );
}
export async function fetchStaticFile404Setting( siteId: number ): Promise< string > {
return wpcom.req.get( {
path: `/sites/${ siteId }/hosting/static-file-404`,
apiNamespace: 'wpcom/v2',
} );
}
export async function updateStaticFile404Setting( siteId: number, setting: string ) {
return wpcom.req.post(
{
path: `/sites/${ siteId }/hosting/static-file-404`,
apiNamespace: 'wpcom/v2',
},
{ setting }
);
}
export async function clearObjectCache( siteId: number, reason: string ) {
return wpcom.req.post(
{
path: `/sites/${ siteId }/hosting/clear-cache`,
apiNamespace: 'wpcom/v2',
},
{ reason }
);
}
export async function restoreDatabasePassword( siteId: number ) {
return wpcom.req.post( {
path: `/sites/${ siteId }/hosting/restore-database-password`,
apiNamespace: 'wpcom/v2',
} );
}
export async function restoreSitePlanSoftware( siteId: number ) {
return wpcom.req.post( {
path: `/sites/${ siteId }/hosting/restore-plan-software`,
apiNamespace: 'wpcom/v2',
} );
}
|