Changeset 1866 for sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-rosetta-roles/wporg-rosetta-roles.php
- Timestamp:
- 09/08/2015 09:04:07 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-rosetta-roles/wporg-rosetta-roles.php
r1834 r1866 41 41 parent::__construct(); 42 42 $this->add_filter( 'pre_can_user', array( 'args' => 2, 'priority' => 9 ) ); 43 $this->add_action( 'project_created' ); 44 $this->add_action( 'project_saved' ); 43 45 } 44 46 … … 98 100 99 101 return false; 102 } 103 104 /** 105 * Callback for when a project is created. 106 */ 107 public function project_created() { 108 $this->clear_project_cache(); 109 } 110 111 /** 112 * Callback for when a project is saved. 113 */ 114 public function project_saved() { 115 $this->clear_project_cache(); 100 116 } 101 117 … … 348 364 349 365 /** 366 * Removes all of the project ids from the cache. 367 */ 368 public function clear_project_cache() { 369 $projects = $this->get_all_projects(); 370 371 foreach ( $projects as $project ) { 372 $cache_key = 'project:' . $project->id . ':childs'; 373 wp_cache_delete( $cache_key, $this->cache_group ); 374 } 375 } 376 377 /** 350 378 * Extracts project ID and locale slug from object type and ID. 351 379 *
Note: See TracChangeset
for help on using the changeset viewer.