*/ class Cli { /** * Show builder status. */ public function status() { $ids = Document::all_built( 5000 ); \WP_CLI::line( 'Akram ' . AKRAM_VERSION ); \WP_CLI::line( 'Built documents: ' . count( $ids ) ); \WP_CLI::line( 'CSS method: ' . Options::get( 'css_method' ) ); \WP_CLI::line( 'Uploads writable: ' . ( Document::ensure_upload_dir() ? 'yes' : 'no' ) ); \WP_CLI::line( 'Rebuild pending: ' . ( get_option( 'akram_needs_rebuild' ) ? 'yes (Akram → Tools → Rebuild)' : 'no' ) ); } /** * Rebuild every stylesheet (documents and design system) from the saved design data. */ public function css() { $n = Document::rebuild_all_css(); \WP_CLI::success( "Regenerated CSS for {$n} documents." ); } /** * Export globals, templates and pages as a site kit JSON. * * * : Destination file. */ public function export( $args ) { $data = Rest::kit_export(); file_put_contents( $args[0], wp_json_encode( $data, JSON_PRETTY_PRINT ) ); \WP_CLI::success( 'Exported ' . count( $data['templates'] ) . ' templates and ' . count( $data['pages'] ) . ' pages.' ); } /** * Purge page caches. */ public function flush() { Frontend::flush_caches(); delete_transient( 'akram_tb_index' ); \WP_CLI::success( 'Caches flushed.' ); } }