[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-includes/cli/ -> branch-project.php (source)

   1  <?php
   2  
   3  class GP_CLI_Branch_Project extends WP_CLI_Command {
   4      /**
   5       * Branch a project
   6       *
   7       * Duplicates an existing project to create a new one.
   8       *
   9       * ## OPTIONS
  10       *
  11       * <source>
  12       * : Source project path to duplicate from
  13       *
  14       * <destination>
  15       * : Destination project path to duplicate to (must exist first)
  16       */
  17  	public function __invoke( $args ) {
  18          $source_project = GP::$project->by_path( $args[0] );
  19          if ( ! $source_project ){
  20              WP_CLI::error( __( 'Source project not found!', 'glotpress' ) );
  21          }
  22  
  23          $destination_project = GP::$project->by_path( $args[1] );
  24          if ( ! $destination_project ){
  25              WP_CLI::error( __( 'Destination project not found!', 'glotpress' ) );
  26          }
  27  
  28          $destination_project->duplicate_project_contents_from( $source_project );
  29      }
  30  }


Generated: Mon Nov 18 01:01:56 2019 Cross-referenced by PHPXref 0.7.1