Making WordPress.org

Changeset 2543


Ignore:
Timestamp:
02/22/2016 07:37:47 PM (8 years ago)
Author:
ocean90
Message:

Translate: Store the timestamp of the last update for projects.

See #1590.

Location:
sites/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-specifics.php

    r2167 r2543  
    1414        $this->add_filter( 'projects', array( 'args' => 2 ) );
    1515        $this->add_action( 'before_request', array( 'args' => 2 ) );
     16        $this->add_action( 'project_created' );
     17        $this->add_action( 'project_saved' );
     18    }
     19
     20    function project_created() {
     21        $this->update_projects_last_updated();
     22    }
     23
     24    function project_saved() {
     25        $this->update_projects_last_updated();
     26    }
     27
     28    /**
     29     * Stores the timestamp of the last update for projects.
     30     *
     31     * Used by the Rosetta Roles plugin to invalidate local caches.
     32     */
     33    function update_projects_last_updated() {
     34        gp_update_option( 'wporg_projects_last_updated', time() );
    1635    }
    1736
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/wporg-gp-customizations.php

    r2275 r2543  
    1515        add_filter( 'gp_projects', array( $this, 'natural_sort_projects' ), 10, 2 );
    1616        add_action( 'gp_before_request', array( $this, 'disable_translation_propagation_on_import' ), 10, 2 );
     17        add_action( 'gp_project_created', array( $this, 'update_projects_last_updated' ) );
     18        add_action( 'gp_project_saved', array( $this, 'update_projects_last_updated' ) );
     19    }
     20
     21    /**
     22     * Stores the timestamp of the last update for projects.
     23     *
     24     * Used by the Rosetta Roles plugin to invalidate local caches.
     25     */
     26    public function update_projects_last_updated() {
     27        update_option( 'wporg_projects_last_updated', time() );
    1728    }
    1829
Note: See TracChangeset for help on using the changeset viewer.