[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/scripts/ -> upgrade-set-permissions.php (source)

   1  <?php
   2  require_once dirname( dirname( __FILE__ ) ) . '/gp-load.php';
   3  
   4  class GP_Script_Upgrade_Permissions extends GP_CLI {
   5      
   6  	function run() {
   7          $permissions = GP::$permission->find_many( array( 'object_type' => 'translation-set', 'action' => 'approve' ) );
   8          foreach( $permissions as $permission ) {
   9              $set = GP::$translation_set->get( $permission->object_id );
  10              $project = GP::$project->get( $set->project_id );
  11              GP::$permission->create( array(
  12                  'user_id' => $permission->user_id,
  13                  'action' => 'approve',
  14                  'object_type' => 'project|locale|set-slug',
  15                  'object_id' => $project->id.'|'.$set->locale.'|'.$set->slug,
  16              ) );
  17          }
  18      }
  19  }
  20  $gp_script_upgrade_permissions = new GP_Script_Upgrade_Permissions;
  21  $gp_script_upgrade_permissions->run();


Generated: Thu May 24 03:59:35 2012 Hosted by follow the white rabbit.