Changeset 1844
- Timestamp:
- 08/24/2015 07:59:04 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php
r1840 r1844 791 791 792 792 /** 793 * Hooks into the Suspend process to mark a theme as inactive in GlotPress. 794 * 795 * @param int $post_id The post ID being suspended 796 */ 797 function wporg_themes_glotpress_mark_as_inactive_on_suspend( $post_id ) { 798 $post = get_post( $post_id ); 799 if ( ! $post || 'repopackage' != $post->post_type ) { 800 return; 801 } 802 803 wporg_themes_glotpress_import( $post, 'inactve' ); 804 } 805 add_action( 'suspend_repopackage', 'wporg_themes_glotpress_mark_as_inactive_on_suspend' ); 806 807 /** 793 808 * Import theme strings to GlotPress on approval. 794 809 * 795 810 * @param WP_Post|int $theme_post The WP_Post (or post_id) representing the theme. 796 * @param string $version The version of the theme to import .811 * @param string $version The version of the theme to import, or 'inactive' to mark the translation project inactive. 797 812 */ 798 813 function wporg_themes_glotpress_import( $theme_post, $version ) { … … 809 824 add_action( 'wporg_themes_update_version_live', 'wporg_themes_glotpress_import', 100, 2 ); 810 825 826 /** 827 * A Daily cron task to mark any themes which are now older than 2 years inactive in GlotPress. 828 */ 829 function wporg_themes_check_for_old_themes() { 830 $too_old = strtotime( '-2 years' ); 831 832 $query = new WP_Query( array( 833 'post_type' => 'repopackage', 834 'post_status' => 'publish', 835 'date_query' => array( 836 'column' => 'post_modified', 837 'before' => date( 'Y-m-d 00:00:00', $too_old ), 838 'after' => date( 'Y-m-d 00:00:00', $too_old - DAY_IN_SECONDS ), 839 'inclusive' => true 840 ) 841 ) ); 842 $posts = $query->get_posts(); 843 844 foreach ( $posts as $post ) { 845 wporg_themes_glotpress_import( $post, 'inactive' ); 846 } 847 } 848 add_action( 'wporg_themes_check_for_old_themes', 'wporg_themes_check_for_old_themes' ); 849 850 /** 851 * Sets up the daily cron tasks for the Themes Directory 852 */ 853 function wporg_themes_maybe_schedule_daily_job() { 854 if ( ! wp_next_scheduled( 'wporg_themes_check_for_old_themes' ) ) { 855 wp_schedule_event( time(), 'daily', 'wporg_themes_check_for_old_themes' ); 856 } 857 } 858 add_action( 'admin_init', 'wporg_themes_maybe_schedule_daily_job' );
Note: See TracChangeset
for help on using the changeset viewer.